summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt5
-rw-r--r--VERSION4
-rw-r--r--client/client_priv.h1
-rw-r--r--client/mysql_upgrade.c2
-rw-r--r--client/mysqlbinlog.cc6
-rw-r--r--client/mysqldump.c71
-rw-r--r--client/mysqltest.cc9
-rw-r--r--cmake/FindLIBAIO.cmake4
-rw-r--r--cmake/FindLZ4.cmake16
-rw-r--r--cmake/FindLZO.cmake9
-rw-r--r--cmake/FindPMEM.cmake6
-rw-r--r--cmake/FindSnappy.cmake9
-rw-r--r--cmake/FindURING.cmake6
-rw-r--r--cmake/FindZSTD.cmake8
-rw-r--r--cmake/build_configurations/mysql_release.cmake11
-rw-r--r--cmake/libfmt.cmake53
-rw-r--r--cmake/maintainer.cmake1
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rwxr-xr-xdbug/tests-t.pl41
-rw-r--r--dbug/tests.c7
-rw-r--r--dbug/user.r28
-rw-r--r--debian/additions/mariadb.conf.d/50-server.cnf4
-rw-r--r--debian/additions/source_mariadb-10.7.py (renamed from debian/additions/source_mariadb-10.6.py)4
-rwxr-xr-xdebian/autobake-deb.sh11
-rw-r--r--debian/changelog4
-rw-r--r--debian/control179
-rw-r--r--debian/mariadb-client-10.7.README.Debian (renamed from debian/mariadb-client-10.6.README.Debian)0
-rw-r--r--debian/mariadb-client-10.7.docs (renamed from debian/mariadb-client-10.6.docs)0
-rw-r--r--debian/mariadb-client-10.7.install (renamed from debian/mariadb-client-10.6.install)0
-rw-r--r--debian/mariadb-client-10.7.links (renamed from debian/mariadb-client-10.6.links)0
-rw-r--r--debian/mariadb-client-10.7.manpages (renamed from debian/mariadb-client-10.6.manpages)0
-rw-r--r--debian/mariadb-client-10.7.menu (renamed from debian/mariadb-client-10.6.menu)2
-rw-r--r--debian/mariadb-client-core-10.7.install (renamed from debian/mariadb-client-core-10.6.install)0
-rw-r--r--debian/mariadb-client-core-10.7.links (renamed from debian/mariadb-client-core-10.6.links)0
-rw-r--r--debian/mariadb-plugin-provider-bzip2.install2
-rw-r--r--debian/mariadb-plugin-provider-bzip2.lintian-overrides3
-rw-r--r--debian/mariadb-plugin-provider-lz4.install2
-rw-r--r--debian/mariadb-plugin-provider-lz4.lintian-overrides3
-rw-r--r--debian/mariadb-plugin-provider-lzma.install2
-rw-r--r--debian/mariadb-plugin-provider-lzma.lintian-overrides3
-rw-r--r--debian/mariadb-plugin-provider-lzo.install2
-rw-r--r--debian/mariadb-plugin-provider-lzo.lintian-overrides3
-rw-r--r--debian/mariadb-plugin-provider-snappy.install2
-rw-r--r--debian/mariadb-plugin-provider-snappy.lintian-overrides3
-rw-r--r--debian/mariadb-server-10.7.README.Debian (renamed from debian/mariadb-server-10.6.README.Debian)0
-rw-r--r--debian/mariadb-server-10.7.config (renamed from debian/mariadb-server-10.6.config)2
-rw-r--r--debian/mariadb-server-10.7.dirs (renamed from debian/mariadb-server-10.6.dirs)0
-rw-r--r--debian/mariadb-server-10.7.install (renamed from debian/mariadb-server-10.6.install)5
-rw-r--r--debian/mariadb-server-10.7.links (renamed from debian/mariadb-server-10.6.links)0
-rw-r--r--debian/mariadb-server-10.7.logcheck.ignore.paranoid (renamed from debian/mariadb-server-10.6.logcheck.ignore.paranoid)0
-rw-r--r--debian/mariadb-server-10.7.logcheck.ignore.server (renamed from debian/mariadb-server-10.6.logcheck.ignore.server)0
-rw-r--r--debian/mariadb-server-10.7.logcheck.ignore.workstation (renamed from debian/mariadb-server-10.6.logcheck.ignore.workstation)0
-rw-r--r--debian/mariadb-server-10.7.mariadb.init (renamed from debian/mariadb-server-10.6.mariadb.init)2
-rw-r--r--debian/mariadb-server-10.7.mysql-server.logrotate (renamed from debian/mariadb-server-10.6.mysql-server.logrotate)0
-rw-r--r--debian/mariadb-server-10.7.mysql.default (renamed from debian/mariadb-server-10.6.mysql.default)0
-rw-r--r--debian/mariadb-server-10.7.postinst (renamed from debian/mariadb-server-10.6.postinst)0
-rw-r--r--debian/mariadb-server-10.7.postrm (renamed from debian/mariadb-server-10.6.postrm)0
-rw-r--r--debian/mariadb-server-10.7.preinst (renamed from debian/mariadb-server-10.6.preinst)0
-rw-r--r--debian/mariadb-server-10.7.prerm (renamed from debian/mariadb-server-10.6.prerm)0
-rw-r--r--debian/mariadb-server-10.7.templates (renamed from debian/mariadb-server-10.6.templates)6
-rw-r--r--debian/mariadb-server-10.7.triggers (renamed from debian/mariadb-server-10.6.triggers)0
-rw-r--r--debian/mariadb-server-core-10.7.install (renamed from debian/mariadb-server-core-10.6.install)0
-rw-r--r--debian/mariadb-server-core-10.7.links (renamed from debian/mariadb-server-core-10.6.links)0
-rw-r--r--debian/not-installed18
-rw-r--r--debian/po/POTFILES.in2
-rw-r--r--debian/po/ar.po22
-rw-r--r--debian/po/ca.po26
-rw-r--r--debian/po/cs.po24
-rw-r--r--debian/po/da.po30
-rw-r--r--debian/po/de.po24
-rw-r--r--debian/po/es.po22
-rw-r--r--debian/po/eu.po22
-rw-r--r--debian/po/fi.po28
-rw-r--r--debian/po/fr.po26
-rw-r--r--debian/po/gl.po22
-rw-r--r--debian/po/it.po28
-rw-r--r--debian/po/ja.po24
-rw-r--r--debian/po/nb.po22
-rw-r--r--debian/po/nl.po24
-rw-r--r--debian/po/pt.po24
-rw-r--r--debian/po/pt_BR.po28
-rw-r--r--debian/po/ro.po22
-rw-r--r--debian/po/ru.po24
-rw-r--r--debian/po/sv.po26
-rw-r--r--debian/po/templates.pot26
-rw-r--r--debian/po/tr.po24
-rw-r--r--debian/po/vi.po30
-rwxr-xr-xdebian/rules14
-rw-r--r--debian/salsa-ci.yml24
-rw-r--r--debian/source/lintian-overrides12
-rw-r--r--debian/tests/control7
-rw-r--r--debian/tests/smoke17
-rw-r--r--extra/comp_err.c4
-rw-r--r--extra/innochecksum.cc23
-rw-r--r--extra/mariabackup/CMakeLists.txt2
-rw-r--r--extra/mariabackup/backup_mysql.cc9
-rw-r--r--extra/mariabackup/common.h5
-rw-r--r--extra/mariabackup/ds_local.cc4
-rw-r--r--extra/mariabackup/encryption_plugin.h7
-rw-r--r--extra/mariabackup/fil_cur.cc13
-rw-r--r--extra/mariabackup/fil_cur.h4
-rw-r--r--extra/mariabackup/read_filt.h2
-rw-r--r--extra/mariabackup/write_filt.cc4
-rw-r--r--extra/mariabackup/xb_plugin.cc (renamed from extra/mariabackup/encryption_plugin.cc)147
-rw-r--r--extra/mariabackup/xb_plugin.h5
-rw-r--r--extra/mariabackup/xtrabackup.cc127
-rw-r--r--extra/mariabackup/xtrabackup.h20
-rw-r--r--include/hash.h4
-rw-r--r--include/ilist.h4
-rw-r--r--include/json_lib.h7
-rw-r--r--include/mariadb_capi_rename.h2
-rw-r--r--include/my_alloc.h7
-rw-r--r--include/my_bitmap.h14
-rw-r--r--include/my_dbug.h12
-rw-r--r--include/my_dir.h4
-rw-r--r--include/my_sys.h45
-rw-r--r--include/mysql.h14
-rw-r--r--include/mysql/plugin.h2
-rw-r--r--include/mysql/plugin_audit.h.pp26
-rw-r--r--include/mysql/plugin_auth.h.pp26
-rw-r--r--include/mysql/plugin_data_type.h.pp26
-rw-r--r--include/mysql/plugin_encryption.h.pp26
-rw-r--r--include/mysql/plugin_ftparser.h.pp26
-rw-r--r--include/mysql/plugin_function.h.pp26
-rw-r--r--include/mysql/plugin_password_validation.h5
-rw-r--r--include/mysql/plugin_password_validation.h.pp29
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp2
-rw-r--r--include/mysql/psi/psi_base.h7
-rw-r--r--include/mysql/psi/psi_memory.h7
-rw-r--r--include/mysql/service_sql.h115
-rw-r--r--include/mysql/services.h1
-rw-r--r--include/providers/bzlib.h126
-rw-r--r--include/providers/lz4.h63
-rw-r--r--include/providers/lzma.h102
-rw-r--r--include/providers/lzo/lzo1x.h62
-rw-r--r--include/providers/snappy-c.h75
-rw-r--r--include/service_versions.h7
-rw-r--r--include/sql_common.h2
-rw-r--r--libmysqld/CMakeLists.txt8
-rw-r--r--libmysqld/lib_sql.cc21
-rw-r--r--libservices/CMakeLists.txt8
-rw-r--r--libservices/provider_service_bzip2.c (renamed from sql/sql_tablespace.h)15
-rw-r--r--libservices/provider_service_lz4.c14
-rw-r--r--libservices/provider_service_lzma.c17
-rw-r--r--libservices/provider_service_lzo.c14
-rw-r--r--libservices/provider_service_snappy.c17
-rw-r--r--libservices/sql_service.c19
-rw-r--r--man/mysql-stress-test.pl.12
-rw-r--r--man/mysql-test-run.pl.12
-rw-r--r--man/mysql.12
-rw-r--r--man/mysql.server.12
-rw-r--r--man/mysql_client_test.12
-rw-r--r--man/mysql_config.12
-rw-r--r--man/mysql_convert_table_format.12
-rw-r--r--man/mysql_find_rows.12
-rw-r--r--man/mysql_fix_extensions.12
-rw-r--r--man/mysql_install_db.12
-rw-r--r--man/mysql_ldb.12
-rw-r--r--man/mysql_plugin.12
-rw-r--r--man/mysql_secure_installation.12
-rw-r--r--man/mysql_setpermission.12
-rw-r--r--man/mysql_tzinfo_to_sql.12
-rw-r--r--man/mysql_upgrade.12
-rw-r--r--man/mysql_waitpid.12
-rw-r--r--man/mysqlaccess.12
-rw-r--r--man/mysqladmin.12
-rw-r--r--man/mysqlbinlog.12
-rw-r--r--man/mysqlcheck.12
-rw-r--r--man/mysqld.82
-rw-r--r--man/mysqld_multi.12
-rw-r--r--man/mysqld_safe.12
-rw-r--r--man/mysqld_safe_helper.12
-rw-r--r--man/mysqldump.12
-rw-r--r--man/mysqldumpslow.12
-rw-r--r--man/mysqlhotcopy.12
-rw-r--r--man/mysqlimport.12
-rw-r--r--man/mysqlshow.12
-rw-r--r--man/mysqlslap.12
-rw-r--r--man/mysqltest.12
-rw-r--r--mysql-test/collections/skip_list_ubsan.txt3
-rw-r--r--mysql-test/include/binlog_combinations.combinations8
-rw-r--r--mysql-test/include/binlog_combinations.inc5
-rw-r--r--mysql-test/include/ctype_ascii_order.inc7
-rw-r--r--mysql-test/include/gis_generic.inc4
-rw-r--r--mysql-test/include/lcase_names.combinations5
-rw-r--r--mysql-test/include/lcase_names.inc2
-rw-r--r--mysql-test/include/mtr_check.sql3
-rw-r--r--mysql-test/include/show_slave_status.inc4
-rw-r--r--mysql-test/include/type_mix_incompatible.inc252
-rw-r--r--mysql-test/include/wait_for_sql_thread_read_all.inc8
-rw-r--r--mysql-test/main/alter_table.result15
-rw-r--r--mysql-test/main/alter_table.test20
-rw-r--r--mysql-test/main/alter_table_combinations.result2
-rw-r--r--mysql-test/main/assign_key_cache.result2
-rw-r--r--mysql-test/main/count_distinct.result14
-rw-r--r--mysql-test/main/count_distinct.test21
-rw-r--r--mysql-test/main/create.test2
-rw-r--r--mysql-test/main/ctype_big5.result194
-rw-r--r--mysql-test/main/ctype_big5.test1
-rw-r--r--mysql-test/main/ctype_cp932.result275
-rw-r--r--mysql-test/main/ctype_cp932.test9
-rw-r--r--mysql-test/main/ctype_eucjpms.result275
-rw-r--r--mysql-test/main/ctype_eucjpms.test8
-rw-r--r--mysql-test/main/ctype_euckr.result270
-rw-r--r--mysql-test/main/ctype_euckr.test2
-rw-r--r--mysql-test/main/ctype_gb2312.result194
-rw-r--r--mysql-test/main/ctype_gb2312.test1
-rw-r--r--mysql-test/main/ctype_gbk.result194
-rw-r--r--mysql-test/main/ctype_gbk.test1
-rw-r--r--mysql-test/main/ctype_sjis.result270
-rw-r--r--mysql-test/main/ctype_sjis.test4
-rw-r--r--mysql-test/main/ctype_tis620.result46
-rw-r--r--mysql-test/main/ctype_ujis.result276
-rw-r--r--mysql-test/main/ctype_ujis.test10
-rw-r--r--mysql-test/main/ctype_utf8.result4
-rw-r--r--mysql-test/main/ctype_utf8.test2
-rw-r--r--mysql-test/main/ddl_i18n_koi8r.result10
-rw-r--r--mysql-test/main/ddl_i18n_utf8.result10
-rw-r--r--mysql-test/main/default.result6
-rw-r--r--mysql-test/main/func_hybrid_type.result16
-rw-r--r--mysql-test/main/func_in.result11
-rw-r--r--mysql-test/main/func_in.test11
-rw-r--r--mysql-test/main/func_misc.result5
-rw-r--r--mysql-test/main/func_misc.test1
-rw-r--r--mysql-test/main/func_sformat.result470
-rw-r--r--mysql-test/main/func_sformat.test255
-rw-r--r--mysql-test/main/func_time.result2
-rw-r--r--mysql-test/main/func_time.test2
-rw-r--r--mysql-test/main/get_diagnostics.result1065
-rw-r--r--mysql-test/main/get_diagnostics.test869
-rw-r--r--mysql-test/main/gis.result4
-rw-r--r--mysql-test/main/gis.test4
-rw-r--r--mysql-test/main/handlersocket.result2
-rw-r--r--mysql-test/main/information_schema_part.result36
-rw-r--r--mysql-test/main/invisible_field_debug.test14
-rw-r--r--mysql-test/main/json_equals.result98
-rw-r--r--mysql-test/main/json_equals.test72
-rw-r--r--mysql-test/main/json_normalize.result77
-rw-r--r--mysql-test/main/json_normalize.test58
-rw-r--r--mysql-test/main/long_unique_bugs.test2
-rw-r--r--mysql-test/main/mdl_sync.test8
-rw-r--r--mysql-test/main/metadata.result12
-rw-r--r--mysql-test/main/metadata.test4
-rw-r--r--mysql-test/main/mysql.result14
-rw-r--r--mysql-test/main/mysqld--help.result2
-rw-r--r--mysql-test/main/mysqld--help.test6
-rw-r--r--mysql-test/main/mysqldump-max.result84
-rw-r--r--mysql-test/main/mysqldump-system.result1455
-rw-r--r--mysql-test/main/mysqldump-timing.result3
-rw-r--r--mysql-test/main/mysqldump-utf8mb4.result3
-rw-r--r--mysql-test/main/mysqldump.result259
-rw-r--r--mysql-test/main/natural_sort_key.result214
-rw-r--r--mysql-test/main/natural_sort_key.test102
-rw-r--r--mysql-test/main/openssl_1.result12
-rw-r--r--mysql-test/main/partition.result2
-rw-r--r--mysql-test/main/partition_alter.result65
-rw-r--r--mysql-test/main/partition_alter.test49
-rw-r--r--mysql-test/main/partition_binlog.result10
-rw-r--r--mysql-test/main/partition_binlog.test2
-rw-r--r--mysql-test/main/partition_error.result6
-rw-r--r--mysql-test/main/partition_error.test2
-rw-r--r--mysql-test/main/partition_exchange.result1
-rw-r--r--mysql-test/main/partition_exchange.test2
-rw-r--r--mysql-test/main/partition_mgm_err.result12
-rw-r--r--mysql-test/main/partition_mgm_err.test12
-rw-r--r--mysql-test/main/partition_range.result12
-rw-r--r--mysql-test/main/partition_sync.result2
-rw-r--r--mysql-test/main/partition_sync.test2
-rw-r--r--mysql-test/main/plugin.result6
-rw-r--r--mysql-test/main/ps.result6
-rw-r--r--mysql-test/main/ps_missed_cmds.result23
-rw-r--r--mysql-test/main/ps_missed_cmds.test45
-rw-r--r--mysql-test/main/ps_missed_cmds_bin_prot.result5
-rw-r--r--mysql-test/main/ps_missed_cmds_bin_prot.test13
-rw-r--r--mysql-test/main/signal_code.result16
-rw-r--r--mysql-test/main/signal_sqlmode.result4
-rw-r--r--mysql-test/main/sp-anchor-row-type-table.result2
-rw-r--r--mysql-test/main/sp-anchor-type.result14
-rw-r--r--mysql-test/main/sp-cursor.result4
-rw-r--r--mysql-test/main/sp-error.result2
-rw-r--r--mysql-test/main/sp-row.result6
-rw-r--r--mysql-test/main/sp-row.test6
-rw-r--r--mysql-test/main/sp-vars.result66
-rw-r--r--mysql-test/main/sp-vars.test6
-rw-r--r--mysql-test/main/sp.result44
-rw-r--r--mysql-test/main/sp.test19
-rw-r--r--mysql-test/main/trigger.result11
-rw-r--r--mysql-test/main/trigger.test6
-rw-r--r--mysql-test/main/truncate_notembedded.result3
-rw-r--r--mysql-test/main/truncate_notembedded.test7
-rw-r--r--mysql-test/main/type_date.result2
-rw-r--r--mysql-test/main/type_datetime.result4
-rw-r--r--mysql-test/main/type_decimal.result6
-rw-r--r--mysql-test/main/type_decimal.test3
-rw-r--r--mysql-test/main/type_enum.result31
-rw-r--r--mysql-test/main/type_enum.test30
-rw-r--r--mysql-test/main/type_geometry_mix_int.result351
-rw-r--r--mysql-test/main/type_geometry_mix_int.test19
-rw-r--r--mysql-test/main/type_newdecimal.result36
-rw-r--r--mysql-test/main/type_row.result23
-rw-r--r--mysql-test/main/type_row.test28
-rw-r--r--mysql-test/main/type_set.result31
-rw-r--r--mysql-test/main/type_set.test30
-rw-r--r--mysql-test/main/type_time_hires.result8
-rw-r--r--mysql-test/main/type_varchar.result8
-rw-r--r--mysql-test/main/union.test2
-rw-r--r--mysql-test/suite/archive/archive_gis.result4
-rw-r--r--mysql-test/suite/atomic/alter_partition,innodb.rdiff525
-rw-r--r--mysql-test/suite/atomic/alter_partition.combinations6
-rw-r--r--mysql-test/suite/atomic/alter_partition.result743
-rw-r--r--mysql-test/suite/atomic/alter_partition.test174
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result54
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result2
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-cursor.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-param.result46
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-row.result8
-rw-r--r--mysql-test/suite/compat/oracle/r/sp.result14
-rw-r--r--mysql-test/suite/compat/oracle/t/sp-row.test8
-rw-r--r--mysql-test/suite/encryption/r/bulk_insert.result7
-rw-r--r--mysql-test/suite/encryption/r/corrupted_during_recovery.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change.result28
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change2.result18
-rw-r--r--mysql-test/suite/encryption/r/innodb-bad-key-change4.result8
-rw-r--r--mysql-test/suite/encryption/r/innodb-missing-key.result8
-rw-r--r--mysql-test/suite/encryption/t/bulk_insert.opt1
-rw-r--r--mysql-test/suite/encryption/t/bulk_insert.test11
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.test6
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change.test20
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change2.test10
-rw-r--r--mysql-test/suite/encryption/t/innodb-bad-key-change4.test4
-rw-r--r--mysql-test/suite/encryption/t/innodb-missing-key.test8
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result54
-rw-r--r--mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result12
-rw-r--r--mysql-test/suite/engines/funcs/t/tc_partition_reorg_divide.test12
-rw-r--r--mysql-test/suite/engines/funcs/t/tc_partition_reorg_merge.test12
-rw-r--r--mysql-test/suite/federated/error_row_number.result26
-rw-r--r--mysql-test/suite/federated/error_row_number.test18
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0102.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0407.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_09.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_innodb.result32
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_memory.result38
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam.result38
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result38
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0102.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0407.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_09.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_1011ext.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0102.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0407.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_09.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result6
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result192
-rw-r--r--mysql-test/suite/galera/include/have_wsrep_replicate_myisam.inc4
-rw-r--r--mysql-test/suite/galera/r/MDEV-27001.result6
-rw-r--r--mysql-test/suite/galera/r/MW-416.result12
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result8
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_transactions.result8
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result34
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_strict_ddl.result26
-rw-r--r--mysql-test/suite/galera/t/MDEV-27001.opt1
-rw-r--r--mysql-test/suite/galera/t/MDEV-27001.test7
-rw-r--r--mysql-test/suite/galera/t/MW-416.test12
-rw-r--r--mysql-test/suite/galera/t/galera_backup_stage.test6
-rw-r--r--mysql-test/suite/galera/t/galera_defaults.test2
-rw-r--r--mysql-test/suite/galera/t/galera_myisam_transactions.test4
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test14
-rw-r--r--mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test13
-rw-r--r--mysql-test/suite/galera_3nodes/r/GCF-363.result4
-rw-r--r--mysql-test/suite/galera_3nodes/t/GCF-363.test6
-rw-r--r--mysql-test/suite/gcol/inc/gcol_column_def_options.inc2
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_index.result2
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_bzip2.opt1
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_lz4.opt2
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_lzma.opt2
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_lzo.opt2
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_snappy.opt2
-rw-r--r--mysql-test/suite/innodb/r/alter_kill.result2
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff19
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff19
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff19
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff19
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_loaded.result10
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff26
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff26
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff26
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff26
-rw-r--r--mysql-test/suite/innodb/r/compression_providers_unloaded.result14
-rw-r--r--mysql-test/suite/innodb/r/corrupted_during_recovery.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-online-alter-gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result4
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff9
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff9
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty.result179
-rw-r--r--mysql-test/suite/innodb/r/instant_alter.result12
-rw-r--r--mysql-test/suite/innodb/t/alter_kill.test5
-rw-r--r--mysql-test/suite/innodb/t/compression_providers_loaded.combinations19
-rw-r--r--mysql-test/suite/innodb/t/compression_providers_loaded.test18
-rw-r--r--mysql-test/suite/innodb/t/compression_providers_unloaded.combinations14
-rw-r--r--mysql-test/suite/innodb/t/compression_providers_unloaded.test13
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online-fk.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test15
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5980-alter.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug44571.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_page_compressed.combinations5
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test175
-rw-r--r--mysql-test/suite/innodb/t/log_corruption.test2
-rw-r--r--mysql-test/suite/innodb/t/log_file_name.test1
-rw-r--r--mysql-test/suite/innodb_gis/r/0.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result4
-rw-r--r--mysql-test/suite/innodb_gis/t/1.test4
-rw-r--r--mysql-test/suite/innodb_gis/t/gis.test4
-rw-r--r--mysql-test/suite/json/r/type_json.result58
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded,lz4.rdiff13
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded,lzma.rdiff13
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded,lzo.rdiff13
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded,snappy.rdiff13
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded.combinations14
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded.result27
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_loaded.test38
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded,lz4.rdiff22
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded,lzma.rdiff22
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded,lzo.rdiff22
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded,snappy.rdiff22
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded.combinations14
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded.result22
-rw-r--r--mysql-test/suite/mariabackup/compression_providers_unloaded.test35
-rw-r--r--mysql-test/suite/mariabackup/incremental_page_compressed.result13
-rw-r--r--mysql-test/suite/mariabackup/incremental_page_compressed.test38
-rw-r--r--mysql-test/suite/multi_source/change_master.result8
-rw-r--r--mysql-test/suite/multi_source/change_master.test13
-rw-r--r--mysql-test/suite/multi_source/multisource_for_channel.result370
-rw-r--r--mysql-test/suite/multi_source/multisource_for_channel.test438
-rw-r--r--mysql-test/suite/parts/inc/engines.combinations8
-rw-r--r--mysql-test/suite/parts/inc/engines.inc4
-rw-r--r--mysql-test/suite/parts/inc/partition.pre2
-rw-r--r--mysql-test/suite/parts/inc/partition_alter_1.inc6
-rw-r--r--mysql-test/suite/parts/inc/partition_fail.inc11
-rw-r--r--mysql-test/suite/parts/inc/partition_fail_t2.inc20
-rw-r--r--mysql-test/suite/parts/r/alter_table,list.rdiff85
-rw-r--r--mysql-test/suite/parts/r/alter_table.result316
-rw-r--r--mysql-test/suite/parts/r/debug_innodb_fail.result279
-rw-r--r--mysql-test/suite/parts/r/debug_myisam_fail.result279
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_innodb.result160
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_myisam.result160
-rw-r--r--mysql-test/suite/parts/r/partition_debug.result3478
-rw-r--r--mysql-test/suite/parts/r/partition_debug_innodb.result252
-rw-r--r--mysql-test/suite/parts/t/alter_table.combinations2
-rw-r--r--mysql-test/suite/parts/t/alter_table.test273
-rw-r--r--mysql-test/suite/parts/t/partition_debug.test111
-rw-r--r--mysql-test/suite/perfschema/r/digest_view.result50
-rw-r--r--mysql-test/suite/perfschema/r/max_program_zero.result2
-rw-r--r--mysql-test/suite/perfschema/r/misc.result13
-rw-r--r--mysql-test/suite/perfschema/r/ortho_iter.result2
-rw-r--r--mysql-test/suite/perfschema/r/privilege_table_io.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_idle.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_stages.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_statements.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_transactions.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_disable_waits.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_innodb.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result4
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_index.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_table_lock.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_account.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_cond_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_file_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_host.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_index.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mdl.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_memory_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_actors.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_setup_objects.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_socket_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stage_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_hdl.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_table_lock.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_class.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_thread_inst.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_transactions_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_user.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_off.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_on.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_variables.result2
-rw-r--r--mysql-test/suite/perfschema/r/statement_program_lost_inst.result2
-rw-r--r--mysql-test/suite/perfschema/t/misc.test20
-rw-r--r--mysql-test/suite/plugins/r/auth_ed25519.result2
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff24
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff24
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff24
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff24
-rw-r--r--mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff40
-rw-r--r--mysql-test/suite/plugins/r/compression.result22
-rw-r--r--mysql-test/suite/plugins/r/compression_load.result33
-rw-r--r--mysql-test/suite/plugins/r/cracklib_password_check.result16
-rw-r--r--mysql-test/suite/plugins/r/password_reuse_check.result94
-rw-r--r--mysql-test/suite/plugins/r/show_all_plugins.result4
-rw-r--r--mysql-test/suite/plugins/r/simple_password_check.result4
-rw-r--r--mysql-test/suite/plugins/r/test_sql_service.result96
-rw-r--r--mysql-test/suite/plugins/t/compression.combinations29
-rw-r--r--mysql-test/suite/plugins/t/compression.test52
-rw-r--r--mysql-test/suite/plugins/t/compression_load.test24
-rw-r--r--mysql-test/suite/plugins/t/cracklib_password_check.test8
-rw-r--r--mysql-test/suite/plugins/t/password_reuse_check.test100
-rw-r--r--mysql-test/suite/plugins/t/test_sql_service.test68
-rw-r--r--mysql-test/suite/roles/definer.result7
-rw-r--r--mysql-test/suite/rpl/include/rpl_extra_col_master.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_mixed_dml.inc18
-rw-r--r--mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc60
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result54
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result6
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test6
-rw-r--r--mysql-test/suite/s3/mysqldump.result6
-rw-r--r--mysql-test/suite/sql_sequence/mysqldump.result16
-rw-r--r--mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result102
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result25
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff9
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result30
-rw-r--r--mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test86
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test14
-rw-r--r--mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result4
-rw-r--r--mysql-test/suite/sysschema/r/pr_table_exists.result2
-rw-r--r--mysql-test/suite/vcol/r/binlog.result2
-rw-r--r--mysql-test/suite/versioning/r/data.result59
-rw-r--r--mysql-test/suite/versioning/r/partition,heap.rdiff86
-rw-r--r--mysql-test/suite/versioning/r/partition.result395
-rw-r--r--mysql-test/suite/versioning/t/alter.test4
-rw-r--r--mysql-test/suite/versioning/t/create.test6
-rw-r--r--mysql-test/suite/versioning/t/data.test32
-rw-r--r--mysql-test/suite/versioning/t/partition.test228
-rw-r--r--mysql-test/suite/wsrep/r/variables.result4
-rw-r--r--mysql-test/suite/wsrep/r/variables_debug.result3
-rw-r--r--mysys/array.c21
-rw-r--r--mysys/hash.c22
-rw-r--r--mysys/my_alloc.c268
-rw-r--r--mysys/my_bitmap.c69
-rw-r--r--mysys/my_default.c6
-rw-r--r--mysys/my_delete.c2
-rw-r--r--mysys/my_init.c11
-rw-r--r--mysys/my_lockmem.c4
-rw-r--r--mysys/my_malloc.c2
-rw-r--r--mysys/my_uuid.c31
-rw-r--r--mysys/thr_mutex.c9
-rw-r--r--mysys/waiting_threads.c2
-rw-r--r--plugin/auth_pam/auth_pam.c2
-rw-r--r--plugin/cracklib_password_check/cracklib_password_check.c13
-rw-r--r--plugin/password_reuse_check/CMakeLists.txt3
-rw-r--r--plugin/password_reuse_check/password_reuse_check.c262
-rw-r--r--plugin/provider_bzip2/CMakeLists.txt15
-rw-r--r--plugin/provider_bzip2/plugin.c61
-rw-r--r--plugin/provider_bzip2/provider_bzip2.cnf3
-rw-r--r--plugin/provider_lz4/CMakeLists.txt15
-rw-r--r--plugin/provider_lz4/plugin.c56
-rw-r--r--plugin/provider_lz4/provider_lz4.cnf3
-rw-r--r--plugin/provider_lzma/CMakeLists.txt15
-rw-r--r--plugin/provider_lzma/plugin.c55
-rw-r--r--plugin/provider_lzma/provider_lzma.cnf3
-rw-r--r--plugin/provider_lzo/CMakeLists.txt15
-rw-r--r--plugin/provider_lzo/plugin.c55
-rw-r--r--plugin/provider_lzo/provider_lzo.cnf3
-rw-r--r--plugin/provider_snappy/CMakeLists.txt15
-rw-r--r--plugin/provider_snappy/plugin.c58
-rw-r--r--plugin/provider_snappy/provider_snappy.cnf3
-rw-r--r--plugin/server_audit/server_audit.c1
-rw-r--r--plugin/simple_password_check/simple_password_check.c4
-rw-r--r--plugin/test_sql_service/CMakeLists.txt2
-rw-r--r--plugin/test_sql_service/test_sql_service.c227
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result48
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test49
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result353
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result353
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result406
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test21
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result400
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test21
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result353
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result353
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result353
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test19
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result51
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test41
-rw-r--r--plugin/type_mysql_json/type.cc14
-rw-r--r--plugin/type_uuid/CMakeLists.txt18
-rw-r--r--plugin/type_uuid/item_uuidfunc.cc46
-rw-r--r--plugin/type_uuid/item_uuidfunc.h67
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result37
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test32
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result60
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test72
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result35
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test30
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result35
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test33
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result35
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test33
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test18
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frmbin0 -> 944 bytes
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frmbin0 -> 944 bytes
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/suite.pm7
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result18
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test14
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid.result3189
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid.test1684
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result92
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test58
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc108
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result203
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test31
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result250
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test15
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result353
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result353
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result353
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result353
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result353
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test19
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result237
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test61
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result16
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test6
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result1797
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test104
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result31
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test27
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result24
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test22
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result17
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test17
-rw-r--r--plugin/type_uuid/plugin.cc122
-rw-r--r--plugin/type_uuid/sql_type_uuid.cc117
-rw-r--r--plugin/type_uuid/sql_type_uuid.h186
-rw-r--r--plugin/user_variables/mysql-test/user_variables/basic.result5
-rw-r--r--plugin/user_variables/mysql-test/user_variables/basic.test1
-rw-r--r--plugin/win_auth_client/handshake_client.cc2
-rw-r--r--scripts/fill_help_tables.sql1251
-rw-r--r--scripts/sys_schema/procedures/ps_setup_save.sql9
-rw-r--r--sql-common/client.c17
-rw-r--r--sql/CMakeLists.txt55
-rw-r--r--sql/backup.cc6
-rw-r--r--sql/ddl_log.cc83
-rw-r--r--sql/ddl_log.h10
-rw-r--r--sql/discover.cc2
-rw-r--r--sql/encryption.cc10
-rw-r--r--sql/field.cc64
-rw-r--r--sql/field.h6
-rw-r--r--sql/gcalc_slicescan.cc2
-rw-r--r--sql/ha_partition.cc19
-rw-r--r--sql/handler.cc27
-rw-r--r--sql/handler.h85
-rw-r--r--sql/hostname.cc2
-rw-r--r--sql/item.cc28
-rw-r--r--sql/item.h70
-rw-r--r--sql/item_cmpfunc.cc45
-rw-r--r--sql/item_cmpfunc.h41
-rw-r--r--sql/item_create.cc143
-rw-r--r--sql/item_func.cc3
-rw-r--r--sql/item_jsonfunc.cc107
-rw-r--r--sql/item_jsonfunc.h35
-rw-r--r--sql/item_strfunc.cc433
-rw-r--r--sql/item_strfunc.h70
-rw-r--r--sql/item_subselect.cc38
-rw-r--r--sql/item_subselect.h5
-rw-r--r--sql/item_xmlfunc.cc4
-rw-r--r--sql/json_table.cc3
-rw-r--r--sql/lex.h4
-rw-r--r--sql/lock.cc5
-rw-r--r--sql/log.cc27
-rw-r--r--sql/log_event.cc6
-rw-r--r--sql/log_event_client.cc2
-rw-r--r--sql/log_event_old.cc6
-rw-r--r--sql/log_event_server.cc14
-rw-r--r--sql/mdl.cc14
-rw-r--r--sql/mysqld.cc100
-rw-r--r--sql/mysqld.h13
-rw-r--r--sql/opt_range.cc42
-rw-r--r--sql/opt_split.cc2
-rw-r--r--sql/opt_subselect.cc6
-rw-r--r--sql/opt_table_elimination.cc2
-rw-r--r--sql/partition_element.h4
-rw-r--r--sql/partition_info.cc10
-rw-r--r--sql/partition_info.h13
-rw-r--r--sql/rpl_gtid.cc84
-rw-r--r--sql/rpl_mi.cc27
-rw-r--r--sql/rpl_mi.h2
-rw-r--r--sql/rpl_parallel.cc7
-rw-r--r--sql/rpl_rli.cc3
-rw-r--r--sql/rpl_utility.cc2
-rw-r--r--sql/semisync_master_ack_receiver.cc4
-rw-r--r--sql/semisync_slave.cc9
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/share/errmsg-utf8.txt26
-rw-r--r--sql/slave.cc12
-rw-r--r--sql/sp_head.cc22
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/sp_rcontext.cc5
-rw-r--r--sql/sp_rcontext.h7
-rw-r--r--sql/sql_acl.cc62
-rw-r--r--sql/sql_admin.cc3
-rw-r--r--sql/sql_alter.cc2
-rw-r--r--sql/sql_alter.h6
-rw-r--r--sql/sql_array.h20
-rw-r--r--sql/sql_audit.cc11
-rw-r--r--sql/sql_base.cc8
-rw-r--r--sql/sql_class.cc86
-rw-r--r--sql/sql_class.h77
-rw-r--r--sql/sql_cmd.h1
-rw-r--r--sql/sql_db.cc16
-rw-r--r--sql/sql_delete.cc5
-rw-r--r--sql/sql_error.cc18
-rw-r--r--sql/sql_error.h36
-rw-r--r--sql/sql_get_diagnostics.cc2
-rw-r--r--sql/sql_get_diagnostics.h3
-rw-r--r--sql/sql_insert.cc82
-rw-r--r--sql/sql_insert.h1
-rw-r--r--sql/sql_lex.cc33
-rw-r--r--sql/sql_lex.h10
-rw-r--r--sql/sql_load.cc1
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sql_partition.cc820
-rw-r--r--sql/sql_partition.h16
-rw-r--r--sql/sql_partition_admin.cc57
-rw-r--r--sql/sql_plugin.cc75
-rw-r--r--sql/sql_plugin.h2
-rw-r--r--sql/sql_plugin_services.inl101
-rw-r--r--sql/sql_prepare.cc468
-rw-r--r--sql/sql_prepare.h2
-rw-r--r--sql/sql_priv.h10
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_select.cc68
-rw-r--r--sql/sql_show.cc36
-rw-r--r--sql/sql_signal.cc24
-rw-r--r--sql/sql_table.cc177
-rw-r--r--sql/sql_table.h9
-rw-r--r--sql/sql_tablespace.cc72
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_tvc.cc8
-rw-r--r--sql/sql_type.cc2
-rw-r--r--sql/sql_update.cc11
-rw-r--r--sql/sql_yacc.yy560
-rw-r--r--sql/sys_vars.cc42
-rw-r--r--sql/table.cc83
-rw-r--r--sql/table.h24
-rw-r--r--sql/thread_pool_info.cc2
-rw-r--r--sql/tztime.cc2
-rw-r--r--sql/uniques.cc2
-rw-r--r--sql/wsrep_mysqld.cc67
-rw-r--r--sql/wsrep_mysqld.h2
-rw-r--r--sql/wsrep_trans_observer.h4
-rw-r--r--sql/wsrep_var.cc24
-rw-r--r--sql/wsrep_var.h4
-rw-r--r--storage/columnstore/CMakeLists.txt9
-rw-r--r--storage/connect/bsonudf.cpp3
-rw-r--r--storage/connect/ha_connect.cc52
-rw-r--r--storage/connect/jsonudf.cpp3
-rw-r--r--storage/connect/tabrest.cpp3
-rw-r--r--storage/connect/tabutil.cpp4
-rw-r--r--storage/csv/ha_tina.cc1
-rw-r--r--storage/example/ha_example.cc2
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc8
-rw-r--r--storage/innobase/CMakeLists.txt10
-rw-r--r--storage/innobase/btr/btr0btr.cc4
-rw-r--r--storage/innobase/btr/btr0cur.cc3
-rw-r--r--storage/innobase/buf/buf0buf.cc21
-rw-r--r--storage/innobase/buf/buf0dblwr.cc2
-rw-r--r--storage/innobase/buf/buf0dump.cc7
-rw-r--r--storage/innobase/buf/buf0flu.cc18
-rw-r--r--storage/innobase/buf/buf0rea.cc15
-rw-r--r--storage/innobase/bzip2.cmake36
-rw-r--r--storage/innobase/dict/dict0boot.cc6
-rw-r--r--storage/innobase/dict/dict0crea.cc10
-rw-r--r--storage/innobase/dict/dict0dict.cc14
-rw-r--r--storage/innobase/dict/dict0load.cc42
-rw-r--r--storage/innobase/dict/dict0mem.cc2
-rw-r--r--storage/innobase/dict/dict0stats.cc12
-rw-r--r--storage/innobase/fil/fil0crypt.cc15
-rw-r--r--storage/innobase/fil/fil0fil.cc183
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc62
-rw-r--r--storage/innobase/fsp/fsp0file.cc31
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc5
-rw-r--r--storage/innobase/fsp/fsp0space.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc242
-rw-r--r--storage/innobase/handler/handler0alter.cc4
-rw-r--r--storage/innobase/handler/i_s.cc4
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc4
-rw-r--r--storage/innobase/include/buf0buf.h30
-rw-r--r--storage/innobase/include/buf0flu.h2
-rw-r--r--storage/innobase/include/buf0rea.h10
-rw-r--r--storage/innobase/include/buf0types.h6
-rw-r--r--storage/innobase/include/dict0boot.h2
-rw-r--r--storage/innobase/include/dict0dict.h7
-rw-r--r--storage/innobase/include/dict0dict.inl14
-rw-r--r--storage/innobase/include/dict0mem.h14
-rw-r--r--storage/innobase/include/fil0crypt.h6
-rw-r--r--storage/innobase/include/fil0fil.h568
-rw-r--r--storage/innobase/include/fil0pagecompress.h9
-rw-r--r--storage/innobase/include/fsp0file.h33
-rw-r--r--storage/innobase/include/fsp0fsp.h45
-rw-r--r--storage/innobase/include/fsp0space.h52
-rw-r--r--storage/innobase/include/fsp0sysspace.h18
-rw-r--r--storage/innobase/include/fsp0types.h25
-rw-r--r--storage/innobase/include/ibuf0ibuf.h2
-rw-r--r--storage/innobase/include/log0log.inl4
-rw-r--r--storage/innobase/include/log0recv.h4
-rw-r--r--storage/innobase/include/mtr0mtr.h18
-rw-r--r--storage/innobase/include/row0merge.h102
-rw-r--r--storage/innobase/include/srv0srv.h4
-rw-r--r--storage/innobase/include/trx0rec.h2
-rw-r--r--storage/innobase/include/trx0trx.h68
-rw-r--r--storage/innobase/include/trx0types.h2
-rw-r--r--storage/innobase/include/univ.i32
-rw-r--r--storage/innobase/include/ut0pool.h5
-rw-r--r--storage/innobase/log/log0recv.cc326
-rw-r--r--storage/innobase/lz4.cmake38
-rw-r--r--storage/innobase/lzma.cmake35
-rw-r--r--storage/innobase/lzo.cmake34
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc5
-rw-r--r--storage/innobase/os/os0file.cc10
-rw-r--r--storage/innobase/row/row0ftsort.cc9
-rw-r--r--storage/innobase/row/row0import.cc92
-rw-r--r--storage/innobase/row/row0ins.cc36
-rw-r--r--storage/innobase/row/row0merge.cc688
-rw-r--r--storage/innobase/snappy.cmake34
-rw-r--r--storage/innobase/srv/srv0srv.cc13
-rw-r--r--storage/innobase/srv/srv0start.cc46
-rw-r--r--storage/innobase/trx/trx0purge.cc4
-rw-r--r--storage/innobase/trx/trx0rec.cc17
-rw-r--r--storage/innobase/trx/trx0roll.cc1
-rw-r--r--storage/innobase/trx/trx0sys.cc6
-rw-r--r--storage/innobase/trx/trx0trx.cc14
-rw-r--r--storage/innobase/ut/ut0ut.cc2
-rw-r--r--storage/maria/aria_chk.c2
-rw-r--r--storage/maria/ma_bitmap.c17
-rw-r--r--storage/maria/ma_control_file.c2
-rw-r--r--storage/maria/ma_ft_update.c2
-rw-r--r--storage/maria/ma_init.c2
-rw-r--r--storage/maria/ma_loghandler.c23
-rw-r--r--storage/maria/ma_open.c6
-rw-r--r--storage/maria/ma_page.c2
-rw-r--r--storage/maria/ma_sort.c36
-rw-r--r--storage/maria/unittest/ma_maria_log_cleanup.c2
-rw-r--r--storage/mroonga/CMakeLists.txt16
-rw-r--r--storage/mroonga/ha_mroonga.cpp6
-rw-r--r--storage/mroonga/lib/mrn_smart_bitmap.cpp2
-rw-r--r--storage/myisam/ft_update.c3
-rw-r--r--storage/myisam/sort.c37
-rw-r--r--storage/myisammrg/ha_myisammrg.cc2
-rw-r--r--storage/oqgraph/cmake/FindJudy.cmake18
-rw-r--r--storage/rocksdb/CMakeLists.txt8
-rw-r--r--storage/rocksdb/build_rocksdb.cmake38
-rw-r--r--storage/rocksdb/ha_rocksdb.cc35
-rw-r--r--storage/rocksdb/ha_rocksdb.h4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result41
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test28
-rw-r--r--storage/rocksdb/rdb_datadic.cc26
-rw-r--r--storage/rocksdb/rdb_i_s.cc41
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider_fixes.result21
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/handler/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/handler/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes.result26
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes.test12
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/include/init_spider.inc8
-rw-r--r--storage/spider/mysql-test/spider/r/error_row_number.result45
-rw-r--r--storage/spider/mysql-test/spider/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes.result21
-rw-r--r--storage/spider/mysql-test/spider/r/variable_deprecation.result267
-rw-r--r--storage/spider/mysql-test/spider/t/error_row_number.test37
-rw-r--r--storage/spider/mysql-test/spider/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/t/variable_deprecation.test161
-rw-r--r--storage/spider/spd_db_mysql.cc7
-rw-r--r--storage/spider/spd_init_query.h11
-rw-r--r--storage/spider/spd_param.cc310
-rw-r--r--storage/spider/spd_table.cc93
-rw-r--r--strings/CMakeLists.txt2
-rw-r--r--strings/ctype-ascii.h189
-rw-r--r--strings/ctype-big5.c2
-rw-r--r--strings/ctype-cp932.c4
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-eucjpms.c4
-rw-r--r--strings/ctype-gb2312.c2
-rw-r--r--strings/ctype-gbk.c2
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-ujis.c4
-rw-r--r--strings/ctype-utf8.c297
-rw-r--r--strings/json_lib.c4
-rw-r--r--strings/json_normalize.c852
-rw-r--r--strings/strcoll.inl96
-rw-r--r--support-files/rpm/server.cnf4
-rw-r--r--tests/mysql_client_test.c90
-rw-r--r--tpool/CMakeLists.txt6
-rw-r--r--unittest/json_lib/CMakeLists.txt2
-rw-r--r--unittest/json_lib/json_normalize-t.c280
-rw-r--r--unittest/mysys/bitmap-t.c10
958 files changed, 44245 insertions, 7658 deletions
diff --git a/.gitignore b/.gitignore
index 5376c582985..02de7b865dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,6 +106,7 @@ packaging/rpm-oel/mysql.spec
packaging/rpm-uln/mysql.10.0.11.spec
packaging/solaris/postinstall-solaris
extra/pcre2
+extra/libfmt
plugin/auth_pam/auth_pam_tool
plugin/auth_pam/config_auth_pam.h
plugin/aws_key_management/aws-sdk-cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9500249799d..77034d38118 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -160,6 +160,7 @@ INCLUDE(readline)
INCLUDE(libutils)
INCLUDE(dtrace)
INCLUDE(pcre)
+INCLUDE(libfmt)
INCLUDE(ctest)
INCLUDE(plugin)
INCLUDE(install_macros)
@@ -378,7 +379,8 @@ ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(_FILE_OFFSET_BITS)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
ENDIF()
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include
+ ${CMAKE_SOURCE_DIR}/include/providers)
# Add bundled or system zlib.
MYSQL_CHECK_ZLIB_WITH_COMPRESS()
@@ -390,6 +392,7 @@ MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system")
CHECK_PCRE()
+CHECK_LIBFMT()
ADD_SUBDIRECTORY(tpool)
CHECK_SYSTEMD()
diff --git a/VERSION b/VERSION
index 0acffd643c8..d3418c3d869 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
-MYSQL_VERSION_MINOR=6
-MYSQL_VERSION_PATCH=12
+MYSQL_VERSION_MINOR=7
+MYSQL_VERSION_PATCH=8
SERVER_MATURITY=stable
diff --git a/client/client_priv.h b/client/client_priv.h
index 56e81ebb94f..cde3a4c51e2 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -106,6 +106,7 @@ enum options_client
OPT_SHUTDOWN_WAIT_FOR_SLAVES,
OPT_COPY_S3_TABLES,
OPT_PRINT_TABLE_METADATA,
+ OPT_ASOF_TIMESTAMP,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index f566d8b9e4f..d026c347c82 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -72,7 +72,7 @@ static char **defaults_argv;
static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
-char upgrade_from_version[sizeof("10.20.456-MariaDB")+30];
+char upgrade_from_version[1024];
static my_bool opt_write_binlog;
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ba7579a06ca..78de59087b9 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -954,7 +954,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Log_event *e= NULL;
// Print the row_event from the last one to the first one
- for (uint i= events_in_stmt.elements; i > 0; --i)
+ for (size_t i= events_in_stmt.elements; i > 0; --i)
{
e= *(dynamic_element(&events_in_stmt, i - 1, Log_event**));
result= result || print_base64(print_event_info, e);
@@ -962,7 +962,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
// Copy all output into the Log_event
ev->output_buf.copy(e->output_buf);
// Delete Log_event
- for (uint i= 0; i < events_in_stmt.elements-1; ++i)
+ for (size_t i= 0; i < events_in_stmt.elements-1; ++i)
{
e= *(dynamic_element(&events_in_stmt, i, Log_event**));
delete e;
@@ -3171,7 +3171,7 @@ int main(int argc, char** argv)
*/
if (opt_flashback && retval != ERROR_STOP)
{
- for (uint i= binlog_events.elements; i > 0; --i)
+ for (size_t i= binlog_events.elements; i > 0; --i)
{
LEX_STRING *event_str= dynamic_element(&binlog_events, i - 1,
LEX_STRING*);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 7a77245f520..1e71ef7dc63 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -129,7 +129,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
opt_include_master_host_port= 0,
opt_events= 0, opt_comments_used= 0,
opt_alltspcs=0, opt_notspcs= 0, opt_logging,
- opt_drop_trigger= 0 ;
+ opt_drop_trigger= 0;
#define OPT_SYSTEM_ALL 1
#define OPT_SYSTEM_USERS 2
#define OPT_SYSTEM_PLUGINS 4
@@ -156,7 +156,7 @@ static char *opt_password=0,*current_user=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *order_by=0,
*err_ptr= 0,
- *log_error_file= NULL;
+ *log_error_file= NULL, *opt_asof_timestamp= NULL;
static const char *opt_compatible_mode_str= 0;
static char **defaults_argv= 0;
static char compatible_mode_normal_str[255];
@@ -280,6 +280,11 @@ static struct my_option my_long_options[] =
"Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.",
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
+ {"as-of", OPT_ASOF_TIMESTAMP,
+ "Dump system versioned table(s) as of specified timestamp. "
+ "Argument is interpreted according to the --tz-utc setting. "
+ "Table structures are always dumped as of current timestamp.",
+ &opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", (char **)&charsets_dir,
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -580,7 +585,8 @@ static struct my_option my_long_options[] =
&opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
- "SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
+ "Set connection time zone to UTC before commencing the dump and add "
+ "SET TIME_ZONE=´+00:00´ to the top of the dump file.",
&opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.",
@@ -1331,6 +1337,12 @@ static int get_options(int *argc, char ***argv)
my_progname_short);
return(EX_USAGE);
}
+ if (opt_asof_timestamp && strchr(opt_asof_timestamp, '\''))
+ {
+ fprintf(stderr, "%s: Incorrect DATETIME value: '%s'\n",
+ my_progname_short, opt_asof_timestamp);
+ return(EX_USAGE);
+ }
if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) &&
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY,
@@ -3045,7 +3057,7 @@ static void get_sequence_structure(const char *seq, const char *db)
*/
static uint get_table_structure(const char *table, const char *db, char *table_type,
- char *ignore_flag)
+ char *ignore_flag, my_bool *versioned)
{
my_bool init=0, delayed, write_data, complete_insert;
my_ulonglong num_fields;
@@ -3112,6 +3124,26 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
verbose_msg("-- Retrieving table structure for table %s...\n", table);
+ if (versioned)
+ {
+ if (!opt_asof_timestamp)
+ versioned= NULL;
+ else
+ {
+ my_snprintf(query_buff, sizeof(query_buff), "select 1 from"
+ " information_schema.tables where table_schema=database()"
+ " and table_name=%s and table_type='SYSTEM VERSIONED'",
+ quote_for_equal(table, table_buff));
+ if (!mysql_query_with_error_report(mysql, &result, query_buff))
+ {
+ *versioned= result->row_count > 0;
+ mysql_free_result(result);
+ }
+ else
+ *versioned= 0;
+ }
+ }
+
len= my_snprintf(query_buff, sizeof(query_buff),
"SET SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
@@ -3367,9 +3399,10 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
}
else
{
- dynstr_append_checked(&insert_pat, " VALUES ");
- if (!extended_insert)
- dynstr_append_checked(&insert_pat, "(");
+ if (extended_insert)
+ dynstr_append_checked(&insert_pat, " VALUES\n");
+ else
+ dynstr_append_checked(&insert_pat, " VALUES (");
}
}
@@ -3975,6 +4008,15 @@ static char *alloc_query_str(size_t size)
}
+static void vers_append_system_time(DYNAMIC_STRING* query_string)
+{
+ DBUG_ASSERT(opt_asof_timestamp);
+ dynstr_append_checked(query_string, " FOR SYSTEM_TIME AS OF TIMESTAMP '");
+ dynstr_append_checked(query_string, opt_asof_timestamp);
+ dynstr_append_checked(query_string, "'");
+}
+
+
/*
SYNOPSIS
@@ -4002,6 +4044,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
ulong rownr, row_break;
uint num_fields;
size_t total_length, init_length;
+ my_bool versioned= 0;
MYSQL_RES *res;
MYSQL_FIELD *field;
@@ -4012,7 +4055,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
Make sure you get the create table info before the following check for
--no-data flag below. Otherwise, the create table info won't be printed.
*/
- num_fields= get_table_structure(table, db, table_type, &ignore_flag);
+ num_fields= get_table_structure(table, db, table_type, &ignore_flag, &versioned);
/*
The "table" could be a view. If so, we don't do anything here.
@@ -4119,6 +4162,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
dynstr_append_checked(&query_string, " FROM ");
dynstr_append_checked(&query_string, result_table);
+ if (versioned)
+ vers_append_system_time(&query_string);
if (where)
{
@@ -4151,6 +4196,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
dynstr_append_checked(&query_string, select_field_names.str);
dynstr_append_checked(&query_string, " FROM ");
dynstr_append_checked(&query_string, result_table);
+ if (versioned)
+ vers_append_system_time(&query_string);
if (where)
{
@@ -4428,7 +4475,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
if (total_length + row_length < opt_net_buffer_length)
{
total_length+= row_length;
- fputc(',',md_result_file); /* Always row break */
+ fputs(",\n",md_result_file); /* Always row break */
fputs(extended_row.str,md_result_file);
}
else
@@ -5396,11 +5443,11 @@ static void dump_first_mysql_tables(char *database)
DBUG_ENTER("dump_first_mysql_tables");
if (!get_table_structure((char *) "general_log",
- database, table_type, &ignore_flag) )
+ database, table_type, &ignore_flag, NULL) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'general_log' table\n");
if (!get_table_structure((char *) "slow_log",
- database, table_type, &ignore_flag) )
+ database, table_type, &ignore_flag, NULL) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'slow_log' table\n");
/* general and slow query logs exist now */
@@ -5660,7 +5707,7 @@ static int dump_all_tables_in_db(char *database)
char table_type[NAME_LEN];
char ignore_flag;
if (!get_table_structure((char *) "transaction_registry",
- database, table_type, &ignore_flag) )
+ database, table_type, &ignore_flag, NULL) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'transaction_registry' table\n");
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index ff9992de3b1..bd9f55e715b 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -3689,8 +3689,7 @@ void do_remove_file(struct st_command *command)
void do_remove_files_wildcard(struct st_command *command)
{
int error= 0, sys_errno= 0;
- uint i;
- size_t directory_length;
+ size_t i, directory_length;
MY_DIR *dir_info;
FILEINFO *file;
char dir_separator[2];
@@ -3729,7 +3728,7 @@ void do_remove_files_wildcard(struct st_command *command)
/* Set default wild chars for wild_compare, is changed in embedded mode */
set_wild_chars(1);
- for (i= 0; i < (uint) dir_info->number_of_files; i++)
+ for (i= 0; i < dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
/* Remove only regular files, i.e. no directories etc. */
@@ -4003,7 +4002,7 @@ void do_rmdir(struct st_command *command)
static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
const DYNAMIC_STRING *ds_wild)
{
- uint i;
+ size_t i;
MY_DIR *dir_info;
FILEINFO *file;
DBUG_ENTER("get_list_files");
@@ -4012,7 +4011,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
if (!(dir_info= my_dir(ds_dirname->str, MYF(MY_WANT_SORT))))
DBUG_RETURN(1);
set_wild_chars(1);
- for (i= 0; i < (uint) dir_info->number_of_files; i++)
+ for (i= 0; i < dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
if (ds_wild && ds_wild->length &&
diff --git a/cmake/FindLIBAIO.cmake b/cmake/FindLIBAIO.cmake
index db49439f318..3a4205f7a45 100644
--- a/cmake/FindLIBAIO.cmake
+++ b/cmake/FindLIBAIO.cmake
@@ -1,7 +1,7 @@
-find_path(LIBAIO_INCLUDE_DIR NAMES libaio.h)
+find_path(LIBAIO_INCLUDE_DIRS NAMES libaio.h)
find_library(LIBAIO_LIBRARIES NAMES aio)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LIBAIO DEFAULT_MSG
- LIBAIO_LIBRARIES LIBAIO_INCLUDE_DIR)
+ LIBAIO_LIBRARIES LIBAIO_INCLUDE_DIRS)
diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake
index 46c1fdc1b9f..eebd85969e3 100644
--- a/cmake/FindLZ4.cmake
+++ b/cmake/FindLZ4.cmake
@@ -1,9 +1,17 @@
-find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
+find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
find_library(LZ4_LIBRARIES NAMES lz4)
+if(LZ4_INCLUDE_DIRS AND EXISTS "${LZ4_INCLUDE_DIRS}/lz4.h")
+ file(STRINGS "${LZ4_INCLUDE_DIRS}/lz4.h" LZ4_H REGEX "^#define LZ4_VERSION_[MR]")
+ string(REGEX REPLACE "LZ4_VERSION" "" LZ4_H "${LZ4_H}")
+ string(REGEX MATCHALL "[0-9]+" LZ4_H "${LZ4_H}")
+ string(REGEX REPLACE ";" "." LZ4_VERSION_STRING "${LZ4_H}")
+endif()
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
- LZ4 DEFAULT_MSG
- LZ4_LIBRARIES LZ4_INCLUDE_DIR)
+ LZ4
+ REQUIRED_VARS LZ4_LIBRARIES LZ4_INCLUDE_DIRS
+ VERSION_VAR LZ4_VERSION_STRING)
-mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARIES)
+mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES)
diff --git a/cmake/FindLZO.cmake b/cmake/FindLZO.cmake
new file mode 100644
index 00000000000..04391bb4720
--- /dev/null
+++ b/cmake/FindLZO.cmake
@@ -0,0 +1,9 @@
+find_path(LZO_INCLUDE_DIRS NAMES lzo/lzo1x.h)
+find_library(LZO_LIBRARIES NAMES lzo2)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ LZO DEFAULT_MSG
+ LZO_LIBRARIES LZO_INCLUDE_DIRS)
+
+mark_as_advanced(LZO_INCLUDE_DIRS LZO_LIBRARIES)
diff --git a/cmake/FindPMEM.cmake b/cmake/FindPMEM.cmake
index 73e71bc29f4..024436444d2 100644
--- a/cmake/FindPMEM.cmake
+++ b/cmake/FindPMEM.cmake
@@ -7,12 +7,12 @@ if(DEFINED PMEM_LIBRARIES)
return()
endif()
-find_path(PMEM_INCLUDE_DIR NAMES libpmem.h)
+find_path(PMEM_INCLUDE_DIRS NAMES libpmem.h)
find_library(PMEM_LIBRARIES NAMES pmem)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
PMEM DEFAULT_MSG
- PMEM_LIBRARIES PMEM_INCLUDE_DIR)
+ PMEM_LIBRARIES PMEM_INCLUDE_DIRS)
-mark_as_advanced(PMEM_INCLUDE_DIR PMEM_LIBRARIES)
+mark_as_advanced(PMEM_INCLUDE_DIRS PMEM_LIBRARIES)
diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake
new file mode 100644
index 00000000000..1e99eb65a50
--- /dev/null
+++ b/cmake/FindSnappy.cmake
@@ -0,0 +1,9 @@
+find_path(SNAPPY_INCLUDE_DIRS NAMES snappy.h)
+find_library(SNAPPY_LIBRARIES NAMES snappy)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ Snappy DEFAULT_MSG
+ SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIRS)
+
+mark_as_advanced(SNAPPY_INCLUDE_DIRS SNAPPY_LIBRARIES)
diff --git a/cmake/FindURING.cmake b/cmake/FindURING.cmake
index 6e5e0783b46..b8141c9d480 100644
--- a/cmake/FindURING.cmake
+++ b/cmake/FindURING.cmake
@@ -1,9 +1,9 @@
-find_path(URING_INCLUDE_DIR NAMES liburing.h)
+find_path(URING_INCLUDE_DIRS NAMES liburing.h)
find_library(URING_LIBRARIES NAMES uring)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
URING DEFAULT_MSG
- URING_LIBRARIES URING_INCLUDE_DIR)
+ URING_LIBRARIES URING_INCLUDE_DIRS)
-mark_as_advanced(URING_INCLUDE_DIR URING_LIBRARIES)
+mark_as_advanced(URING_INCLUDE_DIRS URING_LIBRARIES)
diff --git a/cmake/FindZSTD.cmake b/cmake/FindZSTD.cmake
index ede59010742..d03e96fca15 100644
--- a/cmake/FindZSTD.cmake
+++ b/cmake/FindZSTD.cmake
@@ -1,11 +1,11 @@
# - Find zstd
# Find the zstd compression library and includes
#
-# ZSTD_INCLUDE_DIR - where to find zstd.h, etc.
+# ZSTD_INCLUDE_DIRS - where to find zstd.h, etc.
# ZSTD_LIBRARIES - List of libraries when using zstd.
# ZSTD_FOUND - True if zstd found.
-find_path(ZSTD_INCLUDE_DIR
+find_path(ZSTD_INCLUDE_DIRS
NAMES zstd.h
HINTS ${ZSTD_ROOT_DIR}/include)
@@ -14,8 +14,8 @@ find_library(ZSTD_LIBRARIES
HINTS ${ZSTD_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
+find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS)
mark_as_advanced(
ZSTD_LIBRARIES
- ZSTD_INCLUDE_DIR)
+ ZSTD_INCLUDE_DIRS)
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 3f1e4aca2cb..961db1b13b0 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -108,14 +108,10 @@ ELSEIF(RPM)
SET(WITH_PCRE system CACHE STRING "")
SET(CLIENT_PLUGIN_ZSTD OFF)
IF(RPM MATCHES "fedora|centos|rhel|rocky|alma")
- SET(WITH_INNODB_BZIP2 OFF CACHE STRING "")
- SET(WITH_INNODB_LZO OFF CACHE STRING "")
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
ENDIF()
IF(RPM MATCHES "opensuse|sles|centos|rhel|rocky|alma")
- SET(WITH_INNODB_LZ4 OFF CACHE STRING "")
SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "")
- SET(GRN_WITH_LZ4 no CACHE STRING "")
ENDIF()
ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
@@ -126,9 +122,6 @@ ELSEIF(DEB)
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
SET(WITH_PCRE system CACHE STRING "")
SET(CLIENT_PLUGIN_ZSTD OFF)
- SET(WITH_INNODB_BZIP2 OFF CACHE STRING "")
- SET(WITH_INNODB_LZMA OFF CACHE STRING "")
- SET(WITH_INNODB_LZO OFF CACHE STRING "")
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
@@ -137,12 +130,8 @@ ELSE()
SET(WITH_JEMALLOC static CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
SET(WITH_STRIPPED_CLIENT ON CACHE BOOL "Strip all client binaries")
- SET(WITH_INNODB_BZIP2 OFF CACHE STRING "")
- SET(WITH_INNODB_LZ4 OFF CACHE STRING "")
- SET(WITH_INNODB_LZO OFF CACHE STRING "")
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "")
- SET(GRN_WITH_LZ4 no CACHE STRING "")
ENDIF()
IF(NOT COMPILATION_COMMENT)
diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake
new file mode 100644
index 00000000000..7eaa0dfa012
--- /dev/null
+++ b/cmake/libfmt.cmake
@@ -0,0 +1,53 @@
+INCLUDE (CheckCXXSourceCompiles)
+INCLUDE (ExternalProject)
+
+SET(WITH_LIBFMT "auto" CACHE STRING
+ "Which libfmt to use (possible values are 'bundled', 'system', or 'auto')")
+
+MACRO(BUNDLE_LIBFMT)
+ SET(dir "${CMAKE_BINARY_DIR}/extra/libfmt")
+ SET(LIBFMT_INCLUDE_DIR "${dir}/src/libfmt/include")
+
+ IF(CMAKE_VERSION VERSION_GREATER "3.0")
+ SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h)
+ ENDIF()
+
+ ExternalProject_Add(
+ libfmt
+ PREFIX "${dir}"
+ URL "https://github.com/fmtlib/fmt/archive/refs/tags/8.0.1.zip"
+ URL_MD5 e77873199e897ca9f780479ad68e25b1
+ INSTALL_COMMAND ""
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ ${fmt_byproducts}
+ )
+ENDMACRO()
+
+MACRO (CHECK_LIBFMT)
+ IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto")
+ SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES(
+ "#define FMT_STATIC_THOUSANDS_SEPARATOR ','
+ #define FMT_HEADER_ONLY 1
+ #include <fmt/format-inl.h>
+ #include <iostream>
+ int main() {
+ fmt::format_args::format_arg arg=
+ fmt::detail::make_arg<fmt::format_context>(42);
+ std::cout << fmt::vformat(\"The answer is {}.\",
+ fmt::format_args(&arg, 1));
+ }" HAVE_SYSTEM_LIBFMT)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ ENDIF()
+ IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled")
+ IF (WITH_LIBFMT STREQUAL "system")
+ MESSAGE(FATAL_ERROR "system libfmt library is not found or unusable")
+ ENDIF()
+ BUNDLE_LIBFMT()
+ ELSE()
+ FIND_FILE(Libfmt_core_h fmt/core.h) # for build_depends.cmake
+ ENDIF()
+ENDMACRO()
+
+MARK_AS_ADVANCED(LIBFMT_INCLUDE_DIR)
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 179308a76f6..dfc725c36b9 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -48,6 +48,7 @@ SET(MY_ERROR_FLAGS -Werror)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
+ SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=non-virtual-dtor) # gcc bug 7302
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF|WARN")
diff --git a/config.h.cmake b/config.h.cmake
index df240380471..e8712d16ba6 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -183,6 +183,7 @@
#cmakedefine HAVE_MLOCKALL 1
#cmakedefine HAVE_MMAP 1
#cmakedefine HAVE_MMAP64 1
+#cmakedefine HAVE_MPROTECT 1
#cmakedefine HAVE_PERROR 1
#cmakedefine HAVE_POLL 1
#cmakedefine HAVE_POSIX_FALLOCATE 1
diff --git a/configure.cmake b/configure.cmake
index faff9f40115..b13d527742b 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -377,6 +377,7 @@ CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK)
CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL)
CHECK_FUNCTION_EXISTS (mmap HAVE_MMAP)
CHECK_FUNCTION_EXISTS (mmap64 HAVE_MMAP64)
+CHECK_FUNCTION_EXISTS (mprotect HAVE_MPROTECT)
CHECK_FUNCTION_EXISTS (perror HAVE_PERROR)
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
CHECK_FUNCTION_EXISTS (posix_fallocate HAVE_POSIX_FALLOCATE)
diff --git a/dbug/tests-t.pl b/dbug/tests-t.pl
index 4803627eda2..22526a7bc61 100755
--- a/dbug/tests-t.pl
+++ b/dbug/tests-t.pl
@@ -44,12 +44,10 @@ __DATA__
% ./tests -#d
func2: info: s=ok
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d
func2: info: s=ok
% ./tests d,ret3
-=> evaluate: OFF
=> evaluate_if: OFF
#
## Testing negative lists
@@ -57,7 +55,6 @@ func2: info: s=ok
% ./tests d:-d,ret3
func2: info: s=ko
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,ret3
func2: info: s=ko
@@ -69,7 +66,6 @@ func2: info: s=ko
| | | <func3
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -85,7 +81,6 @@ func2: info: s=ko
| | | info: s=ko
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -99,19 +94,15 @@ func2: info: s=ko
| | | >func3
| | | <func3
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate
-=> evaluate: ON
=> evaluate_if: OFF
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate_if
-=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2 d,evaluate_if
-=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2
>main
@@ -120,7 +111,6 @@ func2: info: s=ko
| | | <func3
| <func1
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
@@ -135,7 +125,6 @@ func2: info: s=ko
| | | >func3
| | | <func3
| <func1
-=> evaluate: OFF
=> evaluate_if: ON
| | >func3
| | <func3
@@ -152,7 +141,6 @@ func2: info: s=ko
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
-=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
@@ -166,7 +154,6 @@ func2: info: s=ko
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
-=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
@@ -180,7 +167,6 @@ func2: info: s=ko
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
-=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
@@ -194,7 +180,6 @@ func2: info: s=ko
| dump: Memory: 0x#### Bytes: (35)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 74
-=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:t
| | >func3
@@ -209,7 +194,6 @@ dbug-tests: | <func1
dbug-tests: | dump: Memory: 0x#### Bytes: (37)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 50 3A 74
-=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:P:t
dbug-tests: | | >func3
@@ -224,7 +208,6 @@ dbug-tests: tests.c: | <func1
dbug-tests: tests.c: | dump: Memory: 0x#### Bytes: (39)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 46 3A 50 3A 74
-=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: tests.c: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:F:P:t
dbug-tests: tests.c: | | >func3
@@ -240,7 +223,6 @@ dbug-tests: tests.c: <main
| | | <func3
| <func1
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
@@ -256,7 +238,6 @@ dbug-tests: tests.c: <main
| | <func2
| <func1
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:t
| >func2
@@ -267,7 +248,6 @@ dbug-tests: tests.c: <main
<main
% ./tests d,info:-d,ret3:d,push
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -277,7 +257,6 @@ func2: info: s=ko
<main
% ./tests d,info:-d,ret3:d,push,explain
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,info,push,explain:-d,ret3:t
| >func2
@@ -288,13 +267,11 @@ func2: info: s=ko
<main
% ./tests d,info:-d,ret3:d,explain
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,pop
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
% ./tests d,info:-d,ret3:d,explain t:d,pop
>main
@@ -304,7 +281,6 @@ func2: info: s=ko
| | | <func3
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
@@ -317,13 +293,11 @@ func2: info: s=ko
| | | info: s=ko
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain,pop:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,set
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
tests.c: main: explain: dbug explained: d,info,explain,set:-d,ret3:F
tests.c: func2: info: s=ko
@@ -336,7 +310,6 @@ func2: info: s=ko
| | | info: s=ko
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
@@ -354,7 +327,6 @@ func2: info: s=ko
| | | info: s=ko
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
@@ -365,7 +337,6 @@ func2: info: s=ko
tests.c: <main
% ./tests t d,info:-d,ret3:d,explain,set,pop
func2: info: s=ko
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -375,7 +346,6 @@ func2: info: s=ko
% ./tests t:f,func2
| | >func2
| | <func2
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| <func2
@@ -387,7 +357,6 @@ func2: info: s=ko
| >func1
| <func1
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:f:-f,func2/:t
<main
@@ -399,7 +368,6 @@ func2: info: s=ko
| | | info: s=ok
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
% ./tests t:f,main/:d,pop
>main
@@ -409,10 +377,8 @@ func2: info: s=ko
| | | <func3
| | <func2
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
% ./tests f,main/:d,push
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -431,7 +397,6 @@ func2: info: s=ko
| | | <func3
| | <func2
=> push1
-=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
@@ -440,7 +405,6 @@ func2: info: s=ko
>main
=> push1
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -453,7 +417,6 @@ func2: info: s=ko
| | | <func3
=> push1
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -469,7 +432,6 @@ func2: info: s=ko
| | | <func3
| | <func2
=> push1
-=> evaluate: OFF
=> evaluate_if: OFF
# change the defaults
% ./tests t:f,func3 --push1=t
@@ -477,7 +439,6 @@ func2: info: s=ko
| | | <func3
=> push1
| <func1
-=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
@@ -487,11 +448,9 @@ func2: info: s=ko
# repeated keyword
% ./tests d:-d,info,info
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info
% ./tests d:-d,info/,info
=> execute
-=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info/
diff --git a/dbug/tests.c b/dbug/tests.c
index 3e77bf82236..4e3642f09e4 100644
--- a/dbug/tests.c
+++ b/dbug/tests.c
@@ -16,7 +16,8 @@ char *push1=0;
const char *func3()
{
DBUG_ENTER("func3");
- DBUG_RETURN(DBUG_EVALUATE("ret3", "ok", "ko"));
+ DBUG_EXECUTE("ret3", DBUG_RETURN("ok"););
+ DBUG_RETURN("ko");
}
void func2()
@@ -72,10 +73,8 @@ int main (int argc __attribute__((unused)),
DBUG_EXECUTE_IF("push", DBUG_PUSH("+t"); );
DBUG_EXECUTE("execute", fprintf(DBUG_FILE, "=> execute\n"); );
DBUG_EXECUTE_IF("set", DBUG_SET("+F"); );
- fprintf(DBUG_FILE, "=> evaluate: %s\n",
- DBUG_EVALUATE("evaluate", "ON", "OFF"));
fprintf(DBUG_FILE, "=> evaluate_if: %s\n",
- DBUG_EVALUATE_IF("evaluate_if", "ON", "OFF"));
+ (DBUG_IF("evaluate_if") ? "ON": "OFF"));
DBUG_EXECUTE_IF("pop", DBUG_POP(); );
{
char s[1000] __attribute__((unused));
diff --git a/dbug/user.r b/dbug/user.r
index 9a48ba3bcb2..bd0cfe381b1 100644
--- a/dbug/user.r
+++ b/dbug/user.r
@@ -771,32 +771,20 @@ artificial delay checking for race conditions.
.SP 1
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ DBUG_ABORT()\ ());\fR
.SP 1
-.LI DBUG_EVALUATE\
-The DBUG_EVALUATE macro is similar to DBUG_EXECUTE, but it can be used in
-the expression context. The first argument is the debug keyword that is used to
-choose whether the second (keyword is enabled) or the third (keyword is not
-enabled) argument is evaluated. When
-.I dbug
-is compiled off, the third argument is evaluated.
-.SP 1
-EX:\fC
-.br
- printf("Info-debug is %s",
-.br
- DBUG_EVALUATE\ ("info", "ON", "OFF"));\fR
-.SP 1
-.LI DBUG_EVALUATE_IF\
-Works like DBUG_EVALUATE macro, but the second argument is
-.B not
-evaluated, if the keyword is not explicitly listed in
-the 'd' flag. Like DBUG_EXECUTE_IF this could be used to conditionally execute
+.LI DBUG_IF\
+Returns
+.B 1
+if the keyword is explicitly listed in
+the 'd' flag. Otherwise returns
+.B 0
+Like DBUG_EXECUTE_IF this could be used to conditionally execute
"dangerous" actions.
.SP 1
EX:\fC
.br
if (prepare_transaction () ||
.br
- DBUG_EVALUATE ("crashme", (DBUG_ABORT(), 0), 0) ||
+ (DBUG_IF("crashme") && (DBUG_ABORT(), 0)) ||
.br
commit_transaction () )\fR
.SP 1
diff --git a/debian/additions/mariadb.conf.d/50-server.cnf b/debian/additions/mariadb.conf.d/50-server.cnf
index c5a26bd42b2..728ca23178b 100644
--- a/debian/additions/mariadb.conf.d/50-server.cnf
+++ b/debian/additions/mariadb.conf.d/50-server.cnf
@@ -108,7 +108,7 @@ collation-server = utf8mb4_general_ci
# you can put MariaDB-only options here
[mariadb]
-# This group is only read by MariaDB-10.6 servers.
+# This group is only read by MariaDB-10.7 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.6]
+[mariadb-10.7]
diff --git a/debian/additions/source_mariadb-10.6.py b/debian/additions/source_mariadb-10.7.py
index 43b1f35373e..d126a9a28d3 100644
--- a/debian/additions/source_mariadb-10.6.py
+++ b/debian/additions/source_mariadb-10.7.py
@@ -1,4 +1,4 @@
-'''apport package hook for mariadb-10.6
+'''apport package hook for mariadb-10.7
(c) 2009 Canonical Ltd.
Author: Mathias Gug <mathias.gug@canonical.com>
@@ -21,7 +21,7 @@ def _add_my_conf_files(report, filename):
continue
def add_info(report):
- attach_conffiles(report, 'mariadb-server-10.6', conffiles=None)
+ attach_conffiles(report, 'mariadb-server-10.7', 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/autobake-deb.sh b/debian/autobake-deb.sh
index 1cc215f1c82..09b06084647 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -17,6 +17,7 @@ set -e
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
source ./VERSION
+
# General CI optimizations to keep build output smaller
if [[ $GITLAB_CI ]]
then
@@ -34,7 +35,7 @@ then
then
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
echo >> debian/control
- cat storage/columnstore/columnstore/debian/control >> debian/control
+ sed "s/10.6/${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}/" <storage/columnstore/columnstore/debian/control >> debian/control
fi
fi
@@ -67,6 +68,12 @@ disable_pmem()
sed '/-DWITH_PMEM=YES/d' -i debian/rules
}
+disable_libfmt()
+{
+ # 0.7+ required
+ sed '/libfmt-dev/d' -i debian/control
+}
+
architecture=$(dpkg-architecture -q DEB_BUILD_ARCH)
# Parse release name and number from Linux standard base release
@@ -105,6 +112,7 @@ in
disable_pmem
;&
buster)
+ disable_libfmt
replace_uring_with_aio
if [ ! "$architecture" = amd64 ]
then
@@ -134,6 +142,7 @@ in
;&
focal)
replace_uring_with_aio
+ disable_libfmt
;&
impish|jammy|kinetic)
# mariadb-plugin-rocksdb s390x not supported by us (yet)
diff --git a/debian/changelog b/debian/changelog
index 08065467bdc..59109117207 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,5 @@
-mariadb-10.6 (1:10.6.0) unstable; urgency=medium
+mariadb-10.7 (1:10.7.0) unstable; urgency=medium
* Initial Release
- -- Otto Kekäläinen <otto@debian.org> Thu, 14 May 2020 18:00:57 +0300
+ -- Vicențiu Ciorbaru <vicentiu@mariadb.org> Thu, 18 Jun 2021 16:08:00 +0300
diff --git a/debian/control b/debian/control
index 7f0d88e991c..61000bd2432 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: mariadb-10.6
+Source: mariadb-10.7
Section: database
Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
@@ -18,14 +18,18 @@ Build-Depends: bison,
libboost-regex-dev [amd64],
libboost-system-dev [amd64],
libboost-thread-dev [amd64],
+ libbz2-dev,
libcrack2-dev (>= 2.9.0),
libcurl4-openssl-dev | libcurl4-dev,
libedit-dev,
libedit-dev:native,
+ libfmt-dev (>= 7.0.0),
libjemalloc-dev [linux-any],
libjudy-dev,
libkrb5-dev,
liblz4-dev,
+ liblzma-dev,
+ liblzo2-dev,
libncurses5-dev (>= 5.0-6~),
libncurses5-dev:native (>= 5.0-6~),
libnuma-dev [linux-any],
@@ -38,7 +42,7 @@ Build-Depends: bison,
libsystemd-dev [linux-any],
liburing-dev [linux-any],
libxml2-dev,
- libzstd-dev,
+ libzstd-dev (>= 1.1.3),
lsb-release,
perl:any,
po-debconf,
@@ -259,7 +263,7 @@ Description: MariaDB common configuration files
.
This package includes configuration files common to all MariaDB programs.
-Package: mariadb-client-core-10.6
+Package: mariadb-client-core-10.7
Architecture: any
Depends: libmariadb3 (>= 10.5.4),
mariadb-common (>= ${source:Version}),
@@ -271,7 +275,8 @@ Conflicts: mariadb-client-10.0,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -282,6 +287,7 @@ Conflicts: mariadb-client-10.0,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5,
+ mariadb-client-core-10.6,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
@@ -304,7 +310,8 @@ Breaks: mariadb-server-10.0,
mariadb-server-core-10.3,
mariadb-server-core-10.4,
mariadb-server-core-10.5,
- mariadb-server-core-10.6 (<< ${source:Version}),
+ mariadb-server-core-10.6,
+ mariadb-server-core-10.7 (<< ${source:Version}),
mysql-server-core-5.5,
mysql-server-core-5.6,
mysql-server-core-5.7,
@@ -318,7 +325,8 @@ Replaces: mariadb-client-10.0,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -329,6 +337,7 @@ Replaces: mariadb-client-10.0,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5,
+ mariadb-client-core-10.6,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
@@ -341,7 +350,8 @@ Replaces: mariadb-client-10.0,
mariadb-server-core-10.3,
mariadb-server-core-10.4,
mariadb-server-core-10.5,
- mariadb-server-core-10.6 (<< ${source:Version}),
+ mariadb-server-core-10.6,
+ mariadb-server-core-10.7 (<< ${source:Version}),
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
@@ -369,10 +379,11 @@ Description: MariaDB database core client binaries
.
This package includes the core client files, as used by Akonadi.
-Package: mariadb-client-10.6
+Package: mariadb-client-10.7
Architecture: any
Depends: debianutils (>=1.6),
- mariadb-client-core-10.6 (>= ${source:Version}),
+ libconfig-inifiles-perl,
+ mariadb-client-core-10.7 (>= ${source:Version}),
mariadb-common,
${misc:Depends},
${perl:Depends},
@@ -384,7 +395,8 @@ Conflicts: mariadb-client (<< ${source:Version}),
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -410,21 +422,24 @@ Breaks: mariadb-client-core-10.0,
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5,
- mariadb-client-core-10.6 (<< ${source:Version}),
+ mariadb-client-core-10.6,
+ mariadb-client-core-10.7 (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
- mariadb-server-10.6 (<< ${source:Version}),
+ mariadb-server-10.6,
+ mariadb-server-10.7 (<< ${source:Version}),
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-10.5,
- mariadb-server-core-10.6 (<< ${source:Version}),
+ mariadb-server-core-10.6,
+ mariadb-server-core-10.7 (<< ${source:Version}),
mysql-server-5.5,
mysql-server-5.6,
mysql-server-5.7,
@@ -443,6 +458,7 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
+ mariadb-client-10.6,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -453,21 +469,24 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-client-core-10.3,
mariadb-client-core-10.4,
mariadb-client-core-10.5,
- mariadb-client-core-10.6 (<< ${source:Version}),
+ mariadb-client-core-10.6,
+ mariadb-client-core-10.7 (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
- mariadb-server-10.6 (<< ${source:Version}),
+ mariadb-server-10.6,
+ mariadb-server-10.7 (<< ${source:Version}),
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-10.5,
- mariadb-server-core-10.6 (<< ${source:Version}),
+ mariadb-server-core-10.6,
+ mariadb-server-core-10.7 (<< ${source:Version}),
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
@@ -508,7 +527,7 @@ Description: MariaDB database client binaries
This package includes the client binaries and the additional tools
innotop and mariadb-report (mysqlreport).
-Package: mariadb-server-core-10.6
+Package: mariadb-server-core-10.7
Architecture: any
Depends: mariadb-common (>= ${source:Version}),
${misc:Depends},
@@ -519,6 +538,7 @@ Conflicts: mariadb-server-core-10.0,
mariadb-server-core-10.3,
mariadb-server-core-10.4,
mariadb-server-core-10.5,
+ mariadb-server-core-10.6,
mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
@@ -537,13 +557,15 @@ Breaks: mariadb-client-10.0,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
- mariadb-server-10.6 (<< ${source:Version}),
+ mariadb-server-10.6,
+ mariadb-server-10.7 (<< ${source:Version}),
mysql-client-5.5,
mysql-server-5.5,
mysql-server-5.6,
@@ -558,13 +580,15 @@ Replaces: mariadb-client-10.0,
mariadb-client-10.3,
mariadb-client-10.4,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
- mariadb-server-10.6 (<< ${source:Version}),
+ mariadb-server-10.6,
+ mariadb-server-10.7 (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -601,7 +625,7 @@ Description: MariaDB database core server files
.
This package includes the core server files, as used by Akonadi.
-Package: mariadb-server-10.6
+Package: mariadb-server-10.7
Architecture: any
Suggests: mailx,
mariadb-test,
@@ -616,8 +640,8 @@ Depends: galera-4 (>= 26.4),
libdbi-perl,
lsb-base (>= 3.0-10),
lsof [linux-any],
- mariadb-client-10.6 (>= ${source:Version}),
- mariadb-server-core-10.6 (>= ${source:Version}),
+ mariadb-client-10.7 (>= ${source:Version}),
+ mariadb-server-core-10.7 (>= ${source:Version}),
passwd,
perl (>= 5.6),
procps,
@@ -634,6 +658,7 @@ Conflicts: mariadb-server (<< ${source:Version}),
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
+ mariadb-server-10.6,
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -664,7 +689,8 @@ Replaces: handlersocket-mysql-5.5,
libmariadbclient-dev (<< 5.5.0),
libmariadbclient16,
mariadb-client-10.5,
- mariadb-client-10.6 (<< ${source:Version}),
+ mariadb-client-10.6,
+ mariadb-client-10.7 (<< ${source:Version}),
mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
@@ -672,6 +698,7 @@ Replaces: handlersocket-mysql-5.5,
mariadb-server-10.3,
mariadb-server-10.4,
mariadb-server-10.5,
+ mariadb-server-10.6,
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -705,11 +732,11 @@ Description: MariaDB database server binaries
Package: mariadb-server
Architecture: all
-Depends: mariadb-server-10.6 (>= ${source:Version}),
+Depends: mariadb-server-10.7 (>= ${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.6), as determined by the MariaDB
+ mariadb-server (currently mariadb-server-10.7), 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.
@@ -721,11 +748,11 @@ Description: MariaDB database server (metapackage depending on the latest versio
Package: mariadb-client
Architecture: all
-Depends: mariadb-client-10.6 (>= ${source:Version}),
+Depends: mariadb-client-10.7 (>= ${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.6), as determined by the MariaDB
+ mariadb-client (currently mariadb-client-10.7), 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.
@@ -737,7 +764,7 @@ Breaks: mariadb-backup-10.1,
Replaces: mariadb-backup-10.1,
mariadb-backup-10.2,
mariadb-client-10.1
-Depends: mariadb-client-core-10.6 (= ${binary:Version}),
+Depends: mariadb-client-core-10.7 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Backup tool for MariaDB server
@@ -750,7 +777,7 @@ Description: Backup tool for MariaDB server
Package: mariadb-plugin-connect
Architecture: any
Depends: libxml2,
- mariadb-server-10.6 (= ${server:Version}),
+ mariadb-server-10.7 (= ${server:Version}),
unixodbc,
${misc:Depends},
${shlibs:Depends}
@@ -773,7 +800,7 @@ Description: Connect storage engine for MariaDB
Package: mariadb-plugin-s3
Architecture: any
Depends: libcurl4,
- mariadb-server-10.6 (= ${server:Version}),
+ mariadb-server-10.7 (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Amazon S3 archival storage engine for MariaDB
@@ -783,7 +810,7 @@ Description: Amazon S3 archival storage engine for MariaDB
Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
-Depends: mariadb-server-10.6 (= ${server:Version}),
+Depends: mariadb-server-10.7 (= ${server:Version}),
python3,
rocksdb-tools,
${misc:Depends},
@@ -803,7 +830,7 @@ Description: RocksDB storage engine for MariaDB
Package: mariadb-plugin-oqgraph
Architecture: any
Depends: libjudydebian1,
- mariadb-server-10.6 (= ${server:Version}),
+ mariadb-server-10.7 (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-oqgraph-engine-10.0,
@@ -823,7 +850,7 @@ Description: OQGraph 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.6 (= ${server:Version}),
+Depends: mariadb-server-10.7 (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
@@ -843,7 +870,7 @@ Description: Mroonga storage engine for MariaDB
Package: mariadb-plugin-spider
Architecture: any
-Depends: mariadb-server-10.6 (= ${server:Version}),
+Depends: mariadb-server-10.7 (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
@@ -865,7 +892,7 @@ Description: Spider storage engine for MariaDB
Package: mariadb-plugin-gssapi-server
Architecture: any
Depends: libgssapi-krb5-2,
- mariadb-server-10.6,
+ mariadb-server-10.7,
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-server-10.1,
@@ -886,7 +913,7 @@ Package: mariadb-plugin-gssapi-client
Architecture: any
Multi-Arch: same
Depends: libgssapi-krb5-2,
- mariadb-client-10.6 (= ${binary:Version}),
+ mariadb-client-10.7 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-client-10.1,
@@ -906,7 +933,7 @@ Description: GSSAPI authentication plugin for MariaDB client
Package: mariadb-plugin-cracklib-password-check
Architecture: any
Depends: libcrack2 (>= 2.9.0),
- mariadb-server-10.6,
+ mariadb-server-10.7,
${misc:Depends},
${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB
@@ -915,10 +942,80 @@ Description: CrackLib Password Validation Plugin for MariaDB
.
Install and configure this to enforce stronger passwords for MariaDB users.
+Package: mariadb-plugin-provider-bzip2
+Architecture: any
+Depends: mariadb-server-10.7,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: BZip2 compression support in the server and storage engines
+ The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga,
+ can use different compression libraries.
+ .
+ Plugin provides BZip2 (https://sourceware.org/bzip2/) compression
+ .
+ Note that these affect InnoDB and Mroonga only;
+ RocksDB still uses the compression algorithms from its own library
+
+Package: mariadb-plugin-provider-lz4
+Architecture: any
+Depends: mariadb-server-10.7,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: LZ4 compression support in the server and storage engines
+ The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga,
+ can use different compression libraries.
+ .
+ Plugin provides LZ4 (http://lz4.github.io/lz4/) compression
+ .
+ Note that these affect InnoDB and Mroonga only;
+ RocksDB still uses the compression algorithms from its own library
+
+Package: mariadb-plugin-provider-lzma
+Architecture: any
+Depends: mariadb-server-10.7,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: LZMA compression support in the server and storage engines
+ The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga,
+ can use different compression libraries.
+ .
+ Plugin provides LZMA (https://tukaani.org/lzma/) compression
+ .
+ Note that these affect InnoDB and Mroonga only;
+ RocksDB still uses the compression algorithms from its own library
+
+Package: mariadb-plugin-provider-lzo
+Architecture: any
+Depends: mariadb-server-10.7,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: LZO compression support in the server and storage engines
+ The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga,
+ can use different compression libraries.
+ .
+ Plugin provides LZO (http://www.oberhumer.com/opensource/lzo/) compression
+ .
+ Note that these affect InnoDB and Mroonga only;
+ RocksDB still uses the compression algorithms from its own library
+
+Package: mariadb-plugin-provider-snappy
+Architecture: any
+Depends: mariadb-server-10.7,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: Snappy compression support in the server and storage engines
+ The various MariaDB storage engines, such as InnoDB, RocksDB, Mroonga,
+ can use different compression libraries.
+ .
+ Plugin provides Snappy (https://github.com/google/snappy) compression
+ .
+ Note that these affect InnoDB and Mroonga only;
+ RocksDB still uses the compression algorithms from its own library
+
Package: mariadb-test
Architecture: any
-Depends: mariadb-client-10.6 (= ${binary:Version}),
- mariadb-server-10.6 (= ${server:Version}),
+Depends: mariadb-client-10.7 (= ${binary:Version}),
+ mariadb-server-10.7 (= ${server:Version}),
mariadb-test-data (= ${source:Version}),
virtual-mysql-testsuite,
${misc:Depends},
diff --git a/debian/mariadb-client-10.6.README.Debian b/debian/mariadb-client-10.7.README.Debian
index 64f0f509951..64f0f509951 100644
--- a/debian/mariadb-client-10.6.README.Debian
+++ b/debian/mariadb-client-10.7.README.Debian
diff --git a/debian/mariadb-client-10.6.docs b/debian/mariadb-client-10.7.docs
index c09092629c3..c09092629c3 100644
--- a/debian/mariadb-client-10.6.docs
+++ b/debian/mariadb-client-10.7.docs
diff --git a/debian/mariadb-client-10.6.install b/debian/mariadb-client-10.7.install
index 3a92ded15b6..3a92ded15b6 100644
--- a/debian/mariadb-client-10.6.install
+++ b/debian/mariadb-client-10.7.install
diff --git a/debian/mariadb-client-10.6.links b/debian/mariadb-client-10.7.links
index bc42197629b..bc42197629b 100644
--- a/debian/mariadb-client-10.6.links
+++ b/debian/mariadb-client-10.7.links
diff --git a/debian/mariadb-client-10.6.manpages b/debian/mariadb-client-10.7.manpages
index 8735caeea8b..8735caeea8b 100644
--- a/debian/mariadb-client-10.6.manpages
+++ b/debian/mariadb-client-10.7.manpages
diff --git a/debian/mariadb-client-10.6.menu b/debian/mariadb-client-10.7.menu
index 90280215b8b..edd489cf316 100644
--- a/debian/mariadb-client-10.6.menu
+++ b/debian/mariadb-client-10.7.menu
@@ -1,3 +1,3 @@
# According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/
-?package(mariadb-client-10.6):needs="text" section="Applications/Data Management"\
+?package(mariadb-client-10.7):needs="text" section="Applications/Data Management"\
title="Innotop" command="/usr/bin/innotop"
diff --git a/debian/mariadb-client-core-10.6.install b/debian/mariadb-client-core-10.7.install
index 421b62d2a1a..421b62d2a1a 100644
--- a/debian/mariadb-client-core-10.6.install
+++ b/debian/mariadb-client-core-10.7.install
diff --git a/debian/mariadb-client-core-10.6.links b/debian/mariadb-client-core-10.7.links
index 5134dd814b5..5134dd814b5 100644
--- a/debian/mariadb-client-core-10.6.links
+++ b/debian/mariadb-client-core-10.7.links
diff --git a/debian/mariadb-plugin-provider-bzip2.install b/debian/mariadb-plugin-provider-bzip2.install
new file mode 100644
index 00000000000..75a73c384a7
--- /dev/null
+++ b/debian/mariadb-plugin-provider-bzip2.install
@@ -0,0 +1,2 @@
+etc/mysql/mariadb.conf.d/provider_bzip2.cnf
+usr/lib/mysql/plugin/provider_bzip2.so
diff --git a/debian/mariadb-plugin-provider-bzip2.lintian-overrides b/debian/mariadb-plugin-provider-bzip2.lintian-overrides
new file mode 100644
index 00000000000..563c05a3a6b
--- /dev/null
+++ b/debian/mariadb-plugin-provider-bzip2.lintian-overrides
@@ -0,0 +1,3 @@
+# It's intentional that bzip2 compression plugin doesn't have symbols from libc
+# More info https://jira.mariadb.org/browse/MDEV-28120
+library-not-linked-against-libc usr/lib/mysql/plugin/provider_bzip2.so \ No newline at end of file
diff --git a/debian/mariadb-plugin-provider-lz4.install b/debian/mariadb-plugin-provider-lz4.install
new file mode 100644
index 00000000000..a3ba1d77bb3
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lz4.install
@@ -0,0 +1,2 @@
+etc/mysql/mariadb.conf.d/provider_lz4.cnf
+usr/lib/mysql/plugin/provider_lz4.so
diff --git a/debian/mariadb-plugin-provider-lz4.lintian-overrides b/debian/mariadb-plugin-provider-lz4.lintian-overrides
new file mode 100644
index 00000000000..3f7d7e9ecfb
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lz4.lintian-overrides
@@ -0,0 +1,3 @@
+# It's intentional that LZ4 compression plugin doesn't have symbols from libc
+# More info https://jira.mariadb.org/browse/MDEV-28120
+library-not-linked-against-libc usr/lib/mysql/plugin/provider_lz4.so \ No newline at end of file
diff --git a/debian/mariadb-plugin-provider-lzma.install b/debian/mariadb-plugin-provider-lzma.install
new file mode 100644
index 00000000000..4a4138b45c6
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lzma.install
@@ -0,0 +1,2 @@
+etc/mysql/mariadb.conf.d/provider_lzma.cnf
+usr/lib/mysql/plugin/provider_lzma.so
diff --git a/debian/mariadb-plugin-provider-lzma.lintian-overrides b/debian/mariadb-plugin-provider-lzma.lintian-overrides
new file mode 100644
index 00000000000..94eafa766a4
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lzma.lintian-overrides
@@ -0,0 +1,3 @@
+# It's intentional that LZMA compression plugin doesn't have symbols from libc
+# More info https://jira.mariadb.org/browse/MDEV-28120
+library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzma.so \ No newline at end of file
diff --git a/debian/mariadb-plugin-provider-lzo.install b/debian/mariadb-plugin-provider-lzo.install
new file mode 100644
index 00000000000..2bf4c091ddc
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lzo.install
@@ -0,0 +1,2 @@
+etc/mysql/mariadb.conf.d/provider_lzo.cnf
+usr/lib/mysql/plugin/provider_lzo.so
diff --git a/debian/mariadb-plugin-provider-lzo.lintian-overrides b/debian/mariadb-plugin-provider-lzo.lintian-overrides
new file mode 100644
index 00000000000..8184923cf9a
--- /dev/null
+++ b/debian/mariadb-plugin-provider-lzo.lintian-overrides
@@ -0,0 +1,3 @@
+# It's intentional that LZO compression plugin doesn't have symbols from libc
+# More info https://jira.mariadb.org/browse/MDEV-28120
+library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzo.so \ No newline at end of file
diff --git a/debian/mariadb-plugin-provider-snappy.install b/debian/mariadb-plugin-provider-snappy.install
new file mode 100644
index 00000000000..26c929c89ba
--- /dev/null
+++ b/debian/mariadb-plugin-provider-snappy.install
@@ -0,0 +1,2 @@
+etc/mysql/mariadb.conf.d/provider_snappy.cnf
+usr/lib/mysql/plugin/provider_snappy.so
diff --git a/debian/mariadb-plugin-provider-snappy.lintian-overrides b/debian/mariadb-plugin-provider-snappy.lintian-overrides
new file mode 100644
index 00000000000..6c76162573d
--- /dev/null
+++ b/debian/mariadb-plugin-provider-snappy.lintian-overrides
@@ -0,0 +1,3 @@
+# It's intentional that Snappy compression plugin doesn't have symbols from libc
+# More info https://jira.mariadb.org/browse/MDEV-28120
+library-not-linked-against-libc usr/lib/mysql/plugin/provider_snappy.so \ No newline at end of file
diff --git a/debian/mariadb-server-10.6.README.Debian b/debian/mariadb-server-10.7.README.Debian
index 6042249a706..6042249a706 100644
--- a/debian/mariadb-server-10.6.README.Debian
+++ b/debian/mariadb-server-10.7.README.Debian
diff --git a/debian/mariadb-server-10.6.config b/debian/mariadb-server-10.7.config
index 27e2e9f4929..f47b147ee62 100644
--- a/debian/mariadb-server-10.6.config
+++ b/debian/mariadb-server-10.7.config
@@ -9,6 +9,6 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
# Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then
- db_input high mariadb-server-10.6/nis_warning || true
+ db_input high mariadb-server-10.7/nis_warning || true
db_go
fi
diff --git a/debian/mariadb-server-10.6.dirs b/debian/mariadb-server-10.7.dirs
index 5057fe806c3..5057fe806c3 100644
--- a/debian/mariadb-server-10.6.dirs
+++ b/debian/mariadb-server-10.7.dirs
diff --git a/debian/mariadb-server-10.6.install b/debian/mariadb-server-10.7.install
index 4d15f5d8e54..ea17c087953 100644
--- a/debian/mariadb-server-10.6.install
+++ b/debian/mariadb-server-10.7.install
@@ -3,7 +3,7 @@ debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mariadb.conf.d/50-mysqld_safe.cnf etc/mysql/mariadb.conf.d
debian/additions/mariadb.conf.d/50-server.cnf etc/mysql/mariadb.conf.d
-debian/additions/source_mariadb-10.6.py usr/share/apport/package-hooks
+debian/additions/source_mariadb-10.7.py usr/share/apport/package-hooks
etc/apparmor.d/usr.sbin.mariadbd
etc/security/user_map.conf
lib/*/security/pam_user_map.so
@@ -45,6 +45,7 @@ usr/lib/mysql/plugin/ha_sphinx.so
usr/lib/mysql/plugin/handlersocket.so
usr/lib/mysql/plugin/locales.so
usr/lib/mysql/plugin/metadata_lock_info.so
+usr/lib/mysql/plugin/password_reuse_check.so
usr/lib/mysql/plugin/query_cache_info.so
usr/lib/mysql/plugin/query_response_time.so
usr/lib/mysql/plugin/server_audit.so
@@ -52,7 +53,7 @@ usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
usr/lib/mysql/plugin/type_mysql_json.so
usr/lib/mysql/plugin/wsrep_info.so
-usr/share/doc/mariadb-server-10.6/mariadbd.sym.gz
+usr/share/doc/mariadb-server-10.7/mariadbd.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.6.links b/debian/mariadb-server-10.7.links
index 9cc3a436ba8..9cc3a436ba8 100644
--- a/debian/mariadb-server-10.6.links
+++ b/debian/mariadb-server-10.7.links
diff --git a/debian/mariadb-server-10.6.logcheck.ignore.paranoid b/debian/mariadb-server-10.7.logcheck.ignore.paranoid
index 407d4063270..407d4063270 100644
--- a/debian/mariadb-server-10.6.logcheck.ignore.paranoid
+++ b/debian/mariadb-server-10.7.logcheck.ignore.paranoid
diff --git a/debian/mariadb-server-10.6.logcheck.ignore.server b/debian/mariadb-server-10.7.logcheck.ignore.server
index a64fc54e15c..a64fc54e15c 100644
--- a/debian/mariadb-server-10.6.logcheck.ignore.server
+++ b/debian/mariadb-server-10.7.logcheck.ignore.server
diff --git a/debian/mariadb-server-10.6.logcheck.ignore.workstation b/debian/mariadb-server-10.7.logcheck.ignore.workstation
index a64fc54e15c..a64fc54e15c 100644
--- a/debian/mariadb-server-10.6.logcheck.ignore.workstation
+++ b/debian/mariadb-server-10.7.logcheck.ignore.workstation
diff --git a/debian/mariadb-server-10.6.mariadb.init b/debian/mariadb-server-10.7.mariadb.init
index b92282dedce..5cad48b9a9f 100644
--- a/debian/mariadb-server-10.6.mariadb.init
+++ b/debian/mariadb-server-10.7.mariadb.init
@@ -174,7 +174,7 @@ case "${1:-''}" in
if ! mariadbd_status check_dead warn; then
log_end_msg 1
- log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.6/README.Debian.gz!"
+ log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.7/README.Debian.gz!"
exit -1
else
log_end_msg 0
diff --git a/debian/mariadb-server-10.6.mysql-server.logrotate b/debian/mariadb-server-10.7.mysql-server.logrotate
index 11e4480c427..11e4480c427 100644
--- a/debian/mariadb-server-10.6.mysql-server.logrotate
+++ b/debian/mariadb-server-10.7.mysql-server.logrotate
diff --git a/debian/mariadb-server-10.6.mysql.default b/debian/mariadb-server-10.7.mysql.default
index 36079edecb2..36079edecb2 100644
--- a/debian/mariadb-server-10.6.mysql.default
+++ b/debian/mariadb-server-10.7.mysql.default
diff --git a/debian/mariadb-server-10.6.postinst b/debian/mariadb-server-10.7.postinst
index 93a1e4e8b87..93a1e4e8b87 100644
--- a/debian/mariadb-server-10.6.postinst
+++ b/debian/mariadb-server-10.7.postinst
diff --git a/debian/mariadb-server-10.6.postrm b/debian/mariadb-server-10.7.postrm
index 94ce91db31d..94ce91db31d 100644
--- a/debian/mariadb-server-10.6.postrm
+++ b/debian/mariadb-server-10.7.postrm
diff --git a/debian/mariadb-server-10.6.preinst b/debian/mariadb-server-10.7.preinst
index 79c6ccc8500..79c6ccc8500 100644
--- a/debian/mariadb-server-10.6.preinst
+++ b/debian/mariadb-server-10.7.preinst
diff --git a/debian/mariadb-server-10.6.prerm b/debian/mariadb-server-10.7.prerm
index 8fd172da9d2..8fd172da9d2 100644
--- a/debian/mariadb-server-10.6.prerm
+++ b/debian/mariadb-server-10.7.prerm
diff --git a/debian/mariadb-server-10.6.templates b/debian/mariadb-server-10.7.templates
index 32e908c71e9..916baf0d483 100644
--- a/debian/mariadb-server-10.6.templates
+++ b/debian/mariadb-server-10.7.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.6/old_data_directory_saved
+Template: mariadb-server-10.7/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.6/nis_warning
+Template: mariadb-server-10.7/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.6/postrm_remove_databases
+Template: mariadb-server-10.7/postrm_remove_databases
Type: boolean
Default: false
_Description: Remove all MariaDB databases?
diff --git a/debian/mariadb-server-10.6.triggers b/debian/mariadb-server-10.7.triggers
index d1f5f5e14f1..d1f5f5e14f1 100644
--- a/debian/mariadb-server-10.6.triggers
+++ b/debian/mariadb-server-10.7.triggers
diff --git a/debian/mariadb-server-core-10.6.install b/debian/mariadb-server-core-10.7.install
index def95268512..def95268512 100644
--- a/debian/mariadb-server-core-10.6.install
+++ b/debian/mariadb-server-core-10.7.install
diff --git a/debian/mariadb-server-core-10.6.links b/debian/mariadb-server-core-10.7.links
index c2be98f38fb..c2be98f38fb 100644
--- a/debian/mariadb-server-core-10.6.links
+++ b/debian/mariadb-server-core-10.7.links
diff --git a/debian/not-installed b/debian/not-installed
index 6924c9ad1a5..ff05d1827ef 100644
--- a/debian/not-installed
+++ b/debian/not-installed
@@ -16,15 +16,15 @@ usr/lib/*/libdbbc.a # ColumnStore header file
usr/lib/*/libidbboot.a # ColumnStore header file
usr/lib/*/libprocessor.a # ColumnStore header file
usr/lib/*/libwe_xml.a # ColumnStore header file
-usr/share/doc/mariadb-server-10.6/COPYING
-usr/share/doc/mariadb-server-10.6/COPYING.AGPLv3
-usr/share/doc/mariadb-server-10.6/COPYING.GPLv2
-usr/share/doc/mariadb-server-10.6/COPYING.thirdparty
-usr/share/doc/mariadb-server-10.6/CREDITS
-usr/share/doc/mariadb-server-10.6/EXCEPTIONS-CLIENT
-usr/share/doc/mariadb-server-10.6/INSTALL-BINARY
-usr/share/doc/mariadb-server-10.6/PATENTS
-usr/share/doc/mariadb-server-10.6/README-wsrep
+usr/share/doc/mariadb-server-10.7/COPYING
+usr/share/doc/mariadb-server-10.7/COPYING.AGPLv3
+usr/share/doc/mariadb-server-10.7/COPYING.GPLv2
+usr/share/doc/mariadb-server-10.7/COPYING.thirdparty
+usr/share/doc/mariadb-server-10.7/CREDITS
+usr/share/doc/mariadb-server-10.7/EXCEPTIONS-CLIENT
+usr/share/doc/mariadb-server-10.7/INSTALL-BINARY
+usr/share/doc/mariadb-server-10.7/PATENTS
+usr/share/doc/mariadb-server-10.7/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 17bbe40ee92..d96402785cc 100644
--- a/debian/po/POTFILES.in
+++ b/debian/po/POTFILES.in
@@ -1 +1 @@
-[type: gettext/rfc822deb] mariadb-server-10.6.templates
+[type: gettext/rfc822deb] mariadb-server-10.7.templates
diff --git a/debian/po/ar.po b/debian/po/ar.po
index 8512209efbb..b4a2ff0aab3 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "ملاحظة هامة لمستخدمي NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "إزالة جميع قواعد بيانات MariaDB؟"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/ca.po b/debian/po/ca.po
index d9c69e19983..8796ca196a8 100644
--- a/debian/po/ca.po
+++ b/debian/po/ca.po
@@ -1,12 +1,12 @@
# mariadb (debconf) translation to Catalan.
-# his file is distributed under the same license as the mariadb-10.6 package.
+# his file is distributed under the same license as the mariadb-10.7 package.
# Aleix Badia i Bosch <abadia@ica.es> 2004
# Innocent De Marchi <tangram.peces@gmail.com> 2017
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-03-20 17:55+0100\n"
"Last-Translator: Innocent De Marchi <tangram.peces@gmail.com>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "El directori de dades antigues es desarà a una nova localització"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -56,13 +56,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota important pels usuaris de «NIS/YP»"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Eliminar totes les bases de dades MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/cs.po b/debian/po/cs.po
index 8176d86457b..573fc645663 100644
--- a/debian/po/cs.po
+++ b/debian/po/cs.po
@@ -13,8 +13,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2020-10-18 17:13+0200\n"
"Last-Translator: Miroslav Kure <kurem@debian.cz>\n"
@@ -26,13 +26,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Starý adresář s daty bude uložen na novém místě."
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -54,7 +54,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -63,13 +63,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -79,7 +79,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -88,13 +88,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Odstranit všechny MariaDB databáze?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -104,7 +104,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/da.po b/debian/po/da.po
index 4de2e4e7057..aa45b277904 100644
--- a/debian/po/da.po
+++ b/debian/po/da.po
@@ -1,13 +1,13 @@
-# Danish translation mariadb-10.6.
-# Copyright (C) 2014 mariadb-10.6 og nedenstående oversættere.
-# This file is distributed under the same license as the mariadb-10.6 package.
+# Danish translation mariadb-10.7.
+# Copyright (C) 2014 mariadb-10.7 og nedenstående oversættere.
+# This file is distributed under the same license as the mariadb-10.7 package.
# Claus Hindsgaul <claus.hindsgaul@gmail.com>, 2005, 2006, 2007.
# Joe Hansen <joedalton2@yahoo.dk>, 2014, 2016.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-07-09 22:41+0200\n"
"Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Den gamle datamappe vil blive gemt på en ny placering"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -56,13 +56,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Vigtig oplysning til NIS/YP-brugere"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Fjern alle MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/de.po b/debian/po/de.po
index 2228a07e27d..fdbd3f2986a 100644
--- a/debian/po/de.po
+++ b/debian/po/de.po
@@ -1,4 +1,4 @@
-# German translation of mariadb-10.6 10.0.13-1
+# German translation of mariadb-10.7 10.0.13-1
# Alwin Meschede <ameschede@gmx.de>, 2006, 2007.
# Thomas Mueller <thomas.mueller@tmit.eu>, 2009.
# Chris Leick <c.leick@vollbio.de>, 2014-2016.
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mariadb 10.0.25-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-05-12 22:39+0100\n"
"Last-Translator: Chris Leick <c.leick@vollbio.de>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Das alte Datenverzeichnis wird an einer neuen Stelle gespeichert"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -56,13 +56,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Wichtige Anmerkung für NIS/YP-Benutzer!"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Alle MariaDB-Datenbanken entfernen?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/es.po b/debian/po/es.po
index db5a8bbf7a6..82f1a8ed576 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-04-30 21:26+0200\n"
"Last-Translator: Javier Fernández-Sanguino <jfs@debian.org>\n"
@@ -54,13 +54,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Se guardará el directorio antiguo de datos a la nueva ubicación"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -82,7 +82,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -91,13 +91,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para los usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -107,7 +107,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -117,13 +117,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Desea eliminar todas las bases de datos MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -133,7 +133,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/eu.po b/debian/po/eu.po
index 191d92b615e..67e07070a3d 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP erabiltzaileentzat ohar garrantzitsua"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ezabatu MariaDB datubase guztiak?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/fi.po b/debian/po/fi.po
index 16e310b8c6a..b787b265ea3 100644
--- a/debian/po/fi.po
+++ b/debian/po/fi.po
@@ -1,11 +1,11 @@
-# Finnish translations for mariadb-10.6 package
-# This file is distributed under the same license as the mariadb-10.6 package.
+# Finnish translations for mariadb-10.7 package
+# This file is distributed under the same license as the mariadb-10.7 package.
# Antti Järvinen <antti.jarvinen@katiska.org>, 2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-03-15 22:36+0200\n"
"Last-Translator: antti.jarvinen@katiska.org\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Vanha datahakemisto tullaan tallentamaan uuteen paikkaan"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -56,13 +56,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Merkittävä huomio NIS/YP -käyttäjille"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -80,13 +80,13 @@ msgstr "Tarkista myös hakemiston /var/lib/mysql omistaja ja oikeudet:"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Poistetaanko kaikki MariaDB-tietokannat?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -95,7 +95,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/fr.po b/debian/po/fr.po
index 1604203696b..ade489bae0f 100644
--- a/debian/po/fr.po
+++ b/debian/po/fr.po
@@ -1,6 +1,6 @@
-# Translation of mariadb-10.6 debconf templates to French
+# Translation of mariadb-10.7 debconf templates to French
# Copyright (C) 2004-2016 Debian French l10n team <debian-l10n-french@lists.debian.org>
-# This file is distributed under the same license as the mariadb-10.6 packages.
+# This file is distributed under the same license as the mariadb-10.7 packages.
#
# Translators:
# Christian Perrier <bubulle@debian.org>, 2004, 2006, 2007, 2009, 2013.
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: fr\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-12-31 18:35+0100\n"
"Last-Translator: Baptiste Jammet <baptiste@mailoo.org>\n"
@@ -23,13 +23,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "L'ancien répertoire de données sera sauvegardé à un nouvel emplacement"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -51,7 +51,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -60,13 +60,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Note importante pour les utilisateurs NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -76,7 +76,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Faut-il supprimer toutes les bases de données MariaDB ?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -102,7 +102,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/gl.po b/debian/po/gl.po
index d84a745a732..a18097f76cd 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para os usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Eliminar tódalas bases de datos de MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/it.po b/debian/po/it.po
index 54b9e980b1c..eeef6960313 100644
--- a/debian/po/it.po
+++ b/debian/po/it.po
@@ -1,11 +1,11 @@
-# Italian (it) translation of debconf templates for mariadb-10.6
-# This file is distributed under the same license as the mariadb-10.6 package.
+# Italian (it) translation of debconf templates for mariadb-10.7
+# This file is distributed under the same license as the mariadb-10.7 package.
# Luca Monducci <luca.mo@tiscali.it>, 2006-2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6 10.0.13 Italian debconf templates\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7 10.0.13 Italian debconf templates\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-083-20 20:29+0100\n"
"Last-Translator: Luca Monducci <luca.mo@tiscali.it>\n"
@@ -17,13 +17,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "La vecchia directory data verrà salvata in una nuova posizione"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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,7 +45,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -54,13 +54,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante per gli utenti NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -80,13 +80,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Eliminare tutti i database MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -96,7 +96,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/ja.po b/debian/po/ja.po
index c7a3bea42ce..a2a8583843c 100644
--- a/debian/po/ja.po
+++ b/debian/po/ja.po
@@ -15,8 +15,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6 10.0.32-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7 10.0.32-1\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-05-01 11:27+0900\n"
"Last-Translator: Takuma Yamada <tyamada@takumayamada.com>\n"
@@ -30,13 +30,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "å¤ã„データディレクトリã¯ã€æ–°ã—ã„場所ã«ä¿å­˜ã•ã‚Œã¾ã™"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -48,7 +48,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -58,7 +58,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -67,13 +67,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP ユーザã¸ã®é‡è¦ãªæ³¨æ„"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -83,7 +83,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -91,13 +91,13 @@ msgstr "/var/lib/mysql ã®æ‰€æœ‰è€…権é™ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹å¿…è¦ã‚‚ã‚ã‚Šã¾
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "ã™ã¹ã¦ã® MariaDB データベースを削除ã—ã¾ã™ã‹?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -107,7 +107,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/nb.po b/debian/po/nb.po
index b11a70c3a0e..a3a9e069486 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
#, fuzzy
#| msgid ""
#| "The script is about to remove the data directory /var/lib/mysql. If it is "
diff --git a/debian/po/nl.po b/debian/po/nl.po
index 90e6ea767bb..00ab55777c6 100644
--- a/debian/po/nl.po
+++ b/debian/po/nl.po
@@ -1,13 +1,13 @@
# Dutch mariadb-10 po-debconf translation,
# Copyright (C) 2006 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the mariadb-10.6 package.
+# This file is distributed under the same license as the mariadb-10.7 package.
# Vincent Zweije <zweije@xs4all.nl>, 2006.
# Frans Spiesschaert <Frans.Spiesschaert@yucom.be>, 2014, 2016, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: mariadb-10.2.7-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2018-03-29 21:25+0200\n"
"Last-Translator: Frans Spiesschaert <Frans.Spiesschaert@yucom.be>\n"
@@ -21,13 +21,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "De oude data-map zal op een nieuwe locatie bewaard worden"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -39,7 +39,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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,7 +49,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -58,13 +58,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Belangrijke opmerking voor gebruikers van NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -74,7 +74,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -84,13 +84,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Wilt u alle MariaDB-databases verwijderen?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/pt.po b/debian/po/pt.po
index 4df8e3540a8..8c7823c8edf 100644
--- a/debian/po/pt.po
+++ b/debian/po/pt.po
@@ -6,8 +6,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-08-06 10:00+0100\n"
"Last-Translator: Rui Branco <ruipb@debianpt.org>\n"
@@ -20,13 +20,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "O antigo directório de data será guardado num novo local"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -38,7 +38,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -48,7 +48,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -57,13 +57,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para os utilizadores de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
index cf8127236e5..d0a4c6db8fe 100644
--- a/debian/po/pt_BR.po
+++ b/debian/po/pt_BR.po
@@ -1,12 +1,12 @@
-# Debconf translations for mariadb-10.6.
-# This file is distributed under the same license as the mariadb-10.6 package.
+# Debconf translations for mariadb-10.7.
+# This file is distributed under the same license as the mariadb-10.7 package.
# André Luís Lopes, <andrelop@debian.org>, 2005-2007.
# Adriano Rafael Gomes <adrianorg@arg.eti.br>, 2015-2016.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-04-30 16:16-0300\n"
"Last-Translator: Adriano Rafael Gomes <adrianorg@arg.eti.br>\n"
@@ -19,13 +19,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "O diretório de dados antigo será salvo em novo local"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -47,7 +47,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -56,13 +56,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Aviso importante para usuários NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -72,7 +72,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados do MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/ro.po b/debian/po/ro.po
index 869a5efddd2..6fda31dc508 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.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
#, fuzzy
#| msgid ""
#| "The script is about to remove the data directory /var/lib/mysql. If it is "
diff --git a/debian/po/ru.po b/debian/po/ru.po
index 01152031369..ecdc8e658f7 100644
--- a/debian/po/ru.po
+++ b/debian/po/ru.po
@@ -6,8 +6,8 @@
# Yuri Kozlov <yuray@komyakino.ru>, 2009, 2014, 2016.
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6 10.0.25-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7 10.0.25-1\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2016-05-04 18:56+0300\n"
"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
@@ -22,13 +22,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Каталог Ñо Ñтарыми данными будет Ñохранён в новом меÑте"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -40,7 +40,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -51,7 +51,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -60,13 +60,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Важное замечание Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»ÐµÐ¹ NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"Using MariaDB under NIS/YP requires a mysql user account to be added on the "
"local system with:"
@@ -76,7 +76,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -84,13 +84,13 @@ msgstr "Также проверьте права доÑтупа и владелÑ
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Удалить вÑе базы данных MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/sv.po b/debian/po/sv.po
index 0c44b9923df..4ac8f477339 100644
--- a/debian/po/sv.po
+++ b/debian/po/sv.po
@@ -1,13 +1,13 @@
-# Translation of mariadb-10.6 debconf template to Swedish
+# Translation of mariadb-10.7 debconf template to Swedish
# Copyright (C) 2017 Martin Bagge <brother@bsnet.se>
-# This file is distributed under the same license as the mariadb-10.6 package.
+# This file is distributed under the same license as the mariadb-10.7 package.
#
# Andreas Henriksson <andreas@fatal.se>, 2007
# Martin Bagge <brother@bsnet.se>, 2009, 2015, 2017
msgid ""
msgstr ""
"Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-03-23 09:20+0100\n"
"Last-Translator: Martin Bagge / brother <brother@bsnet.se>\n"
@@ -20,13 +20,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Den gamla data-katalogen kommer att sparas till en ny plats"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -38,7 +38,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -48,7 +48,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -57,13 +57,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Viktig information för NIS/YP-användare"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -83,13 +83,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ta bort alla MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
index 73febcc0174..26d3231f0cd 100644
--- a/debian/po/templates.pot
+++ b/debian/po/templates.pot
@@ -1,13 +1,13 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the mariadb-10.6 package.
+# This file is distributed under the same license as the mariadb-10.7 package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.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.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/tr.po b/debian/po/tr.po
index 9d292dad46c..2df83c2b502 100644
--- a/debian/po/tr.po
+++ b/debian/po/tr.po
@@ -5,8 +5,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-03-16 13:16+0300\n"
"Last-Translator: Atila KOÇ <koc@artielektronik.com.tr>\n"
@@ -20,13 +20,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Eski veritabanı dizini yeni konumuna kaydedilecektir"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -38,7 +38,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -48,20 +48,20 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr "Gerektiğinde verinizi elle (ör. mysqldump ile) içe/dışa aktarın."
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP kullanıcıları için önemli not"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -81,13 +81,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Tüm MariaDB veritabanları kaldırılsın mı?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -96,7 +96,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/po/vi.po b/debian/po/vi.po
index 3aa7e3f3d25..6ff1185b81c 100644
--- a/debian/po/vi.po
+++ b/debian/po/vi.po
@@ -1,12 +1,12 @@
-# Vietnamese translations for mariadb-10.6 package
-# Bản dịch Tiếng Việt dành cho gói mariadb-10.6.
-# This file is distributed under the same license as the mariadb-10.6 package.
+# Vietnamese translations for mariadb-10.7 package
+# Bản dịch Tiếng Việt dành cho gói mariadb-10.7.
+# This file is distributed under the same license as the mariadb-10.7 package.
# Trần Ngá»c Quân <vnwildman@gmail.com>, 2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.6\n"
-"Report-Msgid-Bugs-To: mariadb-10.6@packages.debian.org\n"
+"Project-Id-Version: mariadb-10.7\n"
+"Report-Msgid-Bugs-To: mariadb-10.7@packages.debian.org\n"
"POT-Creation-Date: 2019-07-23 19:16-0300\n"
"PO-Revision-Date: 2017-03-18 13:32+0700\n"
"Last-Translator: Trần Ngá»c Quân <vnwildman@gmail.com>\n"
@@ -20,13 +20,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Thư mục dữ liệu cũ sẽ được lưu tại vị trí mới"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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 "
@@ -38,7 +38,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.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."
@@ -48,7 +48,7 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:2001
+#: ../mariadb-server-10.7.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
@@ -57,13 +57,13 @@ msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Chú ý quan trá»ng cho ngÆ°á»i dùng NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.6.templates:3001
+#: ../mariadb-server-10.7.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.6.templates:3001
+#: ../mariadb-server-10.7.templates:3001
msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
@@ -82,13 +82,13 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Xóa bá» má»i cÆ¡ sở dữ liệu MariaDB chứ?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.templates:4001
msgid ""
"The /var/lib/mysql directory which contains the MariaDB databases is about "
"to be removed."
@@ -98,7 +98,7 @@ msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.6.templates:4001
+#: ../mariadb-server-10.7.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, "
diff --git a/debian/rules b/debian/rules
index 7dcc9a2ba3c..3e20af9f853 100755
--- a/debian/rules
+++ b/debian/rules
@@ -139,12 +139,12 @@ 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.6.mariadb.service
- cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server-10.6.mariadb.socket
- cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server-10.6.mariadb-extra.socket
- cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.6.mariadb@.service
- cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server-10.6.mariadb@.socket
- cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server-10.6.mariadb-extra@.socket
+ cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.7.mariadb.service
+ cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server-10.7.mariadb.socket
+ cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server-10.7.mariadb-extra.socket
+ cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.7.mariadb@.service
+ cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server-10.7.mariadb@.socket
+ cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server-10.7.mariadb-extra@.socket
endif
# Run 'make install' without output since it is uninteresting and
@@ -163,7 +163,7 @@ endif
# nm numeric soft is not enough, therefore extra sort in command
# to satisfy Debian reproducible build requirements
- nm --defined-only $(BUILDDIR)/sql/mariadbd | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.6/mariadbd.sym.gz
+ nm --defined-only $(BUILDDIR)/sql/mariadbd | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server-10.7/mariadbd.sym.gz
# Rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mariadbd
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
index 1efde56d70d..3e777b8432c 100644
--- a/debian/salsa-ci.yml
+++ b/debian/salsa-ci.yml
@@ -237,7 +237,7 @@ fresh install:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb-10.6 Sid upgrade:
+mariadb-10.7 Sid upgrade:
stage: upgrade in Sid
needs:
- job: build
@@ -258,7 +258,7 @@ mariadb-10.6 Sid upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb-10.5 Bullseye to mariadb-10.6 upgrade:
+mariadb-10.5 Bullseye to mariadb-10.7 upgrade:
stage: upgrade from Bullseye
needs:
- job: build
@@ -286,7 +286,7 @@ mariadb-10.5 Bullseye to mariadb-10.6 upgrade:
# Upgrade of libcrypt.so.1 no longer possible from Buster to Sid,
# so test upgrade only inside Buster (https://bugs.debian.org/993755)
-mariadb-10.3 to mariadb-10.6 upgrade in Buster:
+mariadb-10.3 to mariadb-10.7 upgrade in Buster:
stage: upgrade extras
needs:
- job: build buster-backports
@@ -515,7 +515,7 @@ default-libmysqlclient-dev upgrade in Buster:
# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh.
-mysql-8.0 Sid to mariadb-10.6 upgrade:
+mysql-8.0 Sid to mariadb-10.7 upgrade:
stage: upgrade in Sid
needs:
- job: build
@@ -554,7 +554,7 @@ mysql-8.0 Sid to mariadb-10.6 upgrade:
# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
# The Debian maintainer scripts detect this situation and simply moves old datadir aside and start fresh.
-mysql-8.0 Focal to mariadb-10.6 upgrade in Buster:
+mysql-8.0 Focal to mariadb-10.7 upgrade in Buster:
stage: upgrade extras
needs:
- job: build buster-backports
@@ -587,7 +587,7 @@ mysql-8.0 Focal to mariadb-10.6 upgrade in Buster:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.6 to mariadb-10.6 upgrade:
+mariadb.org-10.6 to mariadb-10.7 upgrade:
stage: upgrade extras
needs:
- job: build
@@ -622,7 +622,7 @@ mariadb.org-10.6 to mariadb-10.6 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.5 to mariadb-10.6 upgrade:
+mariadb.org-10.5 to mariadb-10.7 upgrade:
stage: upgrade extras
needs:
- job: build
@@ -652,7 +652,7 @@ mariadb.org-10.5 to mariadb-10.6 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.4 to mariadb-10.6 upgrade:
+mariadb.org-10.4 to mariadb-10.7 upgrade:
stage: upgrade extras
needs:
- job: build
@@ -685,7 +685,7 @@ mariadb.org-10.4 to mariadb-10.6 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.3 to mariadb-10.6 upgrade:
+mariadb.org-10.3 to mariadb-10.7 upgrade:
stage: upgrade extras
needs:
- job: build
@@ -716,7 +716,7 @@ mariadb.org-10.3 to mariadb-10.6 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.2 to mariadb-10.6 upgrade:
+mariadb.org-10.2 to mariadb-10.7 upgrade:
stage: upgrade extras
needs:
- job: build
@@ -755,7 +755,7 @@ mariadb.org-10.2 to mariadb-10.6 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mysql.com-5.7 to mariadb-10.6 upgrade in Buster:
+mysql.com-5.7 to mariadb-10.7 upgrade in Buster:
stage: upgrade extras
needs:
- job: build buster-backports
@@ -786,7 +786,7 @@ mysql.com-5.7 to mariadb-10.6 upgrade in Buster:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-percona-xtradb-5.7 to mariadb-10.6 upgrade in Buster (MDEV-22679):
+percona-xtradb-5.7 to mariadb-10.7 upgrade in Buster (MDEV-22679):
stage: upgrade extras
needs:
- job: build buster-backports
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
index 4a4671e0c9e..ac70670cf50 100644
--- a/debian/source/lintian-overrides
+++ b/debian/source/lintian-overrides
@@ -1,13 +1,13 @@
# Necessary for drop-in-place-replacement upgrades on mysql-server/-client
# since package breaks/replaces these but at the same time also provides them
-version-substvar-for-external-package mariadb-client-core-10.6 -> mysql-client-5.5
-version-substvar-for-external-package mariadb-server-10.6 -> mysql-server
+version-substvar-for-external-package mariadb-client-core-10.7 -> mysql-client-5.5
+version-substvar-for-external-package mariadb-server-10.7 -> mysql-server
version-substvar-for-external-package libmariadb-dev -> libmysqlclient-dev
version-substvar-for-external-package libmariadb-dev -> libmysqld-dev
-version-substvar-for-external-package mariadb-server-10.6 -> mysql-client-5.*
-version-substvar-for-external-package mariadb-server-10.6 -> mysql-client-8.*
-version-substvar-for-external-package mariadb-client-10.6 -> mysql-client-core-5.*
-version-substvar-for-external-package mariadb-client-10.6 -> mysql-client-core-8.*
+version-substvar-for-external-package mariadb-server-10.7 -> mysql-client-5.*
+version-substvar-for-external-package mariadb-server-10.7 -> mysql-client-8.*
+version-substvar-for-external-package mariadb-client-10.7 -> mysql-client-core-5.*
+version-substvar-for-external-package mariadb-client-10.7 -> mysql-client-core-8.*
version-substvar-for-external-package libmariadbd-dev -> libmariadbclient-dev
# ColumnStore not used in Debian, safe to ignore. Reported upstream in https://jira.mariadb.org/browse/MDEV-24124
source-is-missing storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2
diff --git a/debian/tests/control b/debian/tests/control
index 68067071c6b..1aae1ecf5bd 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -3,7 +3,12 @@ Tests: smoke
# for its existence (see the list in debian/control), install it if available
# and check in the test if it's functional when it should be.
# The plugin package also already depends on the other one.
-Depends: mariadb-plugin-rocksdb | mariadb-server-10.6
+Depends: mariadb-plugin-rocksdb | mariadb-server-10.7,
+ mariadb-plugin-provider-bzip2,
+ mariadb-plugin-provider-lz4,
+ mariadb-plugin-provider-lzma,
+ mariadb-plugin-provider-lzo,
+ mariadb-plugin-provider-snappy
Restrictions: allow-stderr needs-root isolation-container
Tests: upstream
diff --git a/debian/tests/smoke b/debian/tests/smoke
index e5d50496bdb..9838bb90081 100644
--- a/debian/tests/smoke
+++ b/debian/tests/smoke
@@ -4,7 +4,7 @@
#
# This test should be declared in debian/tests/control with a dependency
# on the package that provides a configured MariaDB server (eg.
-# mariadb-server-10.6).
+# mariadb-server-10.7).
#
# This test should be declared in debian/tests/control with the
# following restrictions:
@@ -38,6 +38,11 @@ else
# If systemd (and systemctl) is available, but the service did not start, then
# this smoke test is supposed to fail if next commands don't work.
echo "Found systemctl, continuing smoke test.."
+ # Compression plugins are separated from main server package
+ # to own packages (for example LZ4 package mariadb-plugin-provider-lz4)
+ # and they are installed after mariadb-server.
+ # which means that they don't exist if MariaDB is not restarted
+ systemctl restart mariadb
fi
mysql <<EOT
@@ -71,10 +76,10 @@ EOT
# but disabled with '#' the options that are not available in this binary build
mariadb <<EOT
SET GLOBAL innodb_compression_algorithm=lz4;
-#SET GLOBAL innodb_compression_algorithm=lzo;
-#SET GLOBAL innodb_compression_algorithm=lzma;
-#SET GLOBAL innodb_compression_algorithm=bzip2;
-#SET GLOBAL innodb_compression_algorithm=snappy;
+SET GLOBAL innodb_compression_algorithm=lzo;
+SET GLOBAL innodb_compression_algorithm=lzma;
+SET GLOBAL innodb_compression_algorithm=bzip2;
+SET GLOBAL innodb_compression_algorithm=snappy;
SET GLOBAL innodb_compression_algorithm=zlib;
SET GLOBAL innodb_compression_algorithm=none;
EOT
@@ -88,7 +93,7 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
LOG=/var/lib/mysql/#rocksdb/LOG
# XXX: The server may only be started during the install of
- # mariadb-server-10.6, which happens before that of the plugin.
+ # mariadb-server-10.7, which happens before that of the plugin.
[ -e $LOG ] || mysql -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';"
# XXX: rocksdb_supported_compression_types variable does not report ZSTD.
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 7dc5cd1921a..2b84f1cbca7 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -440,7 +440,7 @@ static void clean_up(struct languages *lang_head, struct errors *error_head)
{
struct languages *tmp_lang, *next_language;
struct errors *tmp_error, *next_error;
- uint count, i;
+ size_t count, i;
if (default_language_changed)
my_free((void*) default_language);
@@ -724,7 +724,7 @@ static struct message *find_message(struct errors *err, const char *lang,
my_bool no_default)
{
struct message *tmp, *return_val= 0;
- uint i, count;
+ size_t i, count;
DBUG_ENTER("find_message");
count= (err->msg).elements;
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 4dc65c8d9bc..82b88f7072d 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -76,7 +76,7 @@ static my_bool per_page_details;
static ulint n_merge;
static ulint physical_page_size; /* Page size in bytes on disk. */
ulong srv_page_size;
-ulong srv_page_size_shift;
+uint32_t srv_page_size_shift;
/* Current page number (0 based). */
uint32_t cur_page_num;
/* Current space. */
@@ -263,14 +263,14 @@ static void init_page_size(const byte* buf)
+ FSP_SPACE_FLAGS);
if (fil_space_t::full_crc32(flags)) {
- const ulong ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
+ const uint32_t ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize;
srv_page_size = 512U << ssize;
physical_page_size = srv_page_size;
return;
}
- const ulong ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ const uint32_t ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
srv_page_size_shift = ssize
? UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize
@@ -434,12 +434,7 @@ static bool is_page_all_zeroes(
with crypt_scheme encrypted
@param[in] flags tablespace flags
@retval true if page is corrupted otherwise false. */
-static
-bool
-is_page_corrupted(
- byte* buf,
- bool is_encrypted,
- ulint flags)
+static bool is_page_corrupted(byte *buf, bool is_encrypted, uint32_t flags)
{
/* enable if page is corrupted. */
@@ -596,7 +591,7 @@ Rewrite the checksum for the page.
@retval false : skip the rewrite as checksum stored match with
calculated or page is doublwrite buffer.
*/
-static bool update_checksum(byte* page, ulint flags)
+static bool update_checksum(byte* page, uint32_t flags)
{
ib_uint32_t checksum = 0;
byte stored1[4]; /* get FIL_PAGE_SPACE_OR_CHKSUM field checksum */
@@ -705,7 +700,7 @@ write_file(
const char* filename,
FILE* file,
byte* buf,
- ulint flags,
+ uint32_t flags,
fpos_t* pos)
{
bool do_update;
@@ -1373,7 +1368,7 @@ static int verify_checksum(
byte* buf,
bool is_encrypted,
unsigned long long* mismatch_count,
- ulint flags)
+ uint32_t flags)
{
int exit_status = 0;
if (is_page_corrupted(buf, is_encrypted, flags)) {
@@ -1414,7 +1409,7 @@ rewrite_checksum(
byte* buf,
fpos_t* pos,
bool is_encrypted,
- ulint flags)
+ uint32_t flags)
{
bool is_compressed = fil_space_t::is_compressed(flags);
@@ -1583,7 +1578,7 @@ int main(
from fsp_flags and encryption metadata from page 0 */
init_page_size(buf);
- ulint flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf);
+ uint32_t flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf);
if (physical_page_size == UNIV_ZIP_SIZE_MIN) {
partial_page_read = false;
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt
index a7a35c58ac3..afb172dbbaa 100644
--- a/extra/mariabackup/CMakeLists.txt
+++ b/extra/mariabackup/CMakeLists.txt
@@ -67,7 +67,7 @@ MYSQL_ADD_EXECUTABLE(mariadb-backup
xbstream_write.cc
backup_mysql.cc
backup_copy.cc
- encryption_plugin.cc
+ xb_plugin.cc
${PROJECT_BINARY_DIR}/sql/sql_builtin.cc
${PROJECT_SOURCE_DIR}/sql/net_serv.cc
${PROJECT_SOURCE_DIR}/libmysqld/libmysql.c
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index bc75a58d02e..ea85c478997 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -54,7 +54,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "backup_copy.h"
#include "backup_mysql.h"
#include "mysqld.h"
-#include "encryption_plugin.h"
+#include "xb_plugin.h"
#include <sstream>
#include <sql_error.h>
#include "page0zip.h"
@@ -524,7 +524,8 @@ bool get_mysql_vars(MYSQL *connection)
if (innodb_undo_tablespaces_var)
{
- srv_undo_tablespaces= strtoul(innodb_undo_tablespaces_var, &endptr, 10);
+ srv_undo_tablespaces= static_cast<uint32_t>
+ (strtoul(innodb_undo_tablespaces_var, &endptr, 10));
ut_ad(*endptr == 0);
}
@@ -1850,7 +1851,7 @@ bool write_backup_config_file()
"innodb_log_file_size=%llu\n"
"innodb_page_size=%lu\n"
"innodb_undo_directory=%s\n"
- "innodb_undo_tablespaces=%lu\n"
+ "innodb_undo_tablespaces=%u\n"
"innodb_compression_level=%u\n"
"%s%s\n"
"%s\n",
@@ -1865,7 +1866,7 @@ bool write_backup_config_file()
"innodb_buffer_pool_filename=" : "",
innobase_buffer_pool_filename ?
innobase_buffer_pool_filename : "",
- encryption_plugin_get_config());
+ xb_plugin_get_config());
return rc;
}
diff --git a/extra/mariabackup/common.h b/extra/mariabackup/common.h
index 1973512ad82..89b189e3a87 100644
--- a/extra/mariabackup/common.h
+++ b/extra/mariabackup/common.h
@@ -149,10 +149,9 @@ static inline ATTRIBUTE_FORMAT(printf, 1,2) ATTRIBUTE_NORETURN void die(const ch
/***********************************************************************
Computes bit shift for a given value. If the argument is not a power
of 2, returns 0.*/
-static inline size_t
-get_bit_shift(size_t value)
+static inline unsigned get_bit_shift(size_t value)
{
- size_t shift;
+ unsigned shift;
if (value == 0)
return 0;
diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc
index ddaa213491d..4c3016ec8f7 100644
--- a/extra/mariabackup/ds_local.cc
+++ b/extra/mariabackup/ds_local.cc
@@ -181,8 +181,8 @@ static void init_ibd_data(ds_local_file_t *local_file, const uchar *buf, size_t
return;
}
- ulint flags = mach_read_from_4(&buf[FIL_PAGE_DATA + FSP_SPACE_FLAGS]);
- ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ auto flags = mach_read_from_4(&buf[FIL_PAGE_DATA + FSP_SPACE_FLAGS]);
+ auto ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
local_file->pagesize= ssize == 0 ? UNIV_PAGE_SIZE_ORIG : ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
local_file->compressed = fil_space_t::full_crc32(flags)
? fil_space_t::is_compressed(flags)
diff --git a/extra/mariabackup/encryption_plugin.h b/extra/mariabackup/encryption_plugin.h
deleted file mode 100644
index 16d74790254..00000000000
--- a/extra/mariabackup/encryption_plugin.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <mysql.h>
-#include <string>
-extern void encryption_plugin_backup_init(MYSQL *mysql);
-extern const char* encryption_plugin_get_config();
-extern void encryption_plugin_prepare_init(int argc, char **argv);
-
-//extern void encryption_plugin_init(int argc, char **argv);
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index d7aca1362ed..7b268df2364 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -232,8 +232,8 @@ xb_fil_cur_open(
mysql_mutex_unlock(&fil_system.mutex);
}
- cursor->space_size = (ulint)(cursor->statinfo.st_size
- / cursor->page_size);
+ cursor->space_size = uint32_t(cursor->statinfo.st_size
+ / cursor->page_size);
cursor->read_filter = read_filter;
cursor->read_filter->init(&cursor->read_filter_ctxt, cursor,
@@ -441,8 +441,8 @@ read_retry:
"corrupted.%s", cursor->abs_path, ignore_corruption_warn);
ut_print_buf(stderr, page, page_size);
if (opt_log_innodb_page_corruption) {
- corrupted_pages.add_page(cursor->node->name, cursor->node->space->id,
- page_no);
+ corrupted_pages.add_page(cursor->node->name,
+ {cursor->node->space->id, page_no});
retry_count = 1;
}
else {
@@ -465,8 +465,9 @@ read_retry:
unsigned corrupted_page_no =
static_cast<unsigned>(strtoul(dbug_val, NULL, 10));
if (page_no == corrupted_page_no)
- corrupted_pages.add_page(cursor->node->name, cursor->node->space->id,
- corrupted_page_no);
+ corrupted_pages.add_page(cursor->node->name,
+ {cursor->node->space->id,
+ corrupted_page_no});
});
cursor->buf_read += page_size;
cursor->buf_npages++;
diff --git a/extra/mariabackup/fil_cur.h b/extra/mariabackup/fil_cur.h
index 0027b7768e9..6b868bf3edd 100644
--- a/extra/mariabackup/fil_cur.h
+++ b/extra/mariabackup/fil_cur.h
@@ -56,8 +56,8 @@ struct xb_fil_cur_t {
unsigned buf_page_no; /*!< number of the first page in
buffer */
uint thread_n; /*!< thread number for diagnostics */
- ulint space_id; /*!< ID of tablespace */
- ulint space_size; /*!< space size in pages */
+ uint32_t space_id; /*!< ID of tablespace */
+ uint32_t space_size; /*!< space size in pages */
/** @return whether this is not a file-per-table tablespace */
bool is_system() const
diff --git a/extra/mariabackup/read_filt.h b/extra/mariabackup/read_filt.h
index 2cd52d3d581..51150705367 100644
--- a/extra/mariabackup/read_filt.h
+++ b/extra/mariabackup/read_filt.h
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "changed_page_bitmap.h"
-typedef ulint space_id_t;
+typedef uint32_t space_id_t;
struct xb_fil_cur_t;
diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc
index 8339286e1df..01e4d83e344 100644
--- a/extra/mariabackup/write_filt.cc
+++ b/extra/mariabackup/write_filt.cc
@@ -124,8 +124,8 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile)
i++, page += page_size) {
if ((!cp->corrupted_pages ||
- !cp->corrupted_pages->contains(cursor->node->space->id,
- cursor->buf_page_no + i)) &&
+ !cp->corrupted_pages->contains({cursor->node->space->id,
+ cursor->buf_page_no + i})) &&
incremental_lsn >= mach_read_from_8(page + FIL_PAGE_LSN))
continue;
diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/xb_plugin.cc
index dbaa67e1324..3384e1c07e5 100644
--- a/extra/mariabackup/encryption_plugin.cc
+++ b/extra/mariabackup/xb_plugin.cc
@@ -17,7 +17,7 @@
#include <mysqld.h>
#include <mysql.h>
#include <xtrabackup.h>
-#include <encryption_plugin.h>
+#include <xb_plugin.h>
#include <sql_plugin.h>
#include <sstream>
#include <vector>
@@ -28,7 +28,7 @@
extern struct st_maria_plugin *mysql_optional_plugins[];
extern struct st_maria_plugin *mysql_mandatory_plugins[];
-static void encryption_plugin_init(int argc, char **argv);
+static void xb_plugin_init(int argc, char **argv);
extern char *xb_plugin_load;
extern char *xb_plugin_dir;
@@ -39,9 +39,10 @@ std::vector<std::string> backup_plugins_args;
const char *QUERY_PLUGIN =
"SELECT plugin_name, plugin_library, @@plugin_dir"
" FROM information_schema.plugins WHERE plugin_type='ENCRYPTION'"
+" OR (plugin_type = 'DAEMON' AND plugin_name LIKE 'provider\\_%')"
" AND plugin_status='ACTIVE'";
-std::string encryption_plugin_config;
+std::string xb_plugin_config;
static void add_to_plugin_load_list(const char *plugin_def)
{
@@ -51,16 +52,16 @@ static void add_to_plugin_load_list(const char *plugin_def)
static char XTRABACKUP_EXE[] = "xtrabackup";
/*
- Read "plugin-load" value (encryption plugin) from backup-my.cnf during
- prepare phase.
+ Read "plugin-load" value from backup-my.cnf during prepare phase.
The value is stored during backup phase.
*/
-static std::string get_encryption_plugin_from_cnf()
+static std::string get_plugin_from_cnf(const char *dir)
{
- FILE *f = fopen("backup-my.cnf", "r");
+ std::string path = dir + std::string("/backup-my.cnf");
+ FILE *f = fopen(path.c_str(), "r");
if (!f)
{
- die("Can't open backup-my.cnf for reading");
+ die("Can't open %s for reading", path.c_str());
}
char line[512];
std::string plugin_load;
@@ -79,82 +80,90 @@ static std::string get_encryption_plugin_from_cnf()
}
-void encryption_plugin_backup_init(MYSQL *mysql)
+void xb_plugin_backup_init(MYSQL *mysql)
{
MYSQL_RES *result;
MYSQL_ROW row;
std::ostringstream oss;
char *argv[PLUGIN_MAX_ARGS];
+ char show_query[1024] = "";
+ std::string plugin_load;
int argc;
result = xb_mysql_query(mysql, QUERY_PLUGIN, true, true);
- row = mysql_fetch_row(result);
- if (!row)
+ while ((row = mysql_fetch_row(result)))
{
- mysql_free_result(result);
- return;
- }
-
- char *name= row[0];
- char *library= row[1];
- char *dir= row[2];
+ char *name= row[0];
+ char *library= row[1];
+ char *dir= row[2];
+ if (!plugin_load.length())
+ {
#ifdef _WIN32
- for (char *p = dir; *p; p++)
- if (*p == '\\') *p = '/';
+ for (char *p = dir; *p; p++)
+ if (*p == '\\') *p = '/';
#endif
+ strncpy(opt_plugin_dir, dir, FN_REFLEN - 1);
+ opt_plugin_dir[FN_REFLEN - 1] = '\0';
+ oss << "plugin_dir=" << '"' << dir << '"' << std::endl;
+ }
- std::string plugin_load(name);
- if (library)
- {
- /* Remove shared library suffixes, in case we'll prepare on different OS.*/
- const char *extensions[] = { ".dll", ".so", 0 };
- for (size_t i = 0; extensions[i]; i++)
+ plugin_load += std::string(";") + name;
+
+ if (library)
{
- const char *ext = extensions[i];
- if (ends_with(library, ext))
- library[strlen(library) - strlen(ext)] = 0;
+ /* Remove shared library suffixes, in case we'll prepare on different OS.*/
+ const char *extensions[] = { ".dll", ".so", 0 };
+ for (size_t i = 0; extensions[i]; i++)
+ {
+ const char *ext = extensions[i];
+ if (ends_with(library, ext))
+ library[strlen(library) - strlen(ext)] = 0;
+ }
+ plugin_load += std::string("=") + library;
}
- plugin_load += std::string("=") + library;
- }
- oss << "plugin_load=" << plugin_load << std::endl;
+ if (strncmp(name, "provider_", 9) == 0)
+ continue;
- /* Required to load the plugin later.*/
- add_to_plugin_load_list(plugin_load.c_str());
- strncpy(opt_plugin_dir, dir, FN_REFLEN - 1);
- opt_plugin_dir[FN_REFLEN - 1] = '\0';
+ /* Read plugin variables. */
+ snprintf(show_query, sizeof(show_query), "SHOW variables like '%s_%%'", name);
+ }
+ mysql_free_result(result);
+ if (!plugin_load.length())
+ return;
- oss << "plugin_dir=" << '"' << dir << '"' << std::endl;
+ oss << "plugin_load=" << plugin_load.c_str() + 1 << std::endl;
+ /* Required to load the plugin later.*/
+ add_to_plugin_load_list(plugin_load.c_str() + 1);
- /* Read plugin variables. */
- char query[1024];
- snprintf(query, 1024, "SHOW variables like '%s_%%'", name);
- mysql_free_result(result);
- result = xb_mysql_query(mysql, query, true, true);
- while ((row = mysql_fetch_row(result)))
+ if (*show_query)
{
- std::string arg("--");
- arg += row[0];
- arg += "=";
- arg += row[1];
- backup_plugins_args.push_back(arg);
- oss << row[0] << "=" << row[1] << std::endl;
- }
+ result = xb_mysql_query(mysql, show_query, true, true);
+ while ((row = mysql_fetch_row(result)))
+ {
+ std::string arg("--");
+ arg += row[0];
+ arg += "=";
+ arg += row[1];
+ backup_plugins_args.push_back(arg);
+ oss << row[0] << "=" << row[1] << std::endl;
+ }
- mysql_free_result(result);
+ mysql_free_result(result);
- /* Check whether to encrypt logs. */
- result = xb_mysql_query(mysql, "select @@innodb_encrypt_log", true, true);
- row = mysql_fetch_row(result);
- srv_encrypt_log = (row != 0 && row[0][0] == '1');
- oss << "innodb_encrypt_log=" << row[0] << std::endl;
+ /* Check whether to encrypt logs. */
+ result = xb_mysql_query(mysql, "select @@innodb_encrypt_log", true, true);
+ row = mysql_fetch_row(result);
+ srv_encrypt_log = (row != 0 && row[0][0] == '1');
+ oss << "innodb_encrypt_log=" << row[0] << std::endl;
- mysql_free_result(result);
+ mysql_free_result(result);
+ }
- encryption_plugin_config = oss.str();
+ xb_plugin_config = oss.str();
argc = 0;
argv[argc++] = XTRABACKUP_EXE;
@@ -166,23 +175,23 @@ void encryption_plugin_backup_init(MYSQL *mysql)
}
argv[argc] = 0;
- encryption_plugin_init(argc, argv);
+ xb_plugin_init(argc, argv);
}
-const char *encryption_plugin_get_config()
+const char *xb_plugin_get_config()
{
- return encryption_plugin_config.c_str();
+ return xb_plugin_config.c_str();
}
extern int finalize_encryption_plugin(st_plugin_int *plugin);
-void encryption_plugin_prepare_init(int argc, char **argv)
+void xb_plugin_prepare_init(int argc, char **argv, const char *dir)
{
- std::string plugin_load= get_encryption_plugin_from_cnf();
+ std::string plugin_load= get_plugin_from_cnf(dir ? dir : ".");
if (plugin_load.size())
{
- msg("Loading encryption plugin from %s", plugin_load.c_str());
+ msg("Loading plugins from %s", plugin_load.c_str());
}
else
{
@@ -198,23 +207,23 @@ void encryption_plugin_prepare_init(int argc, char **argv)
opt_plugin_dir[FN_REFLEN - 1] = '\0';
}
- char **new_argv = new char *[argc + 1];
+ char **new_argv = new char *[argc + 2];
new_argv[0] = XTRABACKUP_EXE;
memcpy(&new_argv[1], argv, argc*sizeof(char *));
- encryption_plugin_init(argc+1, new_argv);
+ xb_plugin_init(argc+1, new_argv);
delete[] new_argv;
}
-static void encryption_plugin_init(int argc, char **argv)
+static void xb_plugin_init(int argc, char **argv)
{
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */
- msg("Loading encryption plugin");
+ msg("Loading plugins");
for (int i= 1; i < argc; i++)
- msg("\t Encryption plugin parameter : '%s'", argv[i]);
+ msg("\t Plugin parameter : '%s'", argv[i]);
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
}
diff --git a/extra/mariabackup/xb_plugin.h b/extra/mariabackup/xb_plugin.h
new file mode 100644
index 00000000000..fea24b6b052
--- /dev/null
+++ b/extra/mariabackup/xb_plugin.h
@@ -0,0 +1,5 @@
+#include <mysql.h>
+#include <string>
+extern void xb_plugin_backup_init(MYSQL *mysql);
+extern const char* xb_plugin_get_config();
+extern void xb_plugin_prepare_init(int argc, char **argv, const char *dir);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 81f24337952..3a0db1401ad 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -107,7 +107,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "backup_mysql.h"
#include "backup_copy.h"
#include "backup_mysql.h"
-#include "encryption_plugin.h"
+#include "xb_plugin.h"
#include <sql_plugin.h>
#include <srv0srv.h>
#include <log.h>
@@ -417,45 +417,45 @@ CorruptedPages::CorruptedPages() { ut_a(!pthread_mutex_init(&m_mutex, NULL)); }
CorruptedPages::~CorruptedPages() { ut_a(!pthread_mutex_destroy(&m_mutex)); }
-void CorruptedPages::add_page_no_lock(const char *space_name, ulint space_id,
- unsigned page_no,
+void CorruptedPages::add_page_no_lock(const char *space_name,
+ page_id_t page_id,
bool convert_space_name)
{
- space_info_t &space_info = m_spaces[space_id];
+ space_info_t &space_info = m_spaces[page_id.space()];
if (space_info.space_name.empty())
space_info.space_name= convert_space_name
? filename_to_spacename(space_name, strlen(space_name))
: space_name;
- (void)space_info.pages.insert(page_no);
+ (void)space_info.pages.insert(page_id.page_no());
}
-void CorruptedPages::add_page(const char *file_name, ulint space_id,
- unsigned page_no)
+void CorruptedPages::add_page(const char *file_name, page_id_t page_id)
{
- ut_a(!pthread_mutex_lock(&m_mutex));
- add_page_no_lock(file_name, space_id, page_no, true);
- ut_a(!pthread_mutex_unlock(&m_mutex));
+ pthread_mutex_lock(&m_mutex);
+ add_page_no_lock(file_name, page_id, true);
+ pthread_mutex_unlock(&m_mutex);
}
-bool CorruptedPages::contains(ulint space_id, unsigned page_no) const
+bool CorruptedPages::contains(page_id_t page_id) const
{
bool result = false;
ut_a(!pthread_mutex_lock(&m_mutex));
- container_t::const_iterator space_it= m_spaces.find(space_id);
+ container_t::const_iterator space_it= m_spaces.find(page_id.space());
if (space_it != m_spaces.end())
- result = space_it->second.pages.count(page_no);
+ result = space_it->second.pages.count(page_id.page_no());
ut_a(!pthread_mutex_unlock(&m_mutex));
return result;
}
-void CorruptedPages::drop_space(ulint space_id)
+void CorruptedPages::drop_space(uint32_t space_id)
{
ut_a(!pthread_mutex_lock(&m_mutex));
m_spaces.erase(space_id);
ut_a(!pthread_mutex_unlock(&m_mutex));
}
-void CorruptedPages::rename_space(ulint space_id, const std::string &new_name)
+void CorruptedPages::rename_space(uint32_t space_id,
+ const std::string &new_name)
{
ut_a(!pthread_mutex_lock(&m_mutex));
container_t::iterator space_it = m_spaces.find(space_id);
@@ -516,7 +516,7 @@ void CorruptedPages::read_from_file(const char *file_name)
strerror(errno));
std::string line;
std::string space_name;
- ulint space_id;
+ uint32_t space_id;
ulint line_number= 0;
while (std::getline(infile, line))
{
@@ -536,7 +536,7 @@ void CorruptedPages::read_from_file(const char *file_name)
std::istringstream iss(line);
unsigned page_no;
while ((iss >> page_no))
- add_page_no_lock(space_name.c_str(), space_id, page_no, false);
+ add_page_no_lock(space_name.c_str(), {space_id, page_no}, false);
if (!iss.eof())
die("Corrupted pages file parse error on line number " ULINTPF,
line_number);
@@ -554,7 +554,7 @@ bool CorruptedPages::empty() const
static void xb_load_single_table_tablespace(const std::string &space_name,
bool set_size,
- ulint defer_space_id=0);
+ uint32_t defer_space_id=0);
static void xb_data_files_close();
static fil_space_t* fil_space_get_by_name(const char* name);
@@ -569,7 +569,7 @@ void CorruptedPages::zero_out_free_pages()
for (container_t::const_iterator space_it= m_spaces.begin();
space_it != m_spaces.end(); ++space_it)
{
- ulint space_id = space_it->first;
+ uint32_t space_id = space_it->first;
const std::string &space_name = space_it->second.space_name;
// There is no need to close tablespaces explixitly as they will be closed
// in innodb_shutdown().
@@ -632,7 +632,7 @@ typedef void (*process_single_tablespace_func_t)(const char *dirname,
const char *filname,
bool is_remote,
bool skip_node_page0,
- ulint defer_space_id);
+ uint32_t defer_space_id);
static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback);
/* ======== Datafiles iterator ======== */
@@ -822,7 +822,7 @@ static std::string filename_to_spacename(const void *filename, size_t len)
@param[in] len length of name, in bytes
@param[in] new_name new file name (NULL if not rename)
@param[in] new_len length of new_name, in bytes (0 if NULL) */
-static void backup_file_op(ulint space_id, int type,
+static void backup_file_op(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len)
{
@@ -838,7 +838,7 @@ static void backup_file_op(ulint space_id, int type,
std::string space_name = filename_to_spacename(name, len);
ddl_tracker.id_to_name[space_id] = space_name;
ddl_tracker.delete_defer(space_id, space_name);
- msg("DDL tracking : create %zu \"%.*s\"", space_id, int(len), name);
+ msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name);
}
break;
case FILE_MODIFY:
@@ -854,7 +854,7 @@ static void backup_file_op(ulint space_id, int type,
ddl_tracker.id_to_name[space_id] = new_space_name;
ddl_tracker.rename_defer(space_id, old_space_name,
new_space_name);
- msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"",
+ msg("DDL tracking : rename %u \"%.*s\",\"%.*s\"",
space_id, int(len), name, int(new_len), new_name);
}
break;
@@ -862,7 +862,7 @@ static void backup_file_op(ulint space_id, int type,
ddl_tracker.drops.insert(space_id);
ddl_tracker.delete_defer(
space_id, filename_to_spacename(name, len));
- msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
+ msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name);
break;
default:
ut_ad(0);
@@ -881,21 +881,21 @@ static void backup_file_op(ulint space_id, int type,
We will abort backup in this case.
*/
-static void backup_file_op_fail(ulint space_id, int type,
+static void backup_file_op_fail(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len)
{
bool fail = false;
switch(type) {
case FILE_CREATE:
- msg("DDL tracking : create %zu \"%.*s\"", space_id, int(len), name);
+ msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name);
fail = !check_if_skip_table(
filename_to_spacename(name, len).c_str());
break;
case FILE_MODIFY:
break;
case FILE_RENAME:
- msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"",
+ msg("DDL tracking : rename %u \"%.*s\",\"%.*s\"",
space_id, int(len), name, int(new_len), new_name);
fail = !check_if_skip_table(
filename_to_spacename(name, len).c_str())
@@ -905,7 +905,7 @@ static void backup_file_op_fail(ulint space_id, int type,
case FILE_DELETE:
fail = !check_if_skip_table(
filename_to_spacename(name, len).c_str());
- msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
+ msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name);
break;
default:
ut_ad(0);
@@ -921,7 +921,7 @@ static void backup_file_op_fail(ulint space_id, int type,
/* Function to store the space id of page0 INIT_PAGE
@param space_id space id which has page0 init page */
-static void backup_first_page_op(ulint space_id)
+static void backup_first_page_op(space_id_t space_id)
{
first_page_init_ids.insert(space_id);
}
@@ -1636,7 +1636,7 @@ struct my_option xb_server_options[] =
{"innodb_undo_tablespaces", OPT_INNODB_UNDO_TABLESPACES,
"Number of undo tablespaces to use.",
(G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
- 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
+ 0, GET_UINT, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
{"innodb_compression_level", OPT_INNODB_COMPRESSION_LEVEL,
"Compression level used for zlib compression.",
@@ -1648,10 +1648,10 @@ struct my_option xb_server_options[] =
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"plugin-dir", OPT_PLUGIN_DIR,
- "Server plugin directory. Used to load encryption plugin during 'prepare' phase."
- "Has no effect in the 'backup' phase (plugin directory during backup is the same as server's)",
- &xb_plugin_dir, &xb_plugin_dir,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ "Server plugin directory. Used to load plugins during 'prepare' phase."
+ "Has no effect in the 'backup' phase (plugin directory during backup is the same as server's)",
+ &xb_plugin_dir, &xb_plugin_dir,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file "
"descriptors to reserve with setrlimit().",
@@ -1707,7 +1707,7 @@ static std::set<std::string> tables_for_export;
static void append_export_table(const char *dbname, const char *tablename,
bool is_remote, bool skip_node_page0,
- ulint defer_space_id)
+ uint32_t defer_space_id)
{
if(dbname && tablename && !is_remote)
{
@@ -2043,7 +2043,7 @@ static bool innodb_init_param()
size_t n_shift = get_bit_shift(size_t(innobase_page_size));
if (n_shift >= 12 && n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX) {
- srv_page_size_shift = ulong(n_shift);
+ srv_page_size_shift = uint32_t(n_shift);
srv_page_size = 1U << n_shift;
msg("InnoDB: The universal page size of the "
"database is set to %lu.", srv_page_size);
@@ -2397,7 +2397,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
/* set defaults */
ulint page_size = ULINT_UNDEFINED, zip_size = 0;
- info->space_id = ULINT_UNDEFINED;
+ info->space_id = UINT32_MAX;
fp = fopen(filepath, "r");
if (!fp) {
@@ -2412,7 +2412,8 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
} else if (strcmp(key, "zip_size") == 0) {
zip_size = strtoul(value, NULL, 10);
} else if (strcmp(key, "space_id") == 0) {
- info->space_id = strtoul(value, NULL, 10);
+ info->space_id = static_cast<uint32_t>
+ (strtoul(value, NULL, 10));
}
}
}
@@ -2427,7 +2428,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
info->zip_size = zip_size;
}
- if (info->space_id == ULINT_UNDEFINED) {
+ if (info->space_id == UINT32_MAX) {
msg("mariabackup: Warning: This backup was taken with XtraBackup 2.0.1 "
"or earlier, some DDL operations between full and incremental "
"backups may be handled incorrectly");
@@ -2451,7 +2452,7 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info)
snprintf(buf, sizeof(buf),
"page_size = " ULINTPF "\n"
"zip_size = " ULINTPF " \n"
- "space_id = " ULINTPF "\n",
+ "space_id = %u\n",
info->page_size,
info->zip_size,
info->space_id);
@@ -3316,7 +3317,7 @@ static void xb_load_single_table_tablespace(const char *dirname,
const char *filname,
bool is_remote,
bool skip_node_page0,
- ulint defer_space_id)
+ uint32_t defer_space_id)
{
ut_ad(srv_operation == SRV_OPERATION_BACKUP
|| srv_operation == SRV_OPERATION_RESTORE_DELTA
@@ -3413,7 +3414,8 @@ static void xb_load_single_table_tablespace(const char *dirname,
0, false, false);
node->deferred= defer;
mysql_mutex_lock(&fil_system.mutex);
- space->read_page0();
+ if (!space->read_page0())
+ err= DB_CANNOT_OPEN_FILE;
mysql_mutex_unlock(&fil_system.mutex);
if (srv_operation == SRV_OPERATION_RESTORE_DELTA
@@ -3433,7 +3435,7 @@ static void xb_load_single_table_tablespace(const char *dirname,
static void xb_load_single_table_tablespace(const std::string &space_name,
bool skip_node_page0,
- ulint defer_space_id)
+ uint32_t defer_space_id)
{
std::string name(space_name);
bool is_remote= access((name + ".ibd").c_str(), R_OK) != 0;
@@ -3812,9 +3814,9 @@ static dberr_t xb_assign_undo_space_start()
pfs_os_file_t file;
bool ret;
dberr_t error = DB_SUCCESS;
- ulint space;
+ uint32_t space;
+ uint32_t fsp_flags;
int n_retries = 5;
- ulint fsp_flags;
file = os_file_create(0, srv_sys_space.first_datafile()->filepath(),
OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
@@ -3835,7 +3837,7 @@ static dberr_t xb_assign_undo_space_start()
}
fsp_flags = mach_read_from_4(
- page + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
+ page + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
retry:
if (os_file_read(IORequestRead, file, page,
TRX_SYS_PAGE_NO << srv_page_size_shift,
@@ -3885,7 +3887,7 @@ static void xb_close_undo_tablespaces()
{
if (srv_undo_space_id_start == 0)
return;
- for (ulint space_id= srv_undo_space_id_start;
+ for (uint32_t space_id= srv_undo_space_id_start;
space_id < srv_undo_space_id_start + srv_undo_tablespaces_open;
space_id++)
{
@@ -4509,7 +4511,7 @@ static bool xtrabackup_backup_func()
return(false);
}
msg("cd to %s", mysql_real_data_home);
- encryption_plugin_backup_init(mysql_connection);
+ xb_plugin_backup_init(mysql_connection);
msg("open files limit requested %lu, set to %lu",
xb_open_files_limit,
xb_set_max_open_files(xb_open_files_limit));
@@ -4875,7 +4877,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages)
iter++) {
const std::string name = iter->second;
- ulint id = iter->first;
+ uint32_t id = iter->first;
if (ddl_tracker.drops.find(id) != ddl_tracker.drops.end()) {
dropped_tables.insert(name);
@@ -4901,7 +4903,7 @@ void backup_fix_ddl(CorruptedPages &corrupted_pages)
iter != ddl_tracker.id_to_name.end();
iter++) {
- ulint id = iter->first;
+ uint32_t id = iter->first;
std::string name = iter->second;
if (ddl_tracker.tables_in_backup.find(id) != ddl_tracker.tables_in_backup.end()) {
@@ -5049,8 +5051,8 @@ bool
xb_space_create_file(
/*==================*/
const char* path, /*!<in: path to tablespace */
- ulint space_id, /*!<in: space id */
- ulint flags, /*!<in: tablespace flags */
+ uint32_t space_id, /*!<in: space id */
+ uint32_t flags, /*!<in: tablespace flags */
pfs_os_file_t* file) /*!<out: file handle */
{
bool ret;
@@ -5113,7 +5115,7 @@ xb_delta_open_matching_space(
ut_a(dbname != NULL ||
!fil_is_user_tablespace_id(info.space_id) ||
- info.space_id == ULINT_UNDEFINED);
+ info.space_id == UINT32_MAX);
*success = false;
@@ -5189,14 +5191,14 @@ exit:
if (fil_space != NULL) {
if (fil_space->id == info.space_id
- || info.space_id == ULINT_UNDEFINED) {
+ || info.space_id == UINT32_MAX) {
/* we found matching space */
goto found;
} else {
char tmpname[FN_REFLEN];
- snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#" ULINTPF,
+ snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#%u",
dbname, fil_space->id);
msg("mariabackup: Renaming %s to %s.ibd",
@@ -5210,7 +5212,7 @@ exit:
}
}
- if (info.space_id == ULINT_UNDEFINED)
+ if (info.space_id == UINT32_MAX)
{
die("Can't handle DDL operation on tablespace "
"%s\n", dest_space_name);
@@ -5236,7 +5238,7 @@ exit:
}
/* No matching space found. create the new one. */
- const ulint flags = info.zip_size
+ const uint32_t flags = info.zip_size
? get_bit_shift(info.page_size
>> (UNIV_ZIP_SIZE_SHIFT_MIN - 1))
<< FSP_FLAGS_POS_ZIP_SSIZE
@@ -5931,7 +5933,7 @@ static bool xtrabackup_prepare_func(char** argv)
}
int argc; for (argc = 0; argv[argc]; argc++) {}
- encryption_plugin_prepare_init(argc, argv);
+ xb_plugin_prepare_init(argc, argv, xtrabackup_incremental_dir);
xtrabackup_target_dir= mysql_data_home_buff;
xtrabackup_target_dir[0]=FN_CURLIB; // all paths are relative from here
@@ -6495,12 +6497,17 @@ void handle_options(int argc, char **argv, char ***argv_server,
{
prepare= true;
}
- else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) &&
+ else if (!strncmp(argv[i], "--incremental-dir", optend - argv[i]) &&
*optend)
{
target_dir= optend + 1;
}
- else if (!*optend && argv[i][0] != '-')
+ else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) &&
+ *optend && !target_dir)
+ {
+ target_dir= optend + 1;
+ }
+ else if (!*optend && argv[i][0] != '-' && !target_dir)
{
target_dir= argv[i];
}
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 37cc54e5abb..f2d76ff4103 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -29,12 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
struct xb_delta_info_t
{
- xb_delta_info_t(ulint page_size, ulint zip_size, ulint space_id)
+ xb_delta_info_t(ulint page_size, ulint zip_size, uint32_t space_id)
: page_size(page_size), zip_size(zip_size), space_id(space_id) {}
ulint page_size;
ulint zip_size;
- ulint space_id;
+ uint32_t space_id;
};
class CorruptedPages
@@ -42,23 +42,23 @@ class CorruptedPages
public:
CorruptedPages();
~CorruptedPages();
- void add_page(const char *file_name, ulint space_id, unsigned page_no);
- bool contains(ulint space_id, unsigned page_no) const;
- void drop_space(ulint space_id);
- void rename_space(ulint space_id, const std::string &new_name);
+ void add_page(const char *file_name, page_id_t page_id);
+ bool contains(page_id_t page_id) const;
+ void drop_space(uint32_t space_id);
+ void rename_space(uint32_t space_id, const std::string &new_name);
bool print_to_file(const char *file_name) const;
void read_from_file(const char *file_name);
bool empty() const;
void zero_out_free_pages();
private:
- void add_page_no_lock(const char *space_name, ulint space_id,
- unsigned page_no, bool convert_space_name);
+ void add_page_no_lock(const char *space_name, page_id_t page_id,
+ bool convert_space_name);
struct space_info_t {
std::string space_name;
- std::set<unsigned> pages;
+ std::set<uint32_t> pages;
};
- typedef std::map<ulint, space_info_t> container_t;
+ typedef std::map<uint32_t, space_info_t> container_t;
mutable pthread_mutex_t m_mutex;
container_t m_spaces;
};
diff --git a/include/hash.h b/include/hash.h
index 00ffca503fc..c0a846ac120 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -64,8 +64,8 @@ typedef struct st_hash {
typedef uint HASH_SEARCH_STATE;
#define my_hash_init(A,B,C,D,E,F,G,H,I) my_hash_init2(A,B,0,C,D,E,F,G,0,H,I)
-my_bool my_hash_init2(PSI_memory_key psi_key, HASH *hash, uint growth_size,
- CHARSET_INFO *charset, ulong default_array_elements,
+my_bool my_hash_init2(PSI_memory_key psi_key, HASH *hash, size_t growth_size,
+ CHARSET_INFO *charset, size_t default_array_elements,
size_t key_offset, size_t key_length,
my_hash_get_key get_key, my_hash_function hash_function,
void (*free_element)(void*), uint flags);
diff --git a/include/ilist.h b/include/ilist.h
index 45c0bbf7d2c..265f0e2d57e 100644
--- a/include/ilist.h
+++ b/include/ilist.h
@@ -107,6 +107,10 @@ public:
}
reference operator*() noexcept { return *static_cast<pointer>(node_); }
+ const_reference operator*() const noexcept
+ {
+ return *static_cast<pointer>(node_);
+ }
pointer operator->() noexcept { return static_cast<pointer>(node_); }
friend bool operator==(const Iterator &lhs, const Iterator &rhs) noexcept
diff --git a/include/json_lib.h b/include/json_lib.h
index e570e2a9d17..ea7f102fd02 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -1,6 +1,8 @@
#ifndef JSON_LIB_INCLUDED
#define JSON_LIB_INCLUDED
+#include <my_sys.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -172,7 +174,7 @@ enum json_states {
enum json_value_types
{
- JSON_VALUE_UNINITALIZED=0,
+ JSON_VALUE_UNINITIALIZED=0,
JSON_VALUE_OBJECT=1,
JSON_VALUE_ARRAY=2,
JSON_VALUE_STRING=3,
@@ -432,6 +434,9 @@ int json_locate_key(const char *js, const char *js_end,
const char **key_start, const char **key_end,
int *comma_pos);
+int json_normalize(DYNAMIC_STRING *result,
+ const char *s, size_t size, CHARSET_INFO *cs);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mariadb_capi_rename.h b/include/mariadb_capi_rename.h
index 616a9142fe6..58e16fdc0c0 100644
--- a/include/mariadb_capi_rename.h
+++ b/include/mariadb_capi_rename.h
@@ -22,7 +22,7 @@
#ifndef MARIADB_CAPI_RENAME_INCLUDED
#define MARIADB_CAPI_RENAME_INCLUDED
-#if !defined(EMBEDDED_LIBRARY)
+#if !defined(EMBEDDED_LIBRARY) && !defined(MYSQL_DYNAMIC_PLUGIN)
#define MARIADB_ADD_PREFIX(_SYMBOL) server_##_SYMBOL
#define mysql_real_connect MARIADB_ADD_PREFIX(mysql_real_connect)
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 181f637c093..944dcb6e1bd 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -20,7 +20,7 @@
#ifndef _my_alloc_h
#define _my_alloc_h
-#include <mysql/psi/psi_memory.h>
+#include "mysql/psi/psi_base.h"
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
@@ -50,11 +50,12 @@ typedef struct st_mem_root
first free block in queue test counter (if it exceed
MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
*/
- unsigned int first_block_usage;
+ unsigned short first_block_usage;
+ unsigned short flags;
void (*error_handler)(void);
- PSI_memory_key m_psi_key;
+ PSI_memory_key psi_key;
} MEM_ROOT;
#ifdef __cplusplus
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index f19254404c1..f88a6fe8d9d 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -28,12 +28,6 @@ typedef struct st_bitmap
{
my_bitmap_map *bitmap;
my_bitmap_map *last_word_ptr;
- /*
- mutex will be acquired for the duration of each bitmap operation if
- thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
- acquiring the mutex
- */
- mysql_mutex_t *mutex;
my_bitmap_map last_word_mask;
uint32 n_bits; /* number of bits occupied by the above */
} MY_BITMAP;
@@ -42,15 +36,11 @@ typedef struct st_bitmap
extern "C" {
#endif
-/* compatibility functions */
-#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
-#define bitmap_free(A) my_bitmap_free(A)
/* Reset memory. Faster then doing a full bzero */
#define my_bitmap_clear(A) ((A)->bitmap= 0)
extern void create_last_word_mask(MY_BITMAP *map);
-extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
- my_bool thread_safe);
+extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
@@ -82,8 +72,6 @@ extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_invert(MY_BITMAP *map);
extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2);
-extern uint bitmap_lock_set_next(MY_BITMAP *map);
-extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit);
/* Fast, not thread safe, bitmap functions */
#define bitmap_buffer_size(bits) (((bits)+31)/32)*4
#define no_bytes_in_map(map) (((map)->n_bits + 7)/8)
diff --git a/include/my_dbug.h b/include/my_dbug.h
index b4b16d653b5..02caadbff48 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -104,10 +104,9 @@ extern int (*dbug_sanity)(void);
do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \
do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0)
-#define DBUG_EVALUATE(keyword,a1,a2) \
- (_db_keyword_(0,(keyword), 0) ? (a1) : (a2))
-#define DBUG_EVALUATE_IF(keyword,a1,a2) \
- (_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
+
+#define DBUG_IF(keyword) _db_keyword_(0, (keyword), 1)
+
#define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); }
#define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); }
#define DBUG_PUSH(a1) _db_push_ (a1)
@@ -174,8 +173,7 @@ extern void _db_suicide_(void);
#define DBUG_PRINT(keyword, arglist) do { } while(0)
#define DBUG_EXECUTE(keyword,a1) do { } while(0)
#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
-#define DBUG_EVALUATE(keyword,a1,a2) (a2)
-#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
+#define DBUG_IF(keyword) 0
#define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH_EMPTY do { } while(0)
#define DBUG_POP_EMPTY do { } while(0)
@@ -201,7 +199,7 @@ extern void _db_suicide_(void);
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
-#define DBUG_SUICIDE() do { } while(0)
+#define DBUG_SUICIDE() ((void) 0)
#ifdef DBUG_ASSERT_AS_PRINTF
extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file, unsigned long line);
diff --git a/include/my_dir.h b/include/my_dir.h
index 930d54ca72f..12cf5db149d 100644
--- a/include/my_dir.h
+++ b/include/my_dir.h
@@ -94,13 +94,13 @@ typedef struct fileinfo
typedef struct st_my_dir /* Struct returned from my_dir */
{
/*
- These members are just copies of parts of DYNAMIC_ARRAY structure,
+ These members are just copies of parts of DYNAMIC_ARRAY structure,
which is allocated right after the end of MY_DIR structure (MEM_ROOT
for storing names is also resides there). We've left them here because
we don't want to change code that uses my_dir.
*/
struct fileinfo *dir_entry;
- uint number_of_files;
+ size_t number_of_files;
} MY_DIR;
extern MY_DIR *my_dir(const char *path,myf MyFlags);
diff --git a/include/my_sys.h b/include/my_sys.h
index 0a6e6088067..0f49077b6d0 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -94,6 +94,7 @@ C_MODE_START
#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */
#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
+#define MY_ROOT_USE_MPROTECT 0x20000U /* init_alloc_root: read only segments */
/* Tree that should delete things automatically */
#define MY_TREE_WITH_DELETE 0x40000U
@@ -284,6 +285,7 @@ extern my_bool my_disable_async_io,
extern my_bool my_disable_sync, my_disable_copystat_in_redel;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
+extern size_t my_system_page_size;
enum cache_type
{
@@ -343,9 +345,9 @@ typedef void (*FREE_FUNC)(void *);
typedef struct st_dynamic_array
{
uchar *buffer;
- uint elements,max_element;
- uint alloc_increment;
- uint size_of_element;
+ size_t elements, max_element;
+ size_t alloc_increment;
+ size_t size_of_element;
PSI_memory_key m_psi_key;
myf malloc_flags;
} DYNAMIC_ARRAY;
@@ -354,7 +356,7 @@ typedef struct st_my_tmpdir
{
DYNAMIC_ARRAY full_list;
char **list;
- uint cur, max;
+ size_t cur, max;
mysql_mutex_t mutex;
} MY_TMPDIR;
@@ -834,18 +836,18 @@ File create_temp_file(char *to, const char *dir, const char *pfx,
#define my_init_dynamic_array(A,B,C,D,E,F) init_dynamic_array2(A,B,C,NULL,D,E,F)
#define my_init_dynamic_array2(A,B,C,D,E,F,G) init_dynamic_array2(A,B,C,D,E,F,G)
extern my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array,
- uint element_size, void *init_buffer,
- uint init_alloc, uint alloc_increment,
+ size_t element_size, void *init_buffer,
+ size_t init_alloc, size_t alloc_increment,
myf my_flags);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element);
extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
extern void *pop_dynamic(DYNAMIC_ARRAY*);
extern my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element,
- uint array_index);
-extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
-extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint array_index);
+ size_t array_index);
+extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, size_t max_elements);
+extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, size_t array_index);
extern void delete_dynamic(DYNAMIC_ARRAY *array);
-extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
+extern void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t array_index);
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
extern void freeze_size(DYNAMIC_ARRAY *array);
extern int get_index_dynamic(DYNAMIC_ARRAY *array, void *element);
@@ -887,7 +889,6 @@ extern void my_free_lock(void *ptr);
#define my_free_lock(A) my_free((A))
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
-#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
size_t block_size, size_t pre_alloc_size,
@@ -898,6 +899,7 @@ extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
size_t prealloc_size);
+extern void protect_root(MEM_ROOT *root, int prot);
extern char *strdup_root(MEM_ROOT *root,const char *str);
static inline char *safe_strdup_root(MEM_ROOT *root, const char *str)
{
@@ -1031,15 +1033,28 @@ int my_getpagesize(void);
int my_msync(int, void *, size_t, int);
#define MY_UUID_SIZE 16
-#define MY_UUID_STRING_LENGTH (8+1+4+1+4+1+4+1+12)
-#define MY_UUID_ORACLE_STRING_LENGTH (8+4+4+4+12)
+#define MY_UUID_BARE_STRING_LENGTH (8+4+4+4+12)
+#define MY_UUID_SEPARATORS 4
+#define MY_UUID_STRING_LENGTH (MY_UUID_BARE_STRING_LENGTH + MY_UUID_SEPARATORS)
void my_uuid_init(ulong seed1, ulong seed2);
void my_uuid(uchar *guid);
-void my_uuid2str(const uchar *guid, char *s);
-void my_uuid2str_oracle(const uchar *guid, char *s);
void my_uuid_end(void);
+static inline void my_uuid2str(const uchar *guid, char *s, int with_separators)
+{
+ int i;
+ int mask= with_separators ? ((1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)) : 0;
+ for (i=0; i < MY_UUID_SIZE; i++, mask >>= 1)
+ {
+ *s++= _dig_vec_lower[guid[i] >>4];
+ *s++= _dig_vec_lower[guid[i] & 15];
+ if (mask & 1)
+ *s++= '-';
+ }
+}
+
+
const char *my_dlerror(const char *dlpath);
/* character sets */
diff --git a/include/mysql.h b/include/mysql.h
index 5088d800f87..46ddc4b9ed9 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -141,6 +141,8 @@ typedef unsigned long long my_ulonglong;
#define ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN
#define ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
#define ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS
+#define ER_KEY_COLUMN_DOES_NOT_EXITS ER_KEY_COLUMN_DOES_NOT_EXIST
+#define ER_DROP_PARTITION_NON_EXISTENT ER_PARTITION_DOES_NOT_EXIST
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */
@@ -323,7 +325,15 @@ typedef struct st_mysql_res {
} MYSQL_RES;
-#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
+/*
+ We should not define MYSQL_CLIENT when the mysql.h is included
+ by the server or server plugins.
+ Now it is important only for the SQL service to work so we rely on
+ the MYSQL_SERVICE_SQL to check we're compiling the server/plugin
+ related file.
+*/
+
+#if !defined(MYSQL_SERVICE_SQL) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
@@ -355,7 +365,7 @@ typedef struct st_mysql_parameters
*/
#define MYSQL_WAIT_TIMEOUT 8
-#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
+#if !defined(MYSQL_SERVICE_SQL)
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index cc0943e4382..6ef0afb980b 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -77,7 +77,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x010f
/*
The allowable types of plugins
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 2e0cdff4b50..d1e9580a053 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 464c5514acb..2c89bc47de3 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_data_type.h.pp b/include/mysql/plugin_data_type.h.pp
index cb256e00cd7..bd4ef6af15f 100644
--- a/include/mysql/plugin_data_type.h.pp
+++ b/include/mysql/plugin_data_type.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 11cd622861c..96100d3791b 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 9a798627518..4760e31c4bd 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_function.h.pp b/include/mysql/plugin_function.h.pp
index 4b2a0fc7082..5c1f34d8184 100644
--- a/include/mysql/plugin_function.h.pp
+++ b/include/mysql/plugin_function.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h
index 23d2c884012..94d6c63967f 100644
--- a/include/mysql/plugin_password_validation.h
+++ b/include/mysql/plugin_password_validation.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100
+#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0101
/**
Password validation plugin descriptor
@@ -43,7 +43,8 @@ struct st_mariadb_password_validation
and return 0 if the password has passed the validation.
*/
int (*validate_password)(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password);
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname);
};
#ifdef __cplusplus
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index eae776a753b..a56a177b8fa 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
@@ -629,6 +655,7 @@ struct st_mariadb_password_validation
{
int interface_version;
int (*validate_password)(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password);
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname);
};
}
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index 2dc27e09ca4..ca0d0206cb9 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v1
{
PSI_memory_key *m_key;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index a670e53a8b7..9188954885f 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v2
{
int placeholder;
diff --git a/include/mysql/psi/psi_base.h b/include/mysql/psi/psi_base.h
index 592aaf58fef..c04f817b2c1 100644
--- a/include/mysql/psi/psi_base.h
+++ b/include/mysql/psi/psi_base.h
@@ -170,6 +170,13 @@ extern "C" {
/** @} */
+/**
+ Instrumented memory key.
+ To instrument memory, a memory key must be obtained using @c register_memory.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_memory_key;
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/psi/psi_memory.h b/include/mysql/psi/psi_memory.h
index 4f5215d1808..21a86a36368 100644
--- a/include/mysql/psi/psi_memory.h
+++ b/include/mysql/psi/psi_memory.h
@@ -53,13 +53,6 @@ extern "C" {
struct PSI_thread;
-/**
- Instrumented memory key.
- To instrument memory, a memory key must be obtained using @c register_memory.
- Using a zero key always disable the instrumentation.
-*/
-typedef unsigned int PSI_memory_key;
-
#ifdef HAVE_PSI_1
/**
diff --git a/include/mysql/service_sql.h b/include/mysql/service_sql.h
new file mode 100644
index 00000000000..be9dcad669e
--- /dev/null
+++ b/include/mysql/service_sql.h
@@ -0,0 +1,115 @@
+/* Copyright (C) 2021 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 */
+
+#ifndef MYSQL_SERVICE_SQL
+#define MYSQL_SERVICE_SQL
+
+#ifndef MYSQL_ABI_CHECK
+#include <mysql.h>
+#endif
+
+/**
+ @file
+ SQL service
+
+ Interface for plugins to execute SQL queries on the local server.
+
+ Functions of the service are the 'server-limited' client library:
+ mysql_init
+ mysql_real_connect_local
+ mysql_real_connect
+ mysql_errno
+ mysql_error
+ mysql_real_query
+ mysql_affected_rows
+ mysql_num_rows
+ mysql_store_result
+ mysql_free_result
+ mysql_fetch_row
+ mysql_close
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define mysql_init(M) sql_service->mysql_init_func(M)
+#define mysql_real_connect_local(M) sql_service->mysql_real_connect_local_func(M)
+#define mysql_real_connect(M,H,U,PW,D,P,S,F) sql_service->mysql_real_connect_func(M,H,U,PW,D,P,S,F)
+#define mysql_errno(M) sql_service->mysql_errno_func(M)
+#define mysql_error(M) sql_service->mysql_error_func(M)
+#define mysql_real_query sql_service->mysql_real_query_func
+#define mysql_affected_rows(M) sql_service->mysql_affected_rows_func(M)
+#define mysql_num_rows(R) sql_service->mysql_num_rows_func(R)
+#define mysql_store_result(M) sql_service->mysql_store_result_func(M)
+#define mysql_free_result(R) sql_service->mysql_free_result_func(R)
+#define mysql_fetch_row(R) sql_service->mysql_fetch_row_func(R)
+#define mysql_close(M) sql_service->mysql_close_func(M)
+#define mysql_options(M,O,V) sql_service->mysql_options_func(M,O,V)
+#define mysql_fetch_lengths(R) sql_service->mysql_fetch_lengths_func(R)
+#define mysql_set_character_set(M,C) sql_service->mysql_set_character_set_func(M,C)
+#define mysql_num_fields(R) sql_service->mysql_num_fields_func(R)
+#define mysql_select_db(M,D) sql_service->mysql_select_db_func(M,D)
+
+#else
+
+/*
+ Establishes the connection to the 'local' server that started the plugin.
+ Like the mysql_real_connect() does for the remote server.
+ The established connection has no user/host associated to it,
+ neither it has the current db, so the queries should have
+ database/table name specified.
+*/
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+
+/* The rest of the function declarations mest be taken from the mysql.h */
+
+#endif /*MYSQL_DYNAMIC_PLUGIN*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*MYSQL_SERVICE_SQL */
+
+
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 2c3a0ae421b..94f7bb3b2da 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -41,6 +41,7 @@ extern "C" {
#include <mysql/service_thd_wait.h>
#include <mysql/service_json.h>
/*#include <mysql/service_wsrep.h>*/
+#include <mysql/service_sql.h>
#ifdef __cplusplus
}
diff --git a/include/providers/bzlib.h b/include/providers/bzlib.h
new file mode 100644
index 00000000000..b48c940bdbc
--- /dev/null
+++ b/include/providers/bzlib.h
@@ -0,0 +1,126 @@
+/**
+ @file bzlib.h
+ This service provides dynamic access to BZip2.
+*/
+
+#ifndef BZIP2_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_bzip2 provider_service_bzip2_static
+#endif
+
+#ifndef BZ_RUN
+#define BZ_RUN 0
+#define BZ_FINISH 2
+
+#define BZ_OK 0
+#define BZ_RUN_OK 1
+#define BZ_FINISH_OK 3
+#define BZ_STREAM_END 4
+
+typedef struct
+{
+ char *next_in;
+ unsigned int avail_in;
+ unsigned int total_in_lo32;
+ unsigned int total_in_hi32;
+
+ char *next_out;
+ unsigned int avail_out;
+ unsigned int total_out_lo32;
+ unsigned int total_out_hi32;
+
+ void *state;
+
+ void *(*bzalloc)(void *, int, int);
+ void (*bzfree)(void *, void *);
+ void *opaque;
+} bz_stream;
+
+#define BZ2_bzBuffToBuffCompress(...) provider_service_bzip2->BZ2_bzBuffToBuffCompress_ptr (__VA_ARGS__)
+#define BZ2_bzBuffToBuffDecompress(...) provider_service_bzip2->BZ2_bzBuffToBuffDecompress_ptr (__VA_ARGS__)
+#define BZ2_bzCompress(...) provider_service_bzip2->BZ2_bzCompress_ptr (__VA_ARGS__)
+#define BZ2_bzCompressEnd(...) provider_service_bzip2->BZ2_bzCompressEnd_ptr (__VA_ARGS__)
+#define BZ2_bzCompressInit(...) provider_service_bzip2->BZ2_bzCompressInit_ptr (__VA_ARGS__)
+#define BZ2_bzDecompress(...) provider_service_bzip2->BZ2_bzDecompress_ptr (__VA_ARGS__)
+#define BZ2_bzDecompressEnd(...) provider_service_bzip2->BZ2_bzDecompressEnd_ptr (__VA_ARGS__)
+#define BZ2_bzDecompressInit(...) provider_service_bzip2->BZ2_bzDecompressInit_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_BZ2_bzBuffToBuffCompress(NAME) NAME( \
+ char *dest, \
+ unsigned int *destLen, \
+ char *source, \
+ unsigned int sourceLen, \
+ int blockSize100k, \
+ int verbosity, \
+ int workFactor \
+)
+
+#define DEFINE_BZ2_bzBuffToBuffDecompress(NAME) NAME( \
+ char *dest, \
+ unsigned int *destLen, \
+ char *source, \
+ unsigned int sourceLen, \
+ int small, \
+ int verbosity \
+)
+
+#define DEFINE_BZ2_bzCompress(NAME) NAME( \
+ bz_stream *strm, \
+ int action \
+)
+
+#define DEFINE_BZ2_bzCompressEnd(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzCompressInit(NAME) NAME( \
+ bz_stream *strm, \
+ int blockSize100k, \
+ int verbosity, \
+ int workFactor \
+)
+
+#define DEFINE_BZ2_bzDecompress(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzDecompressEnd(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzDecompressInit(NAME) NAME( \
+ bz_stream *strm, \
+ int verbosity, \
+ int small \
+)
+
+struct provider_service_bzip2_st{
+ int DEFINE_BZ2_bzBuffToBuffCompress((*BZ2_bzBuffToBuffCompress_ptr));
+ int DEFINE_BZ2_bzBuffToBuffDecompress((*BZ2_bzBuffToBuffDecompress_ptr));
+ int DEFINE_BZ2_bzCompress((*BZ2_bzCompress_ptr));
+ int DEFINE_BZ2_bzCompressEnd((*BZ2_bzCompressEnd_ptr));
+ int DEFINE_BZ2_bzCompressInit((*BZ2_bzCompressInit_ptr));
+ int DEFINE_BZ2_bzDecompress((*BZ2_bzDecompress_ptr));
+ int DEFINE_BZ2_bzDecompressEnd((*BZ2_bzDecompressEnd_ptr));
+ int DEFINE_BZ2_bzDecompressInit((*BZ2_bzDecompressInit_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_bzip2_st *provider_service_bzip2;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define BZIP2_INCLUDED
+#endif
diff --git a/include/providers/lz4.h b/include/providers/lz4.h
new file mode 100644
index 00000000000..4ac6b2c8f0d
--- /dev/null
+++ b/include/providers/lz4.h
@@ -0,0 +1,63 @@
+/**
+ @file lz4.h
+ This service provides dynamic access to LZ4.
+*/
+
+#ifndef LZ4_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lz4 provider_service_lz4_static
+#endif
+
+#ifndef LZ4_VERSION_NUMBER
+#define LZ4_MAX_INPUT_SIZE 0x7E000000
+
+#define LZ4_compressBound(...) provider_service_lz4->LZ4_compressBound_ptr (__VA_ARGS__)
+#define LZ4_compress_default(...) provider_service_lz4->LZ4_compress_default_ptr (__VA_ARGS__)
+#define LZ4_decompress_safe(...) provider_service_lz4->LZ4_decompress_safe_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_LZ4_compressBound(NAME) NAME( \
+ int inputSize \
+)
+
+#define DEFINE_LZ4_compress_default(NAME) NAME( \
+ const char *src, \
+ char *dst, \
+ int srcSize, \
+ int dstCapacity \
+)
+
+#define DEFINE_LZ4_decompress_safe(NAME) NAME( \
+ const char *src, \
+ char *dst, \
+ int compressedSize, \
+ int dstCapacity \
+)
+
+struct provider_service_lz4_st
+{
+ int DEFINE_LZ4_compressBound((*LZ4_compressBound_ptr));
+ int DEFINE_LZ4_compress_default((*LZ4_compress_default_ptr));
+ int DEFINE_LZ4_decompress_safe((*LZ4_decompress_safe_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lz4_st *provider_service_lz4;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZ4_INCLUDED
+#endif
diff --git a/include/providers/lzma.h b/include/providers/lzma.h
new file mode 100644
index 00000000000..8125bb8cb04
--- /dev/null
+++ b/include/providers/lzma.h
@@ -0,0 +1,102 @@
+/**
+ @file lzma.h
+ This service provides dynamic access to LZMA.
+*/
+
+#ifndef LZMA_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lzma provider_service_lzma_static
+#endif
+
+#ifndef LZMA_VERSION
+typedef enum
+{
+ LZMA_OK = 0,
+ LZMA_STREAM_END = 1,
+ LZMA_NO_CHECK = 2,
+ LZMA_UNSUPPORTED_CHECK = 3,
+ LZMA_GET_CHECK = 4,
+ LZMA_MEM_ERROR = 5,
+ LZMA_MEMLIMIT_ERROR = 6,
+ LZMA_FORMAT_ERROR = 7,
+ LZMA_OPTIONS_ERROR = 8,
+ LZMA_DATA_ERROR = 9,
+ LZMA_BUF_ERROR = 10,
+ LZMA_PROG_ERROR = 11,
+} lzma_ret;
+
+typedef struct
+{
+ void *(*alloc)(void *opaque, size_t nmemb, size_t size);
+ void (*free)(void *opaque, void *ptr);
+ void *opaque;
+} lzma_allocator;
+
+typedef enum
+{
+ LZMA_CHECK_NONE = 0,
+ LZMA_CHECK_CRC32 = 1,
+ LZMA_CHECK_CRC64 = 4,
+ LZMA_CHECK_SHA256 = 10
+} lzma_check;
+
+#define lzma_stream_buffer_decode(...) provider_service_lzma->lzma_stream_buffer_decode_ptr (__VA_ARGS__)
+#define lzma_easy_buffer_encode(...) provider_service_lzma->lzma_easy_buffer_encode_ptr (__VA_ARGS__)
+#elif LZMA_VERSION < 50010030
+#define lzma_maybe_const
+#endif
+
+#ifndef lzma_maybe_const
+#define lzma_maybe_const const
+#endif
+
+#define DEFINE_lzma_stream_buffer_decode(NAME) NAME( \
+ uint64_t *memlimit, \
+ uint32_t flags, \
+ lzma_maybe_const lzma_allocator *allocator, \
+ const uint8_t *in, \
+ size_t *in_pos, \
+ size_t in_size, \
+ uint8_t *out, \
+ size_t *out_pos, \
+ size_t out_size \
+)
+
+#define DEFINE_lzma_easy_buffer_encode(NAME) NAME( \
+ uint32_t preset, \
+ lzma_check check, \
+ lzma_maybe_const lzma_allocator *allocator, \
+ const uint8_t *in, \
+ size_t in_size, \
+ uint8_t *out, \
+ size_t *out_pos, \
+ size_t out_size \
+)
+
+struct provider_service_lzma_st
+{
+ lzma_ret DEFINE_lzma_stream_buffer_decode((*lzma_stream_buffer_decode_ptr));
+ lzma_ret DEFINE_lzma_easy_buffer_encode((*lzma_easy_buffer_encode_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lzma_st *provider_service_lzma;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZMA_INCLUDED
+#endif
diff --git a/include/providers/lzo/lzo1x.h b/include/providers/lzo/lzo1x.h
new file mode 100644
index 00000000000..93d1461f9cb
--- /dev/null
+++ b/include/providers/lzo/lzo1x.h
@@ -0,0 +1,62 @@
+/**
+ @file lzo/lzo1x.h
+ This service provides dynamic access to LZO.
+*/
+
+#ifndef LZO_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lzo provider_service_lzo_static
+#endif
+
+#ifndef LZO_E_OK
+#define LZO_E_OK 0
+#define LZO_E_INTERNAL_ERROR (-99)
+
+#define LZO1X_1_15_MEM_COMPRESS ((unsigned int) (32768L * ((unsigned) sizeof(unsigned char *))))
+
+typedef size_t lzo_uint;
+
+#define lzo1x_1_15_compress(...) provider_service_lzo->lzo1x_1_15_compress_ptr (__VA_ARGS__)
+#define lzo1x_decompress_safe(...) provider_service_lzo->lzo1x_decompress_safe_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_lzo1x_1_15_compress(NAME) NAME( \
+ const unsigned char *src, \
+ lzo_uint src_len, \
+ unsigned char *dst, \
+ lzo_uint *dst_len, \
+ void *wrkmem \
+)
+
+#define DEFINE_lzo1x_decompress_safe(NAME) NAME( \
+ const unsigned char *src, \
+ lzo_uint src_len, \
+ unsigned char *dst, \
+ lzo_uint *dst_len, \
+ void *wrkmem \
+)
+
+struct provider_service_lzo_st
+{
+ int DEFINE_lzo1x_1_15_compress((*lzo1x_1_15_compress_ptr));
+ int DEFINE_lzo1x_decompress_safe((*lzo1x_decompress_safe_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lzo_st *provider_service_lzo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZO_INCLUDED
+#endif
diff --git a/include/providers/snappy-c.h b/include/providers/snappy-c.h
new file mode 100644
index 00000000000..afc6aef274c
--- /dev/null
+++ b/include/providers/snappy-c.h
@@ -0,0 +1,75 @@
+/**
+ @file snappy-c.h
+ This service provides dynamic access to Snappy as a C header.
+*/
+
+#ifndef SNAPPY_C_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_snappy provider_service_snappy_static
+#endif
+
+#ifndef SNAPPY_C
+typedef enum
+{
+ SNAPPY_OK = 0,
+ SNAPPY_INVALID_INPUT = 1,
+ SNAPPY_BUFFER_TOO_SMALL = 2
+} snappy_status;
+
+#define snappy_max_compressed_length(...) provider_service_snappy->snappy_max_compressed_length_ptr (__VA_ARGS__)
+#define snappy_compress(...) provider_service_snappy->snappy_compress_ptr (__VA_ARGS__)
+#define snappy_uncompressed_length(...) provider_service_snappy->snappy_uncompressed_length_ptr (__VA_ARGS__)
+#define snappy_uncompress(...) provider_service_snappy->snappy_uncompress_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_snappy_max_compressed_length(NAME) NAME( \
+ size_t source_length \
+)
+
+#define DEFINE_snappy_compress(NAME) NAME( \
+ const char *input, \
+ size_t input_length, \
+ char *compressed, \
+ size_t *compressed_length \
+)
+
+#define DEFINE_snappy_uncompressed_length(NAME) NAME( \
+ const char *compressed, \
+ size_t compressed_length, \
+ size_t *result \
+)
+
+#define DEFINE_snappy_uncompress(NAME) NAME( \
+ const char *compressed, \
+ size_t compressed_length, \
+ char *uncompressed, \
+ size_t *uncompressed_length \
+)
+
+struct provider_service_snappy_st
+{
+ size_t DEFINE_snappy_max_compressed_length((*snappy_max_compressed_length_ptr));
+ snappy_status DEFINE_snappy_compress((*snappy_compress_ptr));
+ snappy_status DEFINE_snappy_uncompressed_length((*snappy_uncompressed_length_ptr));
+ snappy_status DEFINE_snappy_uncompress((*snappy_uncompress_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_snappy_st *provider_service_snappy;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define SNAPPY_C_INCLUDED
+#endif
diff --git a/include/service_versions.h b/include/service_versions.h
index 34e4952c94c..9abae740a7b 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -44,3 +44,10 @@
#define VERSION_wsrep 0x0500
#define VERSION_json 0x0100
#define VERSION_thd_mdl 0x0100
+#define VERSION_sql_service 0x0101
+
+#define VERSION_provider_bzip2 0x0100
+#define VERSION_provider_lz4 0x0100
+#define VERSION_provider_lzma 0x0100
+#define VERSION_provider_lzo 0x0100
+#define VERSION_provider_snappy 0x0100
diff --git a/include/sql_common.h b/include/sql_common.h
index 9fc983616a0..ad5ab7e19af 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -61,13 +61,13 @@ typedef struct st_mysql_methods
MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results);
int (*read_change_user_result)(MYSQL *mysql);
+ void (*on_close_free)(MYSQL *mysql);
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (*stmt_execute)(MYSQL_STMT *stmt);
int (*read_binary_rows)(MYSQL_STMT *stmt);
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
- void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistics)(MYSQL *mysql);
my_bool (*next_result)(MYSQL *mysql);
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 6cff07ee132..3c43c6c4abc 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates.
-# Copyright (c) 2009, 2020, MariaDB Corporation
+# Copyright (c) 2009, 2022, 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
@@ -24,6 +24,7 @@ ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/tpool
${CMAKE_BINARY_DIR}/sql
${PCRE_INCLUDES}
+${LIBFMT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SSL_INCLUDE_DIRS}
${SSL_INTERNAL_INCLUDE_DIRS}
@@ -94,7 +95,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/select_handler.cc
../sql/sql_show.cc ../sql/sql_state.c
../sql/sql_statistics.cc ../sql/sql_string.cc
- ../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
+ ../sql/sql_table.cc ../sql/sql_test.cc
../sql/ddl_log.cc
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
@@ -156,6 +157,9 @@ ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
IF(TARGET pcre2)
ADD_DEPENDENCIES(sql_embedded pcre2)
ENDIF()
+IF(TARGET libfmt)
+ ADD_DEPENDENCIES(sql_embedded libfmt)
+ENDIF()
TARGET_LINK_LIBRARIES(sql_embedded LINK_PRIVATE tpool ${CRC32_LIBRARY})
# On Windows, static embedded server library is called mysqlserver.lib
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index b37a3d99f4a..8cf4f6d4cf8 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -43,7 +43,7 @@ C_MODE_START
extern unsigned int mysql_server_last_errno;
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
static my_bool emb_read_query_result(MYSQL *mysql);
-static void emb_free_embedded_thd(MYSQL *mysql);
+static void free_embedded_thd(MYSQL *mysql);
static bool embedded_print_errors= 0;
extern "C" void unireg_clear(int exit_code)
@@ -121,7 +121,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
thd->killed= NOT_KILLED;
else
{
- emb_free_embedded_thd(mysql);
+ free_embedded_thd(mysql);
thd= 0;
}
}
@@ -430,7 +430,7 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
return 0;
}
-static void emb_free_embedded_thd(MYSQL *mysql)
+static void free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
server_threads.erase(thd);
@@ -453,12 +453,23 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
return mysql_store_result(mysql);
}
-int emb_read_change_user_result(MYSQL *mysql)
+static int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
+static void emb_on_close_free(MYSQL *mysql)
+{
+ my_free(mysql->info_buffer);
+ mysql->info_buffer= 0;
+ if (mysql->thd)
+ {
+ free_embedded_thd(mysql);
+ mysql->thd= 0;
+ }
+}
+
MYSQL_METHODS embedded_methods=
{
emb_read_query_result,
@@ -468,12 +479,12 @@ MYSQL_METHODS embedded_methods=
emb_fetch_lengths,
emb_flush_use_result,
emb_read_change_user_result,
+ emb_on_close_free,
emb_list_fields,
emb_read_prepare_result,
emb_stmt_execute,
emb_read_binary_rows,
emb_unbuffered_fetch,
- emb_free_embedded_thd,
emb_read_statistics,
emb_read_query_result,
emb_read_rows_from_cursor
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 274c8ce6dac..8c559cb07f5 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -38,7 +38,13 @@ SET(MYSQLSERVICES_SOURCES
thd_wait_service.c
wsrep_service.c
json_service.c
- )
+ sql_service.c
+ provider_service_bzip2.c
+ provider_service_lz4.c
+ provider_service_lzma.c
+ provider_service_lzo.c
+ provider_service_snappy.c
+)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
diff --git a/sql/sql_tablespace.h b/libservices/provider_service_bzip2.c
index 0760935edfc..f18ce55dd4e 100644
--- a/sql/sql_tablespace.h
+++ b/libservices/provider_service_bzip2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (C) 2021 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
@@ -11,14 +11,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 St, Fifth Floor, Boston, MA 02110-1335 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-#ifndef SQL_TABLESPACE_INCLUDED
-#define SQL_TABLESPACE_INCLUDED
-
-class THD;
-class st_alter_tablespace;
-
-int mysql_alter_tablespace(THD* thd, st_alter_tablespace *ts_info);
-
-#endif /* SQL_TABLESPACE_INCLUDED */
+#include <service_versions.h>
+SERVICE_VERSION provider_service_bzip2 = (void*) VERSION_provider_bzip2;
diff --git a/libservices/provider_service_lz4.c b/libservices/provider_service_lz4.c
new file mode 100644
index 00000000000..2653f86e26c
--- /dev/null
+++ b/libservices/provider_service_lz4.c
@@ -0,0 +1,14 @@
+/* Copyright (C) 2021 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 <service_versions.h>
+SERVICE_VERSION provider_service_lz4 = (void*) VERSION_provider_lz4;
diff --git a/libservices/provider_service_lzma.c b/libservices/provider_service_lzma.c
new file mode 100644
index 00000000000..79fc982140d
--- /dev/null
+++ b/libservices/provider_service_lzma.c
@@ -0,0 +1,17 @@
+/* Copyright (C) 2021 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 <service_versions.h>
+SERVICE_VERSION provider_service_lzma = (void*) VERSION_provider_lzma;
diff --git a/libservices/provider_service_lzo.c b/libservices/provider_service_lzo.c
new file mode 100644
index 00000000000..8b72ac017ea
--- /dev/null
+++ b/libservices/provider_service_lzo.c
@@ -0,0 +1,14 @@
+/* Copyright (C) 2021 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 <service_versions.h>
+SERVICE_VERSION provider_service_lzo = (void*) VERSION_provider_lzo;
diff --git a/libservices/provider_service_snappy.c b/libservices/provider_service_snappy.c
new file mode 100644
index 00000000000..ac0415bad61
--- /dev/null
+++ b/libservices/provider_service_snappy.c
@@ -0,0 +1,17 @@
+/* Copyright (C) 2021 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 <service_versions.h>
+SERVICE_VERSION provider_service_snappy= (void*) VERSION_provider_snappy;
diff --git a/libservices/sql_service.c b/libservices/sql_service.c
new file mode 100644
index 00000000000..5c0102bfadf
--- /dev/null
+++ b/libservices/sql_service.c
@@ -0,0 +1,19 @@
+
+/* Copyright (c) 2018, 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-1301 USA
+*/
+
+#include <service_versions.h>
+SERVICE_VERSION sql_service= (void*)VERSION_sql_service;
diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1
index d69f6123488..a55c5a652a3 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" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMYSQL\-STRESS\-TE" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index b13727c3298..8b2fb5f3a21 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" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMYSQL\-TEST\-RUN\" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql.1 b/man/mysql.1
index 6684189e474..b4904898c67 100644
--- a/man/mysql.1
+++ b/man/mysql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql.server.1 b/man/mysql.server.1
index 4b99aadb0b3..4a5c24deda2 100644
--- a/man/mysql.server.1
+++ b/man/mysql.server.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL\&.SERVER\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMYSQL\&.SERVER\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_client_test.1 b/man/mysql_client_test.1
index ae9d54dbef8..e696246337e 100644
--- a/man/mysql_client_test.1
+++ b/man/mysql_client_test.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-CLIENT-TEST" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-CLIENT-TEST" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_config.1 b/man/mysql_config.1
index 90b09cb5d4b..5dbe2c2140c 100644
--- a/man/mysql_config.1
+++ b/man/mysql_config.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_convert_table_format.1 b/man/mysql_convert_table_format.1
index 943cb66ae00..659066df0cd 100644
--- a/man/mysql_convert_table_format.1
+++ b/man/mysql_convert_table_format.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-CONVERT-TAB" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-CONVERT-TAB" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_find_rows.1 b/man/mysql_find_rows.1
index d15921ed80a..96f36d46e37 100644
--- a/man/mysql_find_rows.1
+++ b/man/mysql_find_rows.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-FIND-ROWS\F" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-FIND-ROWS\F" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_fix_extensions.1 b/man/mysql_fix_extensions.1
index 5b816e4f5be..ca42091826e 100644
--- a/man/mysql_fix_extensions.1
+++ b/man/mysql_fix_extensions.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-FIX-EXTENSI" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-FIX-EXTENSI" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1
index 25e151b71a1..970701fe2dc 100644
--- a/man/mysql_install_db.1
+++ b/man/mysql_install_db.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-INSTALL-DB\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-INSTALL-DB\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_ldb.1 b/man/mysql_ldb.1
index 5816d92674c..f6588aa9a58 100644
--- a/man/mysql_ldb.1
+++ b/man/mysql_ldb.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-LDB\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-LDB\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_plugin.1 b/man/mysql_plugin.1
index 683a42eafaf..beb701824c7 100644
--- a/man/mysql_plugin.1
+++ b/man/mysql_plugin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1
index b8081dad6a6..512f5684fb7 100644
--- a/man/mysql_secure_installation.1
+++ b/man/mysql_secure_installation.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SECURE-INST" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-SECURE-INST" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_setpermission.1 b/man/mysql_setpermission.1
index 1660c6c1de5..aa11e84280f 100644
--- a/man/mysql_setpermission.1
+++ b/man/mysql_setpermission.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1
index 76ce3a028cf..3018c656fcc 100644
--- a/man/mysql_tzinfo_to_sql.1
+++ b/man/mysql_tzinfo_to_sql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-TZINFO-TO-S" "1" "22 April 2022" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-TZINFO-TO-S" "1" "22 April 2022" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1
index ef4e438f735..f26ec2cb42d 100644
--- a/man/mysql_upgrade.1
+++ b/man/mysql_upgrade.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_waitpid.1 b/man/mysql_waitpid.1
index c2b796845cf..7dd4645b73c 100644
--- a/man/mysql_waitpid.1
+++ b/man/mysql_waitpid.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1
index 496b90495c6..d13613e053f 100644
--- a/man/mysqlaccess.1
+++ b/man/mysqlaccess.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index 25603cddc4b..21f09be255f 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1
index ff08a5de6bf..63667c09a4a 100644
--- a/man/mysqlbinlog.1
+++ b/man/mysqlbinlog.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1
index 399f2e1e56b..7b6e4e2f544 100644
--- a/man/mysqlcheck.1
+++ b/man/mysqlcheck.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld.8 b/man/mysqld.8
index 272adf79a5e..f06c021b23c 100644
--- a/man/mysqld.8
+++ b/man/mysqld.8
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1
index 0d14466ed1b..8ac13aae4bd 100644
--- a/man/mysqld_multi.1
+++ b/man/mysqld_multi.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADBD-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADBD-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1
index da742dc65b7..7be1d36fe55 100644
--- a/man/mysqld_safe.1
+++ b/man/mysqld_safe.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADBD-SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADBD-SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1
index b00fe982a93..aad81bcc2f5 100644
--- a/man/mysqld_safe_helper.1
+++ b/man/mysqld_safe_helper.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADBD-SAFE-HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADBD-SAFE-HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqldump.1 b/man/mysqldump.1
index 07ae4578bcc..34806e5a3bb 100644
--- a/man/mysqldump.1
+++ b/man/mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1
index e69f32b9056..530df5809ff 100644
--- a/man/mysqldumpslow.1
+++ b/man/mysqldumpslow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlhotcopy.1 b/man/mysqlhotcopy.1
index 1d1eee12d90..7b08b7207e3 100644
--- a/man/mysqlhotcopy.1
+++ b/man/mysqlhotcopy.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index 5b80300ddb9..af44d007eab 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlshow.1 b/man/mysqlshow.1
index 82be2967400..6a7121863fd 100644
--- a/man/mysqlshow.1
+++ b/man/mysqlshow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlslap.1 b/man/mysqlslap.1
index bd91e869f3a..d6c1333e0ea 100644
--- a/man/mysqlslap.1
+++ b/man/mysqlslap.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqltest.1 b/man/mysqltest.1
index eccd6453fbe..16b4204e998 100644
--- a/man/mysqltest.1
+++ b/man/mysqltest.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System"
+.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/mysql-test/collections/skip_list_ubsan.txt b/mysql-test/collections/skip_list_ubsan.txt
new file mode 100644
index 00000000000..dc178574293
--- /dev/null
+++ b/mysql-test/collections/skip_list_ubsan.txt
@@ -0,0 +1,3 @@
+binlog.binlog_truncate_active_log : MDEV-26919 - undefined value
+main.json_normalize : MDEV-27415 - out of bounds
+main.json_equals : MDEV-27415 - out of bounds
diff --git a/mysql-test/include/binlog_combinations.combinations b/mysql-test/include/binlog_combinations.combinations
new file mode 100644
index 00000000000..07042c2cbec
--- /dev/null
+++ b/mysql-test/include/binlog_combinations.combinations
@@ -0,0 +1,8 @@
+[row]
+binlog-format=row
+
+[stmt]
+binlog-format=statement
+
+[mix]
+binlog-format=mixed
diff --git a/mysql-test/include/binlog_combinations.inc b/mysql-test/include/binlog_combinations.inc
new file mode 100644
index 00000000000..2ddd787681a
--- /dev/null
+++ b/mysql-test/include/binlog_combinations.inc
@@ -0,0 +1,5 @@
+# The goal of including this file is to test with different
+# binlog combinations: row, stmt or mix
+# (see include/binlog_combinations.combinations)
+
+--source include/have_log_bin.inc
diff --git a/mysql-test/include/ctype_ascii_order.inc b/mysql-test/include/ctype_ascii_order.inc
index 93127a7195f..b85cab687ae 100644
--- a/mysql-test/include/ctype_ascii_order.inc
+++ b/mysql-test/include/ctype_ascii_order.inc
@@ -4,11 +4,16 @@ drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
drop table t1;
+drop view v1;
diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc
index 8209240614e..c693b86b896 100644
--- a/mysql-test/include/gis_generic.inc
+++ b/mysql-test/include/gis_generic.inc
@@ -180,9 +180,9 @@ insert IGNORE into t1 (a) values ('Garbage');
drop table t1;
create table t1 (pk integer primary key auto_increment, fl geometry not null);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 (fl) values (1);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 (fl) values (1.11);
--error 1416
insert into t1 (fl) values ("qwerty");
diff --git a/mysql-test/include/lcase_names.combinations b/mysql-test/include/lcase_names.combinations
new file mode 100644
index 00000000000..7fd344eab3f
--- /dev/null
+++ b/mysql-test/include/lcase_names.combinations
@@ -0,0 +1,5 @@
+[lcase_def]
+[lcase1]
+lower_case_table_names=1
+[lcase2]
+lower_case_table_names=2
diff --git a/mysql-test/include/lcase_names.inc b/mysql-test/include/lcase_names.inc
new file mode 100644
index 00000000000..983e2678d29
--- /dev/null
+++ b/mysql-test/include/lcase_names.inc
@@ -0,0 +1,2 @@
+# The goal of including this file is to test with different
+# lower_case_table_names modes (see include/lcase_name.combinations)
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
index b330ff448a4..5d73d1f59f1 100644
--- a/mysql-test/include/mtr_check.sql
+++ b/mysql-test/include/mtr_check.sql
@@ -99,7 +99,8 @@ BEGIN
mysql.global_priv;
-- verify that no plugin changed its disabled/enabled state
- SELECT * FROM INFORMATION_SCHEMA.PLUGINS;
+ SELECT * FROM INFORMATION_SCHEMA.PLUGINS
+ WHERE PLUGIN_STATUS != 'INACTIVE';
select * from information_schema.session_variables
where variable_name = 'debug_sync';
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index ba2e1b0c48a..429ed8a5abd 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/include/show_slave_status.inc
@@ -102,6 +102,10 @@ if ($all_slaves_status)
if ($slave_name)
{
--let $_show_query=SHOW SLAVE $slave_name STATUS
+ if ($for_channel)
+ {
+ --let $_show_query=SHOW SLAVE STATUS for channel $slave_name
+ }
}
diff --git a/mysql-test/include/type_mix_incompatible.inc b/mysql-test/include/type_mix_incompatible.inc
new file mode 100644
index 00000000000..92a75be6e81
--- /dev/null
+++ b/mysql-test/include/type_mix_incompatible.inc
@@ -0,0 +1,252 @@
+--echo # Start of type_store_assignment_incompatible.inc
+
+--disable_abort_on_error
+
+SET @sql_mode_save= @@sql_mode;
+
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+
+# 'IGNORE' -> ' IGNORE'
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ ELSE @ignore
+ END;
+
+let $source_type= `(SELECT @source_type)`;
+let $target_type= `(SELECT @target_type)`;
+let $ignore=`(SELECT @ignore)`;
+
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+
+#
+# Single row INSERT..VALUES
+#
+
+CREATE TABLE t3 LIKE t2;
+eval INSERT$ignore INTO t3 VALUES
+ (1,
+ (SELECT source FROM t2 ORDER BY id LIMIT 1),
+ (SELECT source FROM t2 ORDER BY id LIMIT 1));
+DROP TABLE t3;
+
+#
+# Multi-row INSERT..VALUES
+#
+
+# INSERT .. VALUES checks assignment compatibility for the first row only.
+# Here the first row is compatible, so no error happens.
+# The second row is not compatible. It works according to the
+# current sql_mode and the table transaction ability, so it can:
+# (a) either raise a warning
+# (b) or escalate a warning to an error and abort on the current row
+# (c) or escalate a warning to an error and rollback
+# Here we test (a) and (b).
+
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+ CONCAT('CREATE VIEW v3 AS SELECT id,',
+ IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+ IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+ ' FROM t3');
+
+eval INSERT$ignore INTO t3 VALUES
+ (1,
+ (SELECT target FROM t2 ORDER BY id LIMIT 1),
+ (SELECT source FROM t2 ORDER BY id LIMIT 1)),
+ (2,
+ (SELECT source FROM t2 ORDER BY id LIMIT 1),
+ (SELECT source FROM t2 ORDER BY id LIMIT 1));
+SELECT * FROM v3;
+TRUNCATE TABLE t3;
+
+SET sql_mode=STRICT_ALL_TABLES;
+eval INSERT$ignore INTO t3 VALUES
+ (1,
+ (SELECT target FROM t2 ORDER BY id LIMIT 1),
+ (SELECT source FROM t2 ORDER BY id LIMIT 1)),
+ (2,
+ (SELECT source FROM t2 ORDER BY id LIMIT 1),
+ (SELECT source FROM t2 ORDER BY id LIMIT 1));
+SELECT * FROM v3;
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+
+#
+# INSERT .. SELECT
+#
+
+CREATE TABLE t3 LIKE t2;
+eval INSERT$ignore INTO t3 SELECT id,source,source FROM t2;
+
+eval INSERT$ignore INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+
+#
+# INSERT .. VALUES .. ON DUPLICATE KEY UPDATE target=source
+#
+
+eval INSERT$ignore INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+
+eval INSERT$ignore INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+
+#
+# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE target=source
+#
+
+eval INSERT$ignore INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+
+eval INSERT$ignore INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+
+
+#
+# UPDATE
+#
+eval UPDATE$ignore t3 SET target=source;
+
+
+#
+# UPDATE, multi-table
+#
+
+eval UPDATE$ignore t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+
+
+#
+# ALTER
+#
+
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+EXECUTE IMMEDIATE @alter;
+
+
+DROP TABLE t3;
+DROP TABLE t2;
+
+#
+# MDEV-28963 Incompatible data type assignment through SP vars is not consistent with columns
+#
+
+#
+# SP local variables
+#
+DELIMITER $$;
+eval CREATE PROCEDURE p1()
+BEGIN
+ DECLARE src $source_type DEFAULT NULL;
+ DECLARE dst $target_type DEFAULT NULL;
+ SET dst=src;
+END;
+$$
+DELIMITER ;$$
+CALL p1;
+DROP PROCEDURE p1;
+
+#
+# SP IN parameters
+#
+
+--eval CREATE FUNCTION f1(a $target_type) RETURNS INT RETURN NULL;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+DROP FUNCTION f1;
+
+--eval CREATE PROCEDURE p1(a $target_type) BEGIN END;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+DROP PROCEDURE p1;
+
+#
+# SP OUT parameters
+#
+
+DELIMITER $$;
+eval CREATE PROCEDURE p1(OUT dst $target_type)
+BEGIN
+ DECLARE src $source_type DEFAULT NULL;
+ SET dst=src;
+END;
+$$
+eval CREATE PROCEDURE p2()
+BEGIN
+ DECLARE dst $target_type DEFAULT NULL;
+ CALL p1(dst);
+END;
+$$
+DELIMITER ;$$
+CALL p2();
+SHOW WARNINGS;
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+
+
+#
+# SF RETURN
+#
+
+DELIMITER $$;
+eval CREATE FUNCTION f1() RETURNS $target_type
+BEGIN
+ DECLARE rc $source_type DEFAULT NULL;
+ RETURN rc;
+END;
+$$
+DELIMITER ;$$
+SELECT f1();
+DROP FUNCTION f1;
+
+#
+# Cursor IN parameters
+#
+
+DELIMITER $$;
+eval CREATE PROCEDURE p1()
+BEGIN
+ DECLARE src $source_type DEFAULT NULL;
+ DECLARE cur1 CURSOR(t $target_type) FOR SELECT * FROM t1 WHERE target=t;
+ OPEN cur1(src);
+ CLOSE cur1;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+
+#
+# FETCH
+#
+
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+
+DELIMITER $$;
+eval CREATE PROCEDURE p1()
+BEGIN
+ DECLARE dst $target_type DEFAULT NULL;
+ DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+ OPEN cur2;
+ FETCH cur2 INTO dst;
+ CLOSE cur2;
+END;
+$$
+DELIMITER ;$$
+CALL p1();
+DROP PROCEDURE p1;
+
+DROP TABLE t2;
+
+--enable_abort_on_error
+
+--echo # End of type_store_assignment_incompatible.inc
diff --git a/mysql-test/include/wait_for_sql_thread_read_all.inc b/mysql-test/include/wait_for_sql_thread_read_all.inc
index 1bbb006f3a8..1829591c5d1 100644
--- a/mysql-test/include/wait_for_sql_thread_read_all.inc
+++ b/mysql-test/include/wait_for_sql_thread_read_all.inc
@@ -1,6 +1,12 @@
+# This script ensures that a slave has executed everything in the relay log
+# files. This can be used to ensure slave is in a predicate place after
+# a FLUSH RELAY LOGS command.
+# Note that this script does not guarantee that the slave has read everything
+# from the master(s). If this is needed on should use the sync_with_master
+# command or the sync_with_master script.
+
--let $show_statement = show all slaves status
--let $field = Slave_SQL_State
--let $condition = = 'Slave has read all relay log; waiting for more updates'
--let $wait_for_all = 1
--source include/wait_show_condition.inc
-
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 21998597cad..879bc0edfec 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -3093,3 +3093,18 @@ drop table t1;
#
# End of 10.5 tests
#
+#
+# MDEV-26767 Server crashes when rename table and alter storage engine
+#
+alter table txxx engine=innodb, rename to tyyy;
+ERROR 42S02: Table 'test.txxx' doesn't exist
+#
+# MDEV-27048 UBSAN: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
+#
+CREATE TABLE t (a INT,b INT,c INT,x TEXT,y TEXT,z TEXT,id INT UNSIGNED AUTO_INCREMENT,i INT,KEY(id),UNIQUE KEY a (a,b,c));
+ALTER TABLE t ADD CONSTRAINT test UNIQUE (id) USING HASH;
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `id`
+DROP TABLE t;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index 2867fc74f03..f6e9bfe1126 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -1968,7 +1968,7 @@ show create table t1;
drop table t1;
create table t1 (a int, b int, c int, unique(a,b));
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column a;
alter table t1 drop column a, drop index a;
show create table t1;
@@ -2382,3 +2382,21 @@ drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # MDEV-26767 Server crashes when rename table and alter storage engine
+--echo #
+--error ER_NO_SUCH_TABLE
+alter table txxx engine=innodb, rename to tyyy;
+
+--echo #
+--echo # MDEV-27048 UBSAN: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
+--echo #
+CREATE TABLE t (a INT,b INT,c INT,x TEXT,y TEXT,z TEXT,id INT UNSIGNED AUTO_INCREMENT,i INT,KEY(id),UNIQUE KEY a (a,b,c));
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+ALTER TABLE t ADD CONSTRAINT test UNIQUE (id) USING HASH;
+DROP TABLE t;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/mysql-test/main/alter_table_combinations.result b/mysql-test/main/alter_table_combinations.result
index e050fe6655d..cd47c78d404 100644
--- a/mysql-test/main/alter_table_combinations.result
+++ b/mysql-test/main/alter_table_combinations.result
@@ -226,7 +226,7 @@ Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function
SELECT * FROM v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
UPDATE t2 SET f = f + 10;
-ERROR 42S22: Unknown column 'd' in 'OLD'
+ERROR 42S22: Unknown column 'd' in 'NEW'
CALL sp1();
ERROR 42S22: Unknown column 'd' in 'field list'
DROP TRIGGER trg1;
diff --git a/mysql-test/main/assign_key_cache.result b/mysql-test/main/assign_key_cache.result
index 4ed6170136b..32d7bc2c0b8 100644
--- a/mysql-test/main/assign_key_cache.result
+++ b/mysql-test/main/assign_key_cache.result
@@ -3,7 +3,7 @@ create table t1 (i int) engine=myisam partition by hash (i) partitions 2;
xa start 'xid';
cache index t1 partition (non_existing_partition) in my_cache;
Table Op Msg_type Msg_text
-test.t1 assign_to_keycache error Error in list of partitions to test.t1
+test.t1 assign_to_keycache error Wrong partition name or partition list
cache index t1 partition (p1) in my_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
diff --git a/mysql-test/main/count_distinct.result b/mysql-test/main/count_distinct.result
index 760b2710586..037674aa66a 100644
--- a/mysql-test/main/count_distinct.result
+++ b/mysql-test/main/count_distinct.result
@@ -1,4 +1,3 @@
-drop table if exists t1,t2,t3;
create table t1 (libname varchar(21) not null, city text, primary key (libname));
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
@@ -131,3 +130,16 @@ count(distinct a)
10
drop table t1;
set @@tmp_table_size = default;
+#
+# End of 5.5 tests
+#
+#
+# MDEV-26452 SIGSEGV in Item::cleanup from Item::cleanup_processor
+#
+create table t (a int,b date,primary key(a,b));
+select b,count(distinct a) from t group by b having b is null;
+b count(distinct a)
+drop table t;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/count_distinct.test b/mysql-test/main/count_distinct.test
index 86045e862e7..9f682af3d63 100644
--- a/mysql-test/main/count_distinct.test
+++ b/mysql-test/main/count_distinct.test
@@ -2,10 +2,6 @@
# Problem with count(distinct)
#
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
create table t1 (libname varchar(21) not null, city text, primary key (libname));
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
@@ -149,6 +145,17 @@ select count(distinct a) from t1;
drop table t1;
set @@tmp_table_size = default;
-#
-# End of 5.5 tests
-#
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-26452 SIGSEGV in Item::cleanup from Item::cleanup_processor
+--echo #
+create table t (a int,b date,primary key(a,b));
+select b,count(distinct a) from t group by b having b is null;
+drop table t;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test
index 074195a331d..541748fc6ad 100644
--- a/mysql-test/main/create.test
+++ b/mysql-test/main/create.test
@@ -748,7 +748,7 @@ create table t1 select * from t1;
--error ER_CANT_AGGREGATE_2COLLATIONS
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
# Error during table creation
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
create table t1 (primary key(a)) select "b" as b;
# Error in select_create::prepare() which is not related to table creation
create table t1 (a int);
diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result
index 4aec26214df..b2abca5df7a 100644
--- a/mysql-test/main/ctype_big5.result
+++ b/mysql-test/main/ctype_big5.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 big5_chinese_ci
+name big5_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -321,8 +360,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
@@ -479,6 +519,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 big5_bin
+name big5_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test
index 204c20901fd..b7d33c4fcde 100644
--- a/mysql-test/main/ctype_big5.test
+++ b/mysql-test/main/ctype_big5.test
@@ -25,6 +25,7 @@ SET collation_connection='big5_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
-- source include/ctype_pad_space.inc
#
diff --git a/mysql-test/main/ctype_cp932.result b/mysql-test/main/ctype_cp932.result
index 08c94abf74d..47b3cbc12f8 100644
--- a/mysql-test/main/ctype_cp932.result
+++ b/mysql-test/main/ctype_cp932.result
@@ -598,6 +598,281 @@ SET DEFAULT_STORAGE_ENGINE=Default;
# End of 10.2 tests
#
#
+# General tests
+#
+SET NAMES cp932;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 cp932_japanese_ci
+name cp932_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES cp932 COLLATE cp932_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 cp932_bin
+name cp932_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+#
# Start of 10.5 tests
#
#
diff --git a/mysql-test/main/ctype_cp932.test b/mysql-test/main/ctype_cp932.test
index d2ca278c739..3d0306884df 100644
--- a/mysql-test/main/ctype_cp932.test
+++ b/mysql-test/main/ctype_cp932.test
@@ -53,6 +53,15 @@ let $coll_pad='cp932_bin';
--echo #
+--echo # General tests
+--echo #
+SET NAMES cp932;
+-- source include/ctype_ascii_order.inc
+SET NAMES cp932 COLLATE cp932_bin;
+-- source include/ctype_ascii_order.inc
+
+
+--echo #
--echo # Start of 10.5 tests
--echo #
diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result
index f8d7d6cea46..ea8824584d8 100644
--- a/mysql-test/main/ctype_eucjpms.result
+++ b/mysql-test/main/ctype_eucjpms.result
@@ -2,6 +2,281 @@ drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
+#
+# General tests
+#
+SET NAMES eucjpms;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 eucjpms_japanese_ci
+name eucjpms_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES eucjpms COLLATE eucjpms_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 eucjpms_bin
+name eucjpms_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
set names eucjpms;
set character_set_database = eucjpms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
diff --git a/mysql-test/main/ctype_eucjpms.test b/mysql-test/main/ctype_eucjpms.test
index 1ea9eb801b0..3b54d667ecb 100644
--- a/mysql-test/main/ctype_eucjpms.test
+++ b/mysql-test/main/ctype_eucjpms.test
@@ -12,6 +12,14 @@ drop table if exists t3;
drop table if exists t4;
--enable_warnings
+--echo #
+--echo # General tests
+--echo #
+SET NAMES eucjpms;
+-- source include/ctype_ascii_order.inc
+SET NAMES eucjpms COLLATE eucjpms_bin;
+-- source include/ctype_ascii_order.inc
+
set names eucjpms;
set character_set_database = eucjpms;
diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result
index cded18ff920..9e030f9cc6d 100644
--- a/mysql-test/main/ctype_euckr.result
+++ b/mysql-test/main/ctype_euckr.result
@@ -243,6 +243,128 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 euckr_korean_ci
+name euckr_korean_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET collation_connection='euckr_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -384,6 +506,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 euckr_bin
+name euckr_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES euckr;
CREATE TABLE t1 (a text) character set euckr;
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
diff --git a/mysql-test/main/ctype_euckr.test b/mysql-test/main/ctype_euckr.test
index 1154047fdb0..e4f07081dba 100644
--- a/mysql-test/main/ctype_euckr.test
+++ b/mysql-test/main/ctype_euckr.test
@@ -17,11 +17,13 @@ SET collation_connection='euckr_korean_ci';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
SET collation_connection='euckr_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#15377 Valid multibyte sequences are truncated on INSERT
diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result
index adb289b5fce..163364d4bc4 100644
--- a/mysql-test/main/ctype_gb2312.result
+++ b/mysql-test/main/ctype_gb2312.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gb2312_chinese_ci
+name gb2312_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -322,8 +361,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SET collation_connection='gb2312_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -465,6 +505,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gb2312_bin
+name gb2312_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES gb2312;
CREATE TABLE t1 (a text) character set gb2312;
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
diff --git a/mysql-test/main/ctype_gb2312.test b/mysql-test/main/ctype_gb2312.test
index b9147fdc420..c2d513f1f5a 100644
--- a/mysql-test/main/ctype_gb2312.test
+++ b/mysql-test/main/ctype_gb2312.test
@@ -26,6 +26,7 @@ SET collation_connection='gb2312_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#15377 Valid multibyte sequences are truncated on INSERT
diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result
index 0ed7620a177..79dede6d089 100644
--- a/mysql-test/main/ctype_gbk.result
+++ b/mysql-test/main/ctype_gbk.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gbk_chinese_ci
+name gbk_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -322,8 +361,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SET collation_connection='gbk_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -465,6 +505,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gbk_bin
+name gbk_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES gbk;
CREATE TABLE t1 (a text) character set gbk;
INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test
index 742b0a64c98..0d9d1d8b30a 100644
--- a/mysql-test/main/ctype_gbk.test
+++ b/mysql-test/main/ctype_gbk.test
@@ -24,6 +24,7 @@ SET collation_connection='gbk_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#11987 mysql will truncate the text when
diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result
index 4e08b0fbe98..4606c4bd8f3 100644
--- a/mysql-test/main/ctype_sjis.result
+++ b/mysql-test/main/ctype_sjis.result
@@ -231,6 +231,128 @@ SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
323030318180303181803031 25598180256D81802564 2001-01-01 00:00:00.000000
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 sjis_japanese_ci
+name sjis_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET collation_connection='sjis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -372,6 +494,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 sjis_bin
+name sjis_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES sjis;
SELECT HEX('²“‘@Œ\') FROM DUAL;
HEX('²“‘@Œ\')
diff --git a/mysql-test/main/ctype_sjis.test b/mysql-test/main/ctype_sjis.test
index 30ad360bf2e..c05cbbad01c 100644
--- a/mysql-test/main/ctype_sjis.test
+++ b/mysql-test/main/ctype_sjis.test
@@ -72,13 +72,13 @@ SET collation_connection='sjis_japanese_ci';
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
-- source include/ctype_str_to_date.inc
-
-
+-- source include/ctype_ascii_order.inc
SET collation_connection='sjis_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
--enable_service_connection
# Check parsing of string literals in SJIS with multibyte characters that
diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result
index 4530b3ca4a2..10b7042f709 100644
--- a/mysql-test/main/ctype_tis620.result
+++ b/mysql-test/main/ctype_tis620.result
@@ -3042,14 +3042,53 @@ SELECT '\%b' LIKE '%\%';
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 tis620_thai_ci
+name tis620_thai_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -3119,8 +3158,9 @@ Zz 5A,7A
| 7C
} 7D
~ 7E
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result
index 177a609f446..35bfce8eb5a 100644
--- a/mysql-test/main/ctype_ujis.result
+++ b/mysql-test/main/ctype_ujis.result
@@ -1,5 +1,281 @@
drop table if exists t1;
set names ujis;
+#
+# General tests
+#
+SET NAMES ujis;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 ujis_japanese_ci
+name ujis_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES ujis COLLATE ujis_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 ujis_bin
+name ujis_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES ujis;
create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
diff --git a/mysql-test/main/ctype_ujis.test b/mysql-test/main/ctype_ujis.test
index 8b0ba671abc..320231a9762 100644
--- a/mysql-test/main/ctype_ujis.test
+++ b/mysql-test/main/ctype_ujis.test
@@ -9,10 +9,20 @@ drop table if exists t1;
set names ujis;
+--echo #
+--echo # General tests
+--echo #
+
+SET NAMES ujis;
+-- source include/ctype_ascii_order.inc
+SET NAMES ujis COLLATE ujis_bin;
+-- source include/ctype_ascii_order.inc
+
#
# Test problem with LEFT()
#
+SET NAMES ujis;
create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index 5edd9d53c08..53d3be0b125 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -11403,8 +11403,8 @@ DROP TABLE t1;
# MDEV-20890 Illegal mix of collations with UUID()
#
SET NAMES utf8 COLLATE utf8_unicode_ci;
-SELECT uuid()>'';
-uuid()>''
+SELECT sys_guid()>'';
+sys_guid()>''
1
#
# MDEV-8844 Unreadable control characters printed as is in warnings
diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test
index 47c4b771814..5ea4b17f259 100644
--- a/mysql-test/main/ctype_utf8.test
+++ b/mysql-test/main/ctype_utf8.test
@@ -2332,7 +2332,7 @@ DROP TABLE t1;
--echo #
SET NAMES utf8 COLLATE utf8_unicode_ci;
-SELECT uuid()>'';
+SELECT sys_guid()>'';
--echo #
diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result
index 6504e129693..f588374a26f 100644
--- a/mysql-test/main/ddl_i18n_koi8r.result
+++ b/mysql-test/main/ddl_i18n_koi8r.result
@@ -1739,7 +1739,10 @@ CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(0),(1);
+INSERT INTO `t1` VALUES
+(1),
+(0),
+(1);
ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -1818,7 +1821,10 @@ CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(0),(1);
+INSERT INTO `t1` VALUES
+(1),
+(0),
+(1);
ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result
index 35234d4fa23..cb57bc5e9df 100644
--- a/mysql-test/main/ddl_i18n_utf8.result
+++ b/mysql-test/main/ddl_i18n_utf8.result
@@ -1739,7 +1739,10 @@ CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(0),(1);
+INSERT INTO `t1` VALUES
+(1),
+(0),
+(1);
ALTER DATABASE `mysqltest1` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -1818,7 +1821,10 @@ CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(0),(1);
+INSERT INTO `t1` VALUES
+(1),
+(0),
+(1);
ALTER DATABASE `mysqltest2` CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result
index 0e3422ff1c3..9a29cf7ddb0 100644
--- a/mysql-test/main/default.result
+++ b/mysql-test/main/default.result
@@ -797,7 +797,7 @@ ERROR 42000: Invalid default value for 'a'
#
CREATE TABLE t1 (a INT DEFAULT '1 ');
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -810,7 +810,7 @@ a
DROP TABLE t1;
CREATE TABLE t1 (a INT DEFAULT CONCAT('1 '));
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -825,7 +825,7 @@ a
DROP TABLE t1;
CREATE TABLE t1 (a INT DEFAULT COALESCE('1 '));
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result
index 54273452965..dde6cfa4ed8 100644
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@ -1609,14 +1609,14 @@ def ifnull___a_a 253 10 1 Y 0 39 8
def least____a_a 253 10 1 Y 0 39 8
def greatest_a_a 253 10 1 Y 0 39 8
def test t1 t1 b ___________b 254 1 1 Y 256 0 8
-def case_______b 254 1 1 Y 0 39 8
-def case_____b_b 254 1 1 Y 0 39 8
-def coalesce___b 254 1 1 Y 0 39 8
-def coalesce_b_b 254 1 1 Y 0 39 8
-def if_______b_b 254 1 1 Y 0 39 8
-def ifnull___b_b 254 1 1 Y 0 39 8
-def least____b_b 254 1 1 Y 0 39 8
-def greatest_b_b 254 1 1 Y 0 39 8
+def case_______b 253 1 1 Y 0 39 8
+def case_____b_b 253 1 1 Y 0 39 8
+def coalesce___b 253 1 1 Y 0 39 8
+def coalesce_b_b 253 1 1 Y 0 39 8
+def if_______b_b 253 1 1 Y 0 39 8
+def ifnull___b_b 253 1 1 Y 0 39 8
+def least____b_b 253 1 1 Y 0 39 8
+def greatest_b_b 253 1 1 Y 0 39 8
___________a a
case_______a a
case_____a_a a
diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result
index b18aa26777e..175e23ec65f 100644
--- a/mysql-test/main/func_in.result
+++ b/mysql-test/main/func_in.result
@@ -783,7 +783,7 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
# Bug#13012483: EXPLAIN EXTENDED, PREPARED STATEMENT, CRASH IN CHECK_SIMPLE_EQUALITY
#
CREATE TABLE t1 (a INT);
-PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
+PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @a:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
EXECUTE s;
1
DROP TABLE t1;
@@ -804,15 +804,6 @@ select * from t1 where IF(1,a,a)='2.1';
a b
drop table t1;
#
-# LP bug#992380 Crash when creating PS for a query with
-# subquery in WHERE (see also mysql bug#13012483)
-#
-CREATE TABLE t1 (a INT);
-PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
-EXECUTE s;
-1
-DROP TABLE t1;
-#
# End of 5.3 tests
#
create table t1 (a int);
diff --git a/mysql-test/main/func_in.test b/mysql-test/main/func_in.test
index 02483c482ac..847c48d31a9 100644
--- a/mysql-test/main/func_in.test
+++ b/mysql-test/main/func_in.test
@@ -570,7 +570,7 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
--echo #
CREATE TABLE t1 (a INT);
-PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
+PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @a:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
EXECUTE s;
DROP TABLE t1;
@@ -598,15 +598,6 @@ select * from t1 where a='2.1';
select * from t1 where b='2.1';
select * from t1 where IF(1,a,a)='2.1';
drop table t1;
---echo #
---echo # LP bug#992380 Crash when creating PS for a query with
---echo # subquery in WHERE (see also mysql bug#13012483)
---echo #
-CREATE TABLE t1 (a INT);
-PREPARE s FROM "SELECT 1 FROM t1 WHERE 1 < ALL (SELECT @:= (1 IN (SELECT 1 FROM t1)) FROM t1)";
-EXECUTE s;
-
-DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result
index 7d91f4b0777..8ae2cf4ad6b 100644
--- a/mysql-test/main/func_misc.result
+++ b/mysql-test/main/func_misc.result
@@ -118,9 +118,12 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `uuid()` varchar(36) DEFAULT NULL,
+ `uuid()` uuid DEFAULT NULL,
`length(uuid())` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select length(`uuid()`) from t1;
+length(`uuid()`)
+36
drop table t1;
create table t1 select INET_ATON('255.255.0.1') as `a`;
show create table t1;
diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test
index c69832375e7..6a199a45b27 100644
--- a/mysql-test/main/func_misc.test
+++ b/mysql-test/main/func_misc.test
@@ -106,6 +106,7 @@ select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
create table t1 as select uuid(), length(uuid());
--enable_warnings
show create table t1;
+select length(`uuid()`) from t1;
drop table t1;
#
diff --git a/mysql-test/main/func_sformat.result b/mysql-test/main/func_sformat.result
new file mode 100644
index 00000000000..1809cbad23b
--- /dev/null
+++ b/mysql-test/main/func_sformat.result
@@ -0,0 +1,470 @@
+#
+# MDEV-25015 Custom formatting of strings in MariaDB queries
+#
+#
+# Normal Test Cases
+#
+select sformat('string test');
+sformat('string test')
+string test
+select sformat(0);
+sformat(0)
+0
+select sformat('C');
+sformat('C')
+C
+select sformat(-4.2);
+sformat(-4.2)
+-4.2
+select sformat(5, 5, 5);
+sformat(5, 5, 5)
+5
+select sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+0 0
+select sformat('{{{}}}', 0);
+sformat('{{{}}}', 0)
+{0}
+select sformat('{{{}{{', 0);
+sformat('{{{}{{', 0)
+{0{
+select sformat('{{{{{}{{', 'param1');
+sformat('{{{{{}{{', 'param1')
+{{param1{
+select sformat(' {{ {{ {} {{ ', 'param1');
+sformat(' {{ {{ {} {{ ', 'param1')
+ { { param1 {
+select sformat(' {{ {} {}', 'param1', 'param2');
+sformat(' {{ {} {}', 'param1', 'param2')
+ { param1 param2
+select sformat('A{}C{}E{}', 'B', 'D', 'F');
+sformat('A{}C{}E{}', 'B', 'D', 'F')
+ABCDEF
+select sformat('{} {}', FALSE, TRUE);
+sformat('{} {}', FALSE, TRUE)
+0 1
+select sformat('Add € != {} != {}?', '$', '£');
+sformat('Add € != {} != {}?', '$', '£')
+Add € != $ != £?
+select sformat('Check {} != {} != {}?', '€', '$', '£');
+sformat('Check {} != {} != {}?', '€', '$', '£')
+Check € != $ != £?
+select sformat('{}{}{}', 1, 2, 3);
+sformat('{}{}{}', 1, 2, 3)
+123
+select sformat('Float {} Boolean {} Number {}', 3.14159, True, -50);
+sformat('Float {} Boolean {} Number {}', 3.14159, True, -50)
+Float 3.14159 Boolean 1 Number -50
+select sformat('SUM {} + {} = {}', 2, 3, 2+3);
+sformat('SUM {} + {} = {}', 2, 3, 2+3)
+SUM 2 + 3 = 5
+select sformat('Numbers {} {} {}', 1, 1.11, 1.111);
+sformat('Numbers {} {} {}', 1, 1.11, 1.111)
+Numbers 1 1.11 1.111
+select sformat('what {} is {}?', 'time', 'it');
+sformat('what {} is {}?', 'time', 'it')
+what time is it?
+select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}', 1, 2, 3, 4, 5, 6,
+7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120);
+sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+ 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
+ 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
+ 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
+select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}', '1', '2', '3 ',
+'4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
+'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36',
+'37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52',
+'53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68',
+'69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84',
+'85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100',
+'101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114',
+'115', '116', '117', '118', '119', '120');
+sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+ 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
+ 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
+ 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
+#
+# Error Test Cases
+#
+select sformat('R={ }', 42);
+sformat('R={ }', 42)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid format string
+select sformat(NULL, 'Null', 'Test');
+sformat(NULL, 'Null', 'Test')
+NULL
+select sformat('Null Test {} {} ', 0, NULL);
+sformat('Null Test {} {} ', 0, NULL)
+NULL
+select sformat(NULL);
+sformat(NULL)
+NULL
+select sformat('My { Test');
+sformat('My { Test')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid format string
+select sformat('Test { {');
+sformat('Test { {')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid format string
+select sformat('A{}C{}E{}', 'B', 'D');
+sformat('A{}C{}E{}', 'B', 'D')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: argument not found
+select sformat();
+ERROR 42000: Incorrect parameter count in the call to native function 'sformat'
+#
+# Table Test Cases
+#
+create table t1 (param1 text, param2 text, param3 int);
+insert into t1 values ('string: {}, number: {}', 'xyz', 123),
+('something {} went {} wrong {}', 'foo', 0),
+('Test case {} -> {}', 'Print', -32);
+select sformat(param1, param2, param3) from t1;
+sformat(param1, param2, param3)
+string: xyz, number: 123
+NULL
+Test case Print -> -32
+Warnings:
+Warning 4183 SFORMAT error: argument not found
+drop table t1;
+create table t2 (param1 FLOAT, param2 SMALLINT, param3 CHAR, param4 DATE);
+insert into t2 values (0.0025, 25, 'A', DATE('2020-06-29')),
+(0.0005, 5, 'B', DATE('2020-6-29')),
+(5.5555, -5, 'C', DATE('200629')),
+(-9, -9, 'D', DATE('20*06*29'));
+select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) from t2;
+sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4)
+p1 0.0025 p2 25 p3 A p4 2020-06-29
+p1 0.0005 p2 5 p3 B p4 2020-06-29
+p1 5.5555 p2 -5 p3 C p4 2020-06-29
+p1 -9.0000 p2 -9 p3 D p4 2020-06-29
+drop table t2;
+set names utf8;
+create table t3 (format_str text character set 'latin1',
+first_param text character set 'utf8',
+second_param text character set 'latin1');
+insert into t3 values ('test 1 {} {}', UNHEX('C3A5'), UNHEX('E5'));
+select sformat(format_str, first_param, second_param) from t3;
+sformat(format_str, first_param, second_param)
+test 1 å å
+select HEX(sformat(format_str, first_param, second_param)) from t3;
+HEX(sformat(format_str, first_param, second_param))
+74657374203120C3A520C3A5
+drop table t3;
+set names latin1;
+create table t4 (p1 bit(8), p2 boolean, p3 DECIMAL, p4 TIMESTAMP);
+insert into t4 values (42, TRUE, 42, '2021-08-18 16:50:07'),
+(24, FALSE, 24, '0000-00-00 00:00:00');
+select sformat('{}: {} {} {} {}', 'Data', p1, p2, p3, p4) from t4;
+sformat('{}: {} {} {} {}', 'Data', p1, p2, p3, p4)
+Data: 42 1 42 2021-08-18 16:50:07
+Data: 24 0 24 0000-00-00 00:00:00
+drop table t4;
+set names utf8;
+create table t5 (param text character SET utf8 COLLATE utf8_general_ci);
+insert into t5 values (UNHEX('C3A5')),(UNHEX('C5BB')),(UNHEX('e0b1bb')),
+(UNHEX('C38A')), (NULL);
+select sformat('{}', param) from t5;
+sformat('{}', param)
+Ã¥
+Å»
+à±»
+Ê
+NULL
+select HEX(sformat('{}', param)) from t5;
+HEX(sformat('{}', param))
+C3A5
+C5BB
+E0B1BB
+C38A
+NULL
+drop table t5;
+set names latin1;
+#
+# Format Test Cases
+#
+select sformat('Num {:L}', 13800000000);
+sformat('Num {:L}', 13800000000)
+Num 13,800,000,000
+select sformat('Num [{:20}]', 42);
+sformat('Num [{:20}]', 42)
+Num [ 42]
+select sformat('Number: {:*^{}}', 4, 5);
+sformat('Number: {:*^{}}', 4, 5)
+Number: **4**
+select sformat('{:02} - {:02} - {:02}', 1, 2, 3);
+sformat('{:02} - {:02} - {:02}', 1, 2, 3)
+01 - 02 - 03
+select sformat('Character {:c}', 104);
+sformat('Character {:c}', 104)
+Character h
+select sformat('String {:s}', 'hello');
+sformat('String {:s}', 'hello')
+String hello
+select sformat('Large {0:+010.4g}', 392.64);
+sformat('Large {0:+010.4g}', 392.64)
+Large +0000392.6
+select sformat('Large {:g}', 392.65);
+sformat('Large {:g}', 392.65)
+Large 392.65
+select sformat('Float {:.2f}', 42.0);
+sformat('Float {:.2f}', 42.0)
+Float 42.00
+select sformat('Float {:f}', 42.0);
+sformat('Float {:f}', 42.0)
+Float 42.000000
+select sformat('Number {:d}', 42);
+sformat('Number {:d}', 42)
+Number 42
+select sformat('Number {:{}}', 5, 5);
+sformat('Number {:{}}', 5, 5)
+Number 5
+select sformat('Number [{:10}]', 9999);
+sformat('Number [{:10}]', 9999)
+Number [ 9999]
+select sformat('Number {:.3}', 3.1416);
+sformat('Number {:.3}', 3.1416)
+Number 3.14
+select sformat('int: {0:d}; hex: {0:x}; oct: {0:o}', 42);
+sformat('int: {0:d}; hex: {0:x}; oct: {0:o}', 42)
+int: 42; hex: 2a; oct: 52
+select sformat('int: {0:d}; hex: {0:#x}; oct: {0:#o}', 42);
+sformat('int: {0:d}; hex: {0:#x}; oct: {0:#o}', 42)
+int: 42; hex: 0x2a; oct: 052
+select sformat('The Hexadecimal version of {0} is {0:X}', 255);
+sformat('The Hexadecimal version of {0} is {0:X}', 255)
+The Hexadecimal version of 255 is FF
+select sformat('The Hexadecimal version of {0} is {0:x}', 255);
+sformat('The Hexadecimal version of {0} is {0:x}', 255)
+The Hexadecimal version of 255 is ff
+select sformat('The octal version of {0} is {0:o}', 10);
+sformat('The octal version of {0} is {0:o}', 10)
+The octal version of 10 is 12
+select sformat('The binary version of {0} is {0:b}', 5);
+sformat('The binary version of {0} is {0:b}', 5)
+The binary version of 5 is 101
+select sformat('{:+f}; {:+f}', 3.14, -3.14);
+sformat('{:+f}; {:+f}', 3.14, -3.14)
++3.140000; -3.140000
+select sformat('{: f}; {: f}', 3.14, -3.14);
+sformat('{: f}; {: f}', 3.14, -3.14)
+ 3.140000; -3.140000
+select sformat('{:-f}; {:-f}', 3.14, -3.14);
+sformat('{:-f}; {:-f}', 3.14, -3.14)
+3.140000; -3.140000
+select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7);
+sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7)
+The temperature is between -3 and 7 degrees celsius.
+select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7);
+sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7)
+The temperature is between -3 and 7 degrees celsius.
+select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7);
+sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7)
+The temperature is between -3 and +7 degrees celsius.
+select sformat('We have {:<8} chickens.', 49);
+sformat('We have {:<8} chickens.', 49)
+We have 49 chickens.
+select sformat('Center alimgn [{:*^10}]', 'data');
+sformat('Center alimgn [{:*^10}]', 'data')
+Center alimgn [***data***]
+select sformat('Center aling [{:^10}].', 'data');
+sformat('Center aling [{:^10}].', 'data')
+Center aling [ data ].
+select sformat('Right aling [{:>10}].', 'data');
+sformat('Right aling [{:>10}].', 'data')
+Right aling [ data].
+select sformat('Left align [{:<10}].', 'data');
+sformat('Left align [{:<10}].', 'data')
+Left align [data ].
+select sformat('{0}{1}{0}', 'abra', 'cad');
+sformat('{0}{1}{0}', 'abra', 'cad')
+abracadabra
+select sformat('Change Order {1} {0}', 'second', 'first');
+sformat('Change Order {1} {0}', 'second', 'first')
+Change Order first second
+#
+# Failed Format Test Cases
+#
+select sformat('Test {:c}', 'word');
+sformat('Test {:c}', 'word')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('Test {one} {two} {three}', 1, 2, 3);
+sformat('Test {one} {two} {three}', 1, 2, 3)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: argument not found
+select sformat('Number {:{<}', 8);
+sformat('Number {:{<}', 8)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid fill character '{'
+select sformat('Number {:10000000000}', 5);
+sformat('Number {:10000000000}', 5)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: number is too big
+select sformat('1={1} 2={2} 0={0}', 0, 1);
+sformat('1={1} 2={2} 0={0}', 0, 1)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: argument not found
+select sformat('Number {:.2d}', 42);
+sformat('Number {:.2d}', 42)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: precision not allowed for this argument type
+select sformat('You scored {:.0%}', 0.25);
+sformat('You scored {:.0%}', 0.25)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('You scored {:%}', 0.25);
+sformat('You scored {:%}', 0.25)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('The price is {:f} dollars.', 45);
+sformat('The price is {:f} dollars.', 45)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('The price is {:.2f} dollars.', 45);
+sformat('The price is {:.2f} dollars.', 45)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: precision not allowed for this argument type
+select sformat('We have {:E} chickens.', 5);
+sformat('We have {:E} chickens.', 5)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('We have {:e} chickens.', 5);
+sformat('We have {:e} chickens.', 5)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('The universe is {:,} years old.', 13800000000);
+sformat('The universe is {:,} years old.', 13800000000)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('The universe is {:_} years old.', 13800000000);
+sformat('The universe is {:_} years old.', 13800000000)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+select sformat('String {:-}', 'hello');
+sformat('String {:-}', 'hello')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: format specifier requires numeric argument
+#
+# Table Format Test Cases
+#
+create table t1 (pformat text, data1 FLOAT, data2 INT,
+data3 VARCHAR(30));
+insert into t1 values ('{:.2f} {: } |{:*^15}', 1.11, 1, 'example I'),
+('{:.1f} {:-} |{:^15}', -2.22, -2, 'example II'),
+('{:.2f} {:+} |{:<15}', 3.33, 3, 'example III'),
+('{:.4f} {:d} |{:^15}', -4.44, -4, 'example IV');
+select sformat(pformat, data1, data2, data3) from t1;
+sformat(pformat, data1, data2, data3)
+1.11 1 |***example I***
+-2.2 -2 | example II
+3.33 +3 |example III
+-4.4400 -4 | example IV
+drop table t1;
+create table t2 (a double);
+insert into t2 values (3.14159265358979323846);
+select a, sformat('{:.15f}', a) from t2;
+a sformat('{:.15f}', a)
+3.141592653589793 3.141592653589793
+drop table t2;
+#
+# Unsupported/disabled features
+#
+select sformat('{:p}', '50');
+sformat('{:p}', '50')
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+#
+# ucs2 test
+#
+select sformat('={}=', _ucs2 x'006100620063');
+sformat('={}=', _ucs2 x'006100620063')
+=abc=
+set names utf8;
+select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442');
+sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')
+=теÑÑ‚=
+select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'));
+hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'))
+003D0442043504410442003D
+create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') as x;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` varchar(8) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+drop table t1;
+set names latin1;
+#
+# ps parameters
+#
+prepare s from 'select sformat("={:d}=", ?)';
+execute s using 100;
+sformat("={:d}=", ?)
+=100=
+execute s using 'abc';
+sformat("={:d}=", ?)
+NULL
+Warnings:
+Warning 4183 SFORMAT error: invalid type specifier
+#
+# MDEV-26691 SFORMAT: Pass down FLOAT as FLOAT, without upcast to DOUBLE
+#
+select sformat('{}', cast(1.1 as float));
+sformat('{}', cast(1.1 as float))
+1.1
+#
+# MDEV-26646 SFORMAT Does not allow @variable use
+#
+set names utf8;
+set @a=3.14;
+select sformat('{:f}', @a);
+sformat('{:f}', @a)
+3.140000
+set names latin1;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/func_sformat.test b/mysql-test/main/func_sformat.test
new file mode 100644
index 00000000000..cb7e7c8f1c1
--- /dev/null
+++ b/mysql-test/main/func_sformat.test
@@ -0,0 +1,255 @@
+echo #;
+echo # MDEV-25015 Custom formatting of strings in MariaDB queries;
+echo #;
+
+# Description
+# -----------
+# Test cases for the sformat function
+
+echo #;
+echo # Normal Test Cases;
+echo #;
+select sformat('string test');
+select sformat(0);
+select sformat('C');
+select sformat(-4.2);
+select sformat(5, 5, 5);
+#enable after fix MDEV-27871
+--disable_view_protocol
+select sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+--enable_view_protocol
+select sformat('{{{}}}', 0);
+select sformat('{{{}{{', 0);
+select sformat('{{{{{}{{', 'param1');
+select sformat(' {{ {{ {} {{ ', 'param1');
+select sformat(' {{ {} {}', 'param1', 'param2');
+select sformat('A{}C{}E{}', 'B', 'D', 'F');
+select sformat('{} {}', FALSE, TRUE);
+#enable after fix MDEV-29601
+--disable_service_connection
+select sformat('Add € != {} != {}?', '$', '£');
+select sformat('Check {} != {} != {}?', '€', '$', '£');
+--enable_service_connection
+select sformat('{}{}{}', 1, 2, 3);
+select sformat('Float {} Boolean {} Number {}', 3.14159, True, -50);
+select sformat('SUM {} + {} = {}', 2, 3, 2+3);
+select sformat('Numbers {} {} {}', 1, 1.11, 1.111);
+select sformat('what {} is {}?', 'time', 'it');
+#enable after fix MDEV-27871
+--disable_view_protocol
+select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}', 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120);
+select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
+ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}', '1', '2', '3 ',
+ '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
+ '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36',
+ '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52',
+ '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68',
+ '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84',
+ '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100',
+ '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114',
+ '115', '116', '117', '118', '119', '120');
+--enable_view_protocol
+
+echo #;
+echo # Error Test Cases;
+echo #;
+select sformat('R={ }', 42);
+select sformat(NULL, 'Null', 'Test');
+select sformat('Null Test {} {} ', 0, NULL);
+select sformat(NULL);
+select sformat('My { Test');
+select sformat('Test { {');
+select sformat('A{}C{}E{}', 'B', 'D');
+error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT;
+select sformat();
+error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT;
+echo #;
+echo # Table Test Cases;
+echo #;
+create table t1 (param1 text, param2 text, param3 int);
+insert into t1 values ('string: {}, number: {}', 'xyz', 123),
+ ('something {} went {} wrong {}', 'foo', 0),
+ ('Test case {} -> {}', 'Print', -32);
+select sformat(param1, param2, param3) from t1;
+drop table t1;
+
+create table t2 (param1 FLOAT, param2 SMALLINT, param3 CHAR, param4 DATE);
+insert into t2 values (0.0025, 25, 'A', DATE('2020-06-29')),
+ (0.0005, 5, 'B', DATE('2020-6-29')),
+ (5.5555, -5, 'C', DATE('200629')),
+ (-9, -9, 'D', DATE('20*06*29'));
+#enable after fix MDEV-27871
+--disable_view_protocol
+select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) from t2;
+--enable_view_protocol
+drop table t2;
+
+set names utf8;
+create table t3 (format_str text character set 'latin1',
+ first_param text character set 'utf8',
+ second_param text character set 'latin1');
+insert into t3 values ('test 1 {} {}', UNHEX('C3A5'), UNHEX('E5'));
+select sformat(format_str, first_param, second_param) from t3;
+select HEX(sformat(format_str, first_param, second_param)) from t3;
+drop table t3;
+set names latin1;
+
+create table t4 (p1 bit(8), p2 boolean, p3 DECIMAL, p4 TIMESTAMP);
+insert into t4 values (42, TRUE, 42, '2021-08-18 16:50:07'),
+ (24, FALSE, 24, '0000-00-00 00:00:00');
+select sformat('{}: {} {} {} {}', 'Data', p1, p2, p3, p4) from t4;
+drop table t4;
+
+set names utf8;
+create table t5 (param text character SET utf8 COLLATE utf8_general_ci);
+insert into t5 values (UNHEX('C3A5')),(UNHEX('C5BB')),(UNHEX('e0b1bb')),
+ (UNHEX('C38A')), (NULL);
+select sformat('{}', param) from t5;
+select HEX(sformat('{}', param)) from t5;
+drop table t5;
+set names latin1;
+
+echo #;
+echo # Format Test Cases;
+echo #;
+select sformat('Num {:L}', 13800000000);
+#enable after fix MDEV-29646
+--disable_view_protocol
+select sformat('Num [{:20}]', 42);
+--enable_view_protocol
+select sformat('Number: {:*^{}}', 4, 5);
+select sformat('{:02} - {:02} - {:02}', 1, 2, 3);
+select sformat('Character {:c}', 104);
+select sformat('String {:s}', 'hello');
+select sformat('Large {0:+010.4g}', 392.64);
+select sformat('Large {:g}', 392.65);
+select sformat('Float {:.2f}', 42.0);
+select sformat('Float {:f}', 42.0);
+select sformat('Number {:d}', 42);
+select sformat('Number {:{}}', 5, 5);
+#enable after fix MDEV-29646
+--disable_view_protocol
+select sformat('Number [{:10}]', 9999);
+--enable_view_protocol
+select sformat('Number {:.3}', 3.1416);
+select sformat('int: {0:d}; hex: {0:x}; oct: {0:o}', 42);
+select sformat('int: {0:d}; hex: {0:#x}; oct: {0:#o}', 42);
+select sformat('The Hexadecimal version of {0} is {0:X}', 255);
+select sformat('The Hexadecimal version of {0} is {0:x}', 255);
+select sformat('The octal version of {0} is {0:o}', 10);
+select sformat('The binary version of {0} is {0:b}', 5);
+select sformat('{:+f}; {:+f}', 3.14, -3.14);
+select sformat('{: f}; {: f}', 3.14, -3.14);
+select sformat('{:-f}; {:-f}', 3.14, -3.14);
+#enable after fix MDEV-27871
+--disable_view_protocol
+select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7);
+select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7);
+select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7);
+--enable_view_protocol
+#check after fix MDEV-29646
+--disable_view_protocol
+select sformat('We have {:<8} chickens.', 49);
+--enable_view_protocol
+select sformat('Center alimgn [{:*^10}]', 'data');
+select sformat('Center aling [{:^10}].', 'data');
+select sformat('Right aling [{:>10}].', 'data');
+select sformat('Left align [{:<10}].', 'data');
+select sformat('{0}{1}{0}', 'abra', 'cad');
+select sformat('Change Order {1} {0}', 'second', 'first');
+
+echo #;
+echo # Failed Format Test Cases;
+echo #;
+select sformat('Test {:c}', 'word');
+select sformat('Test {one} {two} {three}', 1, 2, 3);
+select sformat('Number {:{<}', 8);
+select sformat('Number {:10000000000}', 5);
+select sformat('1={1} 2={2} 0={0}', 0, 1);
+select sformat('Number {:.2d}', 42);
+select sformat('You scored {:.0%}', 0.25);
+select sformat('You scored {:%}', 0.25);
+select sformat('The price is {:f} dollars.', 45);
+select sformat('The price is {:.2f} dollars.', 45);
+select sformat('We have {:E} chickens.', 5);
+select sformat('We have {:e} chickens.', 5);
+select sformat('The universe is {:,} years old.', 13800000000);
+select sformat('The universe is {:_} years old.', 13800000000);
+select sformat('String {:-}', 'hello');
+
+echo #;
+echo # Table Format Test Cases;
+echo #;
+create table t1 (pformat text, data1 FLOAT, data2 INT,
+ data3 VARCHAR(30));
+insert into t1 values ('{:.2f} {: } |{:*^15}', 1.11, 1, 'example I'),
+ ('{:.1f} {:-} |{:^15}', -2.22, -2, 'example II'),
+ ('{:.2f} {:+} |{:<15}', 3.33, 3, 'example III'),
+ ('{:.4f} {:d} |{:^15}', -4.44, -4, 'example IV');
+select sformat(pformat, data1, data2, data3) from t1;
+drop table t1;
+
+create table t2 (a double);
+insert into t2 values (3.14159265358979323846);
+select a, sformat('{:.15f}', a) from t2;
+drop table t2;
+
+echo #;
+echo # Unsupported/disabled features;
+echo #;
+select sformat('{:p}', '50');
+
+echo #;
+echo # ucs2 test;
+echo #;
+select sformat('={}=', _ucs2 x'006100620063');
+set names utf8;
+select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442');
+#enable after fix MDEV-27871
+--disable_view_protocol
+select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'));
+--enable_view_protocol
+create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') as x;
+show create table t1;
+drop table t1;
+set names latin1;
+
+echo #;
+echo # ps parameters;
+echo #;
+prepare s from 'select sformat("={:d}=", ?)';
+execute s using 100;
+execute s using 'abc';
+
+echo #;
+echo # MDEV-26691 SFORMAT: Pass down FLOAT as FLOAT, without upcast to DOUBLE;
+echo #;
+
+select sformat('{}', cast(1.1 as float));
+
+echo #;
+echo # MDEV-26646 SFORMAT Does not allow @variable use;
+echo #;
+
+set names utf8;
+set @a=3.14;
+select sformat('{:f}', @a);
+set names latin1;
+
+echo #;
+echo # End of 10.7 tests;
+echo #;
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index 62f6f3199b2..27d5810d5f6 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -2798,7 +2798,7 @@ SET sql_mode=DEFAULT;
#
# MDEV-13972 crash in Item_func_sec_to_time::get_date
#
-DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
+DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(SYS_GUID()))));
DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test
index 91b846e4c61..b0b9eb5c63c 100644
--- a/mysql-test/main/func_time.test
+++ b/mysql-test/main/func_time.test
@@ -1754,7 +1754,7 @@ SET sql_mode=DEFAULT;
# The below query can return warning sporadically
--disable_warnings
-DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
+DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(SYS_GUID()))));
--enable_warnings
DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result
index b00378d4ee9..48eab8e0734 100644
--- a/mysql-test/main/get_diagnostics.result
+++ b/mysql-test/main/get_diagnostics.result
@@ -628,7 +628,7 @@ v
NULL
Warnings:
Note 1050 Table 't1' already exists
-Error 1406 Data too long for column 'v' at row 1
+Error 1406 Data too long for column 'v' at row 0
DROP TABLE t1;
DROP PROCEDURE p1;
@@ -799,3 +799,1066 @@ CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo');
Warnings:
Warning 1406 Data too long for column 'a' at row 3
DROP TABLE t1, t2;
+#
+# End of 10.6 tests
+#
+#
+# MDEV-10075: Provide index of error causing error in array INSERT
+#
+#
+# INSERT STATEMENT
+#
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+# Simple INSERT statement
+INSERT INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+INSERT INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var1= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var2= ROW_NUMBER;
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var1, @var2;
+@var1 @var2
+2
+INSERT INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var3= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var4= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var3, @var4;
+@var3 @var4
+2 NULL
+INSERT INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+ERROR 21S01: Column count doesn't match value count at row 3
+GET DIAGNOSTICS CONDITION 1 @var5= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var6= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 3
+Error 1758 Invalid condition number
+SELECT @var5, @var6;
+@var5 @var6
+3 NULL
+INSERT INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var7= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var8= ROW_NUMBER;
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var7, @var8;
+@var7 @var8
+2 NULL
+INSERT INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+GET DIAGNOSTICS CONDITION 1 @var9= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var10= ROW_NUMBER;
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+Error 1758 Invalid condition number
+SELECT @var9, @var10;
+@var9 @var10
+2 NULL
+INSERT INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+ERROR 21000: Operand should contain 1 column(s)
+GET DIAGNOSTICS CONDITION 1 @var11= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var12= ROW_NUMBER;
+Warnings:
+Error 1241 Operand should contain 1 column(s)
+Error 1758 Invalid condition number
+SELECT @var11, @var12;
+@var11 @var12
+2 NULL
+delete from t1 where id1=0;
+INSERT INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (16/0,'p',1.0116);
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+GET DIAGNOSTICS CONDITION 1 @var13= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var14= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var15= ROW_NUMBER;
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+Error 1758 Invalid condition number
+SELECT @var13, @var14, @var15;
+@var13 @var14 @var15
+3 3 NULL
+TRUNCATE TABLE t1;
+# INSERT ... IGNORE
+INSERT IGNORE INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+INSERT IGNORE INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var16= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var17= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var18= ROW_NUMBER;
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var16, @var17, @var18;
+@var16 @var17 @var18
+2 3 NULL
+INSERT IGNORE INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var19= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var20= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var19, @var20;
+@var19 @var20
+2 NULL
+INSERT IGNORE INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+ERROR 21S01: Column count doesn't match value count at row 3
+GET DIAGNOSTICS CONDITION 1 @var21= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var22= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 3
+Error 1758 Invalid condition number
+SELECT @var21, @var22;
+@var21 @var22
+3 NULL
+INSERT IGNORE INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var23= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var24= ROW_NUMBER;
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var23, @var24;
+@var23 @var24
+2 NULL
+INSERT IGNORE INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+GET DIAGNOSTICS CONDITION 1 @var25= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var26= ROW_NUMBER;
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+Error 1758 Invalid condition number
+SELECT @var25, @var26;
+@var25 @var26
+2 NULL
+INSERT IGNORE INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+ERROR 21000: Operand should contain 1 column(s)
+GET DIAGNOSTICS CONDITION 1 @var27= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var28= ROW_NUMBER;
+Warnings:
+Error 1241 Operand should contain 1 column(s)
+Error 1758 Invalid condition number
+SELECT @var27, @var28;
+@var27 @var28
+2 NULL
+INSERT IGNORE INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115),
+(16/0,'p',1.0116);
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var29= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var30= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var31= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var32= ROW_NUMBER;
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var29, @var30, @var31, @var32;
+@var29 @var30 @var31 @var32
+3 3 3 NULL
+TRUNCATE TABLE t1;
+# INSERT ... SET
+INSERT INTO t1 SET id1=1, val1='a', d1=1.00101;
+INSERT INTO t1 SET id1=2, val1='b', d1=1.00102;
+INSERT INTO t1 SET id1=3, val1='c', d1=1.00103;
+INSERT INTO t1 SET id1=1, val1='a', d1=1.00101;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var33= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var34= ROW_NUMBER;
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var33, @var34;
+@var33 @var34
+1 NULL
+INSERT INTO t1 SET id1=6, val1='f', d1=1.79769313486232e+308);
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var35= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var36= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var35, @var36;
+@var35 @var36
+1 NULL
+INSERT INTO t1 SET id1=9, val1=CAST(123 AS CHAR(1)), d1=1.00109;
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var37= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var38= ROW_NUMBER;
+Warnings:
+Error 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var37, @var38;
+@var37 @var38
+1 NULL
+INSERT INTO t1 SET id1='x', val1='foo', d1=1.0203;
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 1
+GET DIAGNOSTICS CONDITION 1 @var39= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var40= ROW_NUMBER;
+Warnings:
+Error 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 1
+Error 1758 Invalid condition number
+SELECT @var39, @var40;
+@var39 @var40
+1 NULL
+INSERT INTO t1 SET id1=3/0, val1='p', d1=1.0116;
+ERROR 22012: Division by 0
+GET DIAGNOSTICS CONDITION 1 @var41= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var42= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var43= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var44= ROW_NUMBER;
+Warnings:
+Error 1365 Division by 0
+Error 1048 Column 'id1' cannot be null
+Error 1105 Unknown error
+Error 1758 Invalid condition number
+SELECT @var41, @var42, @var43, @var44;
+@var41 @var42 @var43 @var44
+1 1 1 NULL
+TRUNCATE TABLE t1;
+# INSERT ... ON DUPLICATE KEY UPDATE
+INSERT INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+INSERT INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101)
+ON DUPLICATE KEY UPDATE val1='a', d1=1.00101;
+GET DIAGNOSTICS CONDITION 1 @var45= ROW_NUMBER;
+Warnings:
+Error 1758 Invalid condition number
+GET DIAGNOSTICS CONDITION 2 @var46= ROW_NUMBER;
+Warnings:
+Error 1758 Invalid condition number
+Error 1758 Invalid condition number
+SELECT @var45, @var46;
+@var45 @var46
+NULL NULL
+INSERT INTO t1 VALUES (5,'e',1.00105),(3,'f',1.79769313486232e+308)
+ON DUPLICATE KEY UPDATE val1='c';
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var47= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var48= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var47, @var48;
+@var47 @var48
+2 NULL
+INSERT INTO t1 VALUES (5,'e',1.00105), (3,'i')
+ON DUPLICATE KEY UPDATE val1='c';
+ERROR 21S01: Column count doesn't match value count at row 2
+GET DIAGNOSTICS CONDITION 1 @var49= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var50= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 2
+Error 1758 Invalid condition number
+SELECT @var49, @var50;
+@var49 @var50
+2 NULL
+INSERT INTO t1 VALUES (3, CAST(123 AS CHAR(1)), 1.00103)
+ON DUPLICATE KEY UPDATE val1='c';
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var51= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var52= ROW_NUMBER;
+Warnings:
+Error 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var51, @var52;
+@var51 @var52
+1 NULL
+INSERT INTO t1 VALUES (10,10,10),('x','foo',1.0203)
+ON DUPLICATE KEY UPDATE val1='c';
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+GET DIAGNOSTICS CONDITION 1 @var53= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var54= ROW_NUMBER;
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+Error 1758 Invalid condition number
+SELECT @var53, @var54;
+@var53 @var54
+2 NULL
+INSERT INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113)) ON DUPLICATE KEY UPDATE val1='c';
+ERROR 21000: Operand should contain 1 column(s)
+GET DIAGNOSTICS CONDITION 1 @var55= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var56= ROW_NUMBER;
+Warnings:
+Error 1241 Operand should contain 1 column(s)
+Error 1758 Invalid condition number
+SELECT @var55, @var56;
+@var55 @var56
+2 NULL
+INSERT INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (2/0,'p',1.00102)
+ON DUPLICATE KEY UPDATE val1='b';
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+GET DIAGNOSTICS CONDITION 1 @var57= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var58= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var59= ROW_NUMBER;
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+Error 1758 Invalid condition number
+SELECT @var57, @var58, @var59;
+@var57 @var58 @var59
+3 3 NULL
+INSERT INTO t1 VALUES (1,'e',1.0),(5,'e',1.0),(5,'f',1.7)
+ON DUPLICATE KEY UPDATE id1='1';
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var60= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var61= ROW_NUMBER;
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var60, @var61;
+@var60 @var61
+3 NULL
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+DROP TABLE t2;
+INSERT ... SELECT
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+INSERT INTO t2 VALUES(1,'a',1.00101,PointFromText('POINT(20 10)')),
+(2,'b',1.00102,PointFromText('POINT(20 10)')),
+(3,'c',1.00103,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2;
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2 WHERE id2=1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var62= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var63= ROW_NUMBER;
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var62, @var63;
+@var62 @var63
+1 NULL
+INSERT INTO t1 SELECT id2, val2, p2 from t2;
+ERROR HY000: Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1`
+GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER;
+Warnings:
+Error 4078 Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1`
+Error 1758 Invalid condition number
+SELECT @var64, @var65;
+@var64 @var65
+1 NULL
+INSERT INTO t1 SELECT id2, val2 FROM t2;
+ERROR 21S01: Column count doesn't match value count at row 1
+GET DIAGNOSTICS CONDITION 1 @var66= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var67= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
+Error 1758 Invalid condition number
+SELECT @var66, @var67;
+@var66 @var67
+1 NULL
+INSERT INTO t2 VALUES(4,'a',1.00101,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, CAST(123 AS CHAR(1)), d2 FROM t2 WHERE id2=4;
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var68= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var69= ROW_NUMBER;
+Warnings:
+Error 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var68, @var69;
+@var68 @var69
+1 NULL
+INSERT INTO t1 SELECT id2, val2, 1.79769313486232e+308 FROM t2;
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var70= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var71= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var70, @var71;
+@var70 @var71
+1 NULL
+INSERT INTO t1 SELECT id2/0, val2, d2 FROM t2;
+ERROR 22012: Division by 0
+GET DIAGNOSTICS CONDITION 1 @var72= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var73= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var74= ROW_NUMBER;
+Warnings:
+Error 1365 Division by 0
+Error 1048 Column 'id1' cannot be null
+Error 1758 Invalid condition number
+SELECT @var72, @var73, @var74;
+@var72 @var73 @var74
+1 1 NULL
+DROP TABLE t1,t2;
+# Checking ROW_NUMBER in STORED PROCEDURE for INSERT
+CREATE TABLE t1(id1 INT PRIMARY KEY);
+CREATE PROCEDURE proc1 ()
+BEGIN
+DECLARE var75 INT;
+DECLARE var76 INT;
+INSERT INTO t1 VALUES (1),(2);
+INSERT IGNORE INTO t1 VALUES(2);
+GET DIAGNOSTICS CONDITION 1 var75= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 var76= ROW_NUMBER;
+SELECT var75, var76;
+END;
+|
+CALL proc1();
+var75 var76
+1 NULL
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Error 1758 Invalid condition number
+TRUNCATE TABLE t1;
+# Checking ROW_NUMBER in PREPARED STATEMENTS for INSERT
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT IGNORE INTO t1 VALUES(2),(3),(4);
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+PREPARE stmt1 FROM "GET DIAGNOSTICS CONDITION 2 @var77= ROW_NUMBER";
+EXECUTE stmt1;
+SELECT @var77;
+@var77
+2
+DROP PROCEDURE proc1;
+DROP PREPARE stmt1;
+DROP TABLE t1;
+#
+# REPLACE STATEMENT
+#
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE);
+# Simple REPLACE statement
+REPLACE INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+REPLACE INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+GET DIAGNOSTICS CONDITION 1 @var78= ROW_NUMBER;
+Warnings:
+Error 1758 Invalid condition number
+SELECT @var78;
+@var78
+NULL
+REPLACE INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var79= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var80= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var79, @var80;
+@var79 @var80
+2 NULL
+REPLACE INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+ERROR 21S01: Column count doesn't match value count at row 3
+GET DIAGNOSTICS CONDITION 1 @var81= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var82= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 3
+Error 1758 Invalid condition number
+SELECT @var81, @var82;
+@var81 @var82
+3 NULL
+REPLACE INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var83= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var84= ROW_NUMBER;
+Warnings:
+Warning 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var83, @var84;
+@var83 @var84
+2 NULL
+REPLACE INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+GET DIAGNOSTICS CONDITION 1 @var85= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var86= ROW_NUMBER;
+Warnings:
+Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 2
+Error 1758 Invalid condition number
+SELECT @var85, @var86;
+@var85 @var86
+2 NULL
+REPLACE INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+ERROR 21000: Operand should contain 1 column(s)
+GET DIAGNOSTICS CONDITION 1 @var87= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var88= ROW_NUMBER;
+Warnings:
+Error 1241 Operand should contain 1 column(s)
+Error 1758 Invalid condition number
+SELECT @var87, @var88;
+@var87 @var88
+2 NULL
+REPLACE INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (16/0,'p',1.0116);
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+GET DIAGNOSTICS CONDITION 1 @var89= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var90= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var91= ROW_NUMBER;
+Warnings:
+Warning 1365 Division by 0
+Warning 1048 Column 'id1' cannot be null
+Error 1758 Invalid condition number
+SELECT @var89, @var90, @var91;
+@var89 @var90 @var91
+3 3 NULL
+TRUNCATE TABLE t1;
+# REPLACE ... SET
+REPLACE INTO t1 SET id1=1, val1='a', d1=1.00101;
+REPLACE INTO t1 SET id1=2, val1='b', d1=1.00102;
+REPLACE INTO t1 SET id1=3, val1='c', d1=1.00103;
+REPLACE INTO t1 SET id1=1, val1='a', d1=1.00101;
+GET DIAGNOSTICS CONDITION 1 @var92= ROW_NUMBER;
+Warnings:
+Error 1758 Invalid condition number
+SELECT @var92;
+@var92
+NULL
+REPLACE INTO t1 SET id1=6, val1='f', d1=1.79769313486232e+308);
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var93= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var94= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var93, @var94;
+@var93 @var94
+1 NULL
+REPLACE INTO t1 SET id1=9, val1=CAST(123 AS CHAR(1)), d1=1.00109;
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var95= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var96= ROW_NUMBER;
+Warnings:
+Error 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var95, @var96;
+@var95 @var96
+1 NULL
+REPLACE INTO t1 SET id1='x', val1='foo', d1=1.0203;
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 1
+GET DIAGNOSTICS CONDITION 1 @var97= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var98= ROW_NUMBER;
+Warnings:
+Error 1366 Incorrect integer value: 'x' for column `test`.`t1`.`id1` at row 1
+Error 1758 Invalid condition number
+SELECT @var97, @var98;
+@var97 @var98
+1 NULL
+REPLACE INTO t1 SET id1=3/0, val1='p', d1=1.0116;
+ERROR 22012: Division by 0
+GET DIAGNOSTICS CONDITION 1 @var99= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var100= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var101= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var102= ROW_NUMBER;
+Warnings:
+Error 1365 Division by 0
+Error 1048 Column 'id1' cannot be null
+Error 1105 Unknown error
+Error 1758 Invalid condition number
+SELECT @var99, @var100, @var101, @var102;
+@var99 @var100 @var101 @var102
+1 1 1 NULL
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+DROP TABLE t2;
+# REPLACE ... SELECT
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+INSERT INTO t2 VALUES(1,'a',1.00101,PointFromText('POINT(20 10)')),
+(2,'b',1.00102,PointFromText('POINT(20 10)')),
+(3,'c',1.00103,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2;
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2 WHERE id2=1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @var103= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var104= ROW_NUMBER;
+Warnings:
+Error 1062 Duplicate entry '1' for key 'PRIMARY'
+Error 1758 Invalid condition number
+SELECT @var103, @var104;
+@var103 @var104
+1 NULL
+INSERT INTO t1 SELECT id2, val2, p2 from t2;
+ERROR HY000: Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1`
+GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER;
+Warnings:
+Error 4078 Cannot cast 'point' as 'double' in assignment of `test`.`t1`.`d1`
+Error 1758 Invalid condition number
+SELECT @var105, @var106;
+@var105 @var106
+1 NULL
+INSERT INTO t1 SELECT id2, val2 FROM t2;
+ERROR 21S01: Column count doesn't match value count at row 1
+GET DIAGNOSTICS CONDITION 1 @var107= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var108= ROW_NUMBER;
+Warnings:
+Error 1136 Column count doesn't match value count at row 1
+Error 1758 Invalid condition number
+SELECT @var107, @var108;
+@var107 @var108
+1 NULL
+INSERT INTO t2 VALUES(4,'a',1.00101,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, CAST(123 AS CHAR(1)), d2 FROM t2 WHERE id2=4;
+ERROR 22007: Truncated incorrect CHAR(1) value: '123'
+GET DIAGNOSTICS CONDITION 1 @var109= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var110= ROW_NUMBER;
+Warnings:
+Error 1292 Truncated incorrect CHAR(1) value: '123'
+Error 1758 Invalid condition number
+SELECT @var109, @var110;
+@var109 @var110
+1 NULL
+INSERT INTO t1 SELECT id2, val2, 1.79769313486232e+308 FROM t2;
+ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
+GET DIAGNOSTICS CONDITION 1 @var111= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var112= ROW_NUMBER;
+Warnings:
+Error 1367 Illegal double '1.79769313486232e+308' value found during parsing
+Error 1758 Invalid condition number
+SELECT @var111, @var112;
+@var111 @var112
+1 NULL
+INSERT INTO t1 SELECT id2/0, val2, d2 FROM t2;
+ERROR 22012: Division by 0
+GET DIAGNOSTICS CONDITION 1 @var113= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var114= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var115= ROW_NUMBER;
+Warnings:
+Error 1365 Division by 0
+Error 1048 Column 'id1' cannot be null
+Error 1758 Invalid condition number
+SELECT @var113, @var114, @var115;
+@var113 @var114 @var115
+1 1 NULL
+DROP TABLE t1,t2;
+# Checking ROW_NUMBER in STORED PROCEDURE
+CREATE TABLE t1(id1 INT PRIMARY KEY);
+CREATE PROCEDURE proc1 ()
+BEGIN
+DECLARE var116 INT;
+REPLACE INTO t1 VALUES (1),(2);
+GET DIAGNOSTICS CONDITION 1 var116= ROW_NUMBER;
+SELECT var116;
+END;
+|
+CALL proc1();
+var116
+NULL
+Warnings:
+Error 1758 Invalid condition number
+TRUNCATE TABLE t1;
+# Checking ROW_NUMBER in PREPARED STATEMENTS
+REPLACE INTO t1 VALUES (1), (2), (3);
+PREPARE stmt1 FROM "GET DIAGNOSTICS CONDITION 2 @var117= ROW_NUMBER";
+EXECUTE stmt1;
+Warnings:
+Error 1758 Invalid condition number
+SELECT @var117;
+@var117
+NULL
+DROP PROCEDURE proc1;
+DROP PREPARE stmt1;
+DROP TABLE t1;
+#
+# Checking that ROW_NUMBER is only for errors with rows/values
+#
+# INSERT STATEMENT
+CREATE TABLE t1(id1 INT);
+CREATE TABLE t2(id2 INT);
+CREATE VIEW v AS SELECT t1.id1 AS A, t2.id2 AS b FROM t1,t2;
+INSERT INTO t1(id1, id1) VALUES (1,1);
+ERROR 42000: Column 'id1' specified twice
+GET DIAGNOSTICS CONDITION 1 @var118= ROW_NUMBER;
+SELECT @var118;
+@var118
+0
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+INSERT INTO t1 VALUES (1);
+RETURN 1;
+END |
+INSERT INTO t1 VALUES (1), (f1());
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
+GET DIAGNOSTICS CONDITION 1 @var119= ROW_NUMBER;
+SELECT @var119;
+@var119
+0
+INSERT INTO t1 VALUES (1) RETURNING id2;
+ERROR 42S22: Unknown column 'id2' in 'field list'
+GET DIAGNOSTICS CONDITION 1 @var120= ROW_NUMBER;
+SELECT @var120;
+@var120
+0
+INSERT INTO t1(id2) VALUES(1);
+ERROR 42S22: Unknown column 'id2' in 'field list'
+GET DIAGNOSTICS CONDITION 1 @var121= ROW_NUMBER;
+SELECT @var121;
+@var121
+0
+INSERT INTO v VALUES(1,2);
+ERROR HY000: Can not insert into join view 'test.v' without fields list
+GET DIAGNOSTICS CONDITION 1 @var122= ROW_NUMBER;
+SELECT @var122;
+@var122
+0
+INSERT INTO v(a,b) VALUES (1,2);
+ERROR HY000: Can not modify more than one base table through a join view 'test.v'
+GET DIAGNOSTICS CONDITION 1 @var123= ROW_NUMBER;
+SELECT @var123;
+@var123
+0
+# REPLACE STATEMENT
+REPLACE INTO t1(id1, id1) VALUES (1,1);
+ERROR 42000: Column 'id1' specified twice
+GET DIAGNOSTICS CONDITION 1 @var124= ROW_NUMBER;
+SELECT @var124;
+@var124
+0
+CREATE FUNCTION f2() RETURNS INT
+BEGIN
+REPLACE INTO t1 VALUES (1);
+RETURN 1;
+END |
+REPLACE INTO t1 VALUES (1), (f2());
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
+GET DIAGNOSTICS CONDITION 1 @var125= ROW_NUMBER;
+SELECT @var125;
+@var125
+0
+REPLACE INTO t1 VALUES (1) RETURNING id2;
+ERROR 42S22: Unknown column 'id2' in 'field list'
+GET DIAGNOSTICS CONDITION 1 @var126= ROW_NUMBER;
+SELECT @var126;
+@var126
+0
+REPLACE INTO t1(id2) VALUES(1);
+ERROR 42S22: Unknown column 'id2' in 'field list'
+GET DIAGNOSTICS CONDITION 1 @var127= ROW_NUMBER;
+SELECT @var127;
+@var127
+0
+REPLACE INTO v VALUES(1,2);
+ERROR HY000: Can not insert into join view 'test.v' without fields list
+GET DIAGNOSTICS CONDITION 1 @var128= ROW_NUMBER;
+SELECT @var128;
+@var128
+0
+REPLACE INTO v(a,b) VALUES (1,2);
+ERROR HY000: Can not modify more than one base table through a join view 'test.v'
+GET DIAGNOSTICS CONDITION 1 @var129= ROW_NUMBER;
+SELECT @var129;
+@var129
+0
+DROP TABLE t1,t2;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP VIEW v;
+#
+# MDEV-26606: ROW_NUMBER property value isn't passed from inside a
+# stored procedure
+#
+# Test 1: Without RESIGNAL
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY);
+CREATE OR REPLACE PROCEDURE sp(a INT) INSERT INTO t1 VALUES (2),(a);
+SET @num=null, @msg=null;
+INSERT INTO t1 VALUES(1);
+CALL sp(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @num, @msg;
+@num @msg
+2 Duplicate entry '1' for key 'PRIMARY'
+DROP PROCEDURE sp;
+DROP TABLE t1;
+# Test 2: With RESIGNAL
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY);
+CREATE OR REPLACE PROCEDURE sp(a INT)
+BEGIN
+DECLARE n INT;
+DECLARE m VARCHAR(255);
+DECLARE EXIT HANDLER FOR 1062
+BEGIN
+GET DIAGNOSTICS CONDITION 1 n = ROW_NUMBER, m = MESSAGE_TEXT;
+SELECT n, m;
+RESIGNAL;
+END;
+INSERT INTO t1 VALUES (2), (a);
+END |
+SET @num=null, @msg=null;
+INSERT INTO t1 VALUES (1);
+CALL sp(1);
+n m
+2 Duplicate entry '1' for key 'PRIMARY'
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @num, @msg;
+@num @msg
+2 Duplicate entry '1' for key 'PRIMARY'
+DROP PROCEDURE sp;
+DROP TABLE t1;
+# Checking more errors
+CREATE TABLE t1 (val1 TINYINT);
+CREATE PROCEDURE sp(a INT) INSERT INTO t1 VALUES (2),(a);
+INSERT INTO t1 VALUES(1);
+CALL sp(100000);
+Warnings:
+Warning 1264 Out of range value for column 'val1' at row 2
+GET DIAGNOSTICS CONDITION 1 @var1= ROW_NUMBER;
+SELECT @var1;
+@var1
+2
+DROP TABLE t1;
+DROP PROCEDURE sp;
+#
+# MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
+Warnings:
+Error 1758 Invalid condition number
+SHOW WARNINGS;
+Level Code Message
+Error 1758 Invalid condition number
+GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @ind, @msg;
+@ind @msg
+0 Invalid condition number
+INSERT INTO t1 VALUES (3),(4);
+GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+Warnings:
+Error 1758 Invalid condition number
+SELECT @ind, @msg;
+@ind @msg
+0 Invalid condition number
+GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+Warnings:
+Error 1758 Invalid condition number
+Error 1758 Invalid condition number
+SELECT @ind, @msg;
+@ind @msg
+0 Invalid condition number
+DROP TABLE t1;
+#
+# MDEV-26681: ROW_NUMBER is not available within compound statement blocks
+#
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, a CHAR(3));
+INSERT IGNORE INTO t1 VALUES (1,'foo'),(1,'bar'),(2,'foobar');
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1265 Data truncated for column 'a' at row 3
+BEGIN NOT ATOMIC
+DECLARE i INT DEFAULT 0;
+DECLARE rnum INT DEFAULT -1;
+DECLARE msg VARCHAR(1024) DEFAULT '';
+DECLARE err INT DEFAULT -1;
+WHILE i < @@warning_count
+DO
+SET i = i + 1;
+GET DIAGNOSTICS CONDITION i rnum = ROW_NUMBER, msg = MESSAGE_TEXT, err = MYSQL_ERRNO;
+SELECT i, rnum, msg, err;
+END WHILE;
+END |
+i rnum msg err
+1 2 Duplicate entry '1' for key 'PRIMARY' 1062
+i rnum msg err
+2 3 Data truncated for column 'a' at row 3 1265
+GET DIAGNOSTICS CONDITION 1 @rnum = ROW_NUMBER, @msg = MESSAGE_TEXT, @err = MYSQL_ERRNO;
+select @rnum, @msg, @err;
+@rnum @msg @err
+2 Duplicate entry '1' for key 'PRIMARY' 1062
+GET DIAGNOSTICS CONDITION 2 @rnum = ROW_NUMBER, @msg = MESSAGE_TEXT, @err = MYSQL_ERRNO;
+SELECT @rnum, @msg, @err;
+@rnum @msg @err
+3 Data truncated for column 'a' at row 3 1265
+DROP TABLE t1;
+#
+# ROW_NUMBER differs from the number in the error message upon
+# ER_WARN_DATA_OUT_OF_RANGE
+#
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1),(2);
+SELECT CAST(a AS DECIMAL(2,2)) AS f FROM t;
+f
+0.99
+0.99
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'f' at row 2
+GET DIAGNOSTICS CONDITION 2 @n= ROW_NUMBER, @m = MESSAGE_TEXT;
+SELECT @n, @m;
+@n @m
+2 Out of range value for column 'f' at row 2
+DROP TABLE t;
+#
+# MDEV-26832: ROW_NUMBER in SIGNAL/RESIGNAL causes a syntax error
+#
+# using signal
+CREATE PROCEDURE signal_syntax()
+BEGIN
+DECLARE errno INT DEFAULT 0;
+DECLARE msg TEXT DEFAULT "foo";
+DECLARE row_num INT DEFAULT 0;
+DECLARE cond CONDITION FOR SQLSTATE "01234";
+DECLARE CONTINUE HANDLER for 1012
+BEGIN
+GET DIAGNOSTICS CONDITION 1 errno = MYSQL_ERRNO, msg = MESSAGE_TEXT, row_num= ROW_NUMBER;
+END;
+SIGNAL cond SET MESSAGE_TEXT = "Signal message", MYSQL_ERRNO = 1012, ROW_NUMBER= 5;
+SELECT errno, msg, row_num;
+END|
+CALL signal_syntax();
+errno msg row_num
+1012 Signal message 5
+DROP PROCEDURE signal_syntax;
+# using resignal
+CREATE PROCEDURE resignal_syntax()
+BEGIN
+DECLARE CONTINUE HANDLER
+FOR 1146
+BEGIN
+RESIGNAL SET
+MESSAGE_TEXT = '`temptab` does not exist', ROW_NUMBER= 105;
+END;
+SELECT `c` FROM `temptab`;
+END|
+CALL resignal_syntax();
+ERROR 42S02: `temptab` does not exist
+GET DIAGNOSTICS CONDITION 1 @row_num= ROW_NUMBER;
+SELECT @row_num;
+@row_num
+105
+DROP PROCEDURE resignal_syntax;
+#
+# MDEV-26842: ROW_NUMBER is not set and differs from the message upon
+# WARN_DATA_TRUNCATED produced by inplace ALTER
+#
+CREATE TABLE t1 (a VARCHAR(64)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('foo'),(null);
+ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
+ERROR 01000: Data truncated for column 'a' at row 2
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+@n @m
+2 Data truncated for column 'a' at row 2
+DROP TABLE t1;
+#
+# MDEV-26841: ROW_NUMBER is not set and differs from the message upon
+# ER_WRONG_VALUE_COUNT_ON_ROW for the 1st row
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1,2),(3);
+ERROR 21S01: Column count doesn't match value count at row 1
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+@n @m
+1 Column count doesn't match value count at row 1
+INSERT INTO t1(a) VALUES(1,2), (3);
+ERROR 21S01: Column count doesn't match value count at row 1
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+@n @m
+1 Column count doesn't match value count at row 1
+DROP TABLE t1;
+#
+# MDEV-26830: Wrong ROW_NUMBER in diagnostics upon INSERT IGNORE with
+# CHECK violation
+#
+CREATE TABLE t1 (a INT, CHECK(a>0));
+INSERT IGNORE INTO t1 VALUES (1),(0),(2),(0);
+Warnings:
+Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+@n
+2
+GET DIAGNOSTICS CONDITION 2 @n= ROW_NUMBER;
+SELECT @n;
+@n
+4
+DROP TABLE t1;
+#
+# MDEV-26844: DELETE returns ROW_NUMBER=1 for every row upon
+# ER_TRUNCATED_WRONG_VALUE
+#
+# without ORDER BY
+CREATE TABLE t (a VARCHAR(8));
+INSERT INTO t VALUES ('val1'),('val2'),('100'),('val4');
+SELECT * FROM t;
+a
+val1
+val2
+100
+val4
+DELETE FROM t WHERE a = 100;
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: 'val1'
+Warning 1292 Truncated incorrect DECIMAL value: 'val2'
+Warning 1292 Truncated incorrect DECIMAL value: 'val4'
+SHOW WARNINGS;
+Level Code Message
+Warning 1292 Truncated incorrect DECIMAL value: 'val1'
+Warning 1292 Truncated incorrect DECIMAL value: 'val2'
+Warning 1292 Truncated incorrect DECIMAL value: 'val4'
+GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER;
+SELECT @n;
+@n
+4
+DROP TABLE t;
+#
+# MDEV-26695: Number of an invalid row is not calculated for table value constructor
+#
+CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo');
+Warnings:
+Warning 1406 Data too long for column 'a' at row 3
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+@n
+3
+CREATE TABLE t2 (a CHAR(1)) VALUES ('a'),('b') UNION VALUES ('foo');
+Warnings:
+Warning 1406 Data too long for column 'a' at row 3
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+@n
+3
+DROP TABLE t1, t2;
+# Checking that CREATE ... SELECT works
+CREATE TABLE t1 (val1 CHAR(5));
+INSERT INTO t1 VALUES ('A'),('B'),('C'),('DEF');
+CREATE TABLE t2 (val2 CHAR(1)) SELECT val1 as val2 FROM t1;
+Warnings:
+Warning 1406 Data too long for column 'val2' at row 4
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+@n
+4
+SELECT * FROM t2;
+val2
+A
+B
+C
+D
+DROP TABLE t1,t2;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test
index 86643db3b5a..27c98069384 100644
--- a/mysql-test/main/get_diagnostics.test
+++ b/mysql-test/main/get_diagnostics.test
@@ -1,3 +1,5 @@
+--source include/have_innodb.inc
+
SET NAMES utf8;
--echo #
@@ -863,3 +865,870 @@ CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo');
CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo');
DROP TABLE t1, t2;
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
+
+--echo #
+--echo # MDEV-10075: Provide index of error causing error in array INSERT
+--echo #
+
+--echo #
+--echo # INSERT STATEMENT
+--echo #
+
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+
+
+--echo # Simple INSERT statement
+
+INSERT INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+GET DIAGNOSTICS CONDITION 1 @var1= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var2= ROW_NUMBER;
+SELECT @var1, @var2;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+GET DIAGNOSTICS CONDITION 1 @var3= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var4= ROW_NUMBER;
+SELECT @var3, @var4;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+GET DIAGNOSTICS CONDITION 1 @var5= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var6= ROW_NUMBER;
+SELECT @var5, @var6;
+
+INSERT INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+GET DIAGNOSTICS CONDITION 1 @var7= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var8= ROW_NUMBER;
+SELECT @var7, @var8;
+
+INSERT INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+GET DIAGNOSTICS CONDITION 1 @var9= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var10= ROW_NUMBER;
+SELECT @var9, @var10;
+
+--error ER_OPERAND_COLUMNS
+INSERT INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+GET DIAGNOSTICS CONDITION 1 @var11= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var12= ROW_NUMBER;
+SELECT @var11, @var12;
+
+delete from t1 where id1=0;
+INSERT INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (16/0,'p',1.0116);
+GET DIAGNOSTICS CONDITION 1 @var13= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var14= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var15= ROW_NUMBER;
+SELECT @var13, @var14, @var15;
+
+TRUNCATE TABLE t1;
+
+--echo # INSERT ... IGNORE
+
+INSERT IGNORE INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+INSERT IGNORE INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+GET DIAGNOSTICS CONDITION 1 @var16= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var17= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var18= ROW_NUMBER;
+SELECT @var16, @var17, @var18;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT IGNORE INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+GET DIAGNOSTICS CONDITION 1 @var19= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var20= ROW_NUMBER;
+SELECT @var19, @var20;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT IGNORE INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+GET DIAGNOSTICS CONDITION 1 @var21= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var22= ROW_NUMBER;
+SELECT @var21, @var22;
+
+INSERT IGNORE INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+GET DIAGNOSTICS CONDITION 1 @var23= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var24= ROW_NUMBER;
+SELECT @var23, @var24;
+
+INSERT IGNORE INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+GET DIAGNOSTICS CONDITION 1 @var25= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var26= ROW_NUMBER;
+SELECT @var25, @var26;
+
+--error ER_OPERAND_COLUMNS
+INSERT IGNORE INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+GET DIAGNOSTICS CONDITION 1 @var27= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var28= ROW_NUMBER;
+SELECT @var27, @var28;
+
+INSERT IGNORE INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115),
+(16/0,'p',1.0116);
+GET DIAGNOSTICS CONDITION 1 @var29= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var30= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var31= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var32= ROW_NUMBER;
+SELECT @var29, @var30, @var31, @var32;
+
+TRUNCATE TABLE t1;
+
+--echo # INSERT ... SET
+
+INSERT INTO t1 SET id1=1, val1='a', d1=1.00101;
+INSERT INTO t1 SET id1=2, val1='b', d1=1.00102;
+INSERT INTO t1 SET id1=3, val1='c', d1=1.00103;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 SET id1=1, val1='a', d1=1.00101;
+GET DIAGNOSTICS CONDITION 1 @var33= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var34= ROW_NUMBER;
+SELECT @var33, @var34;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT INTO t1 SET id1=6, val1='f', d1=1.79769313486232e+308);
+GET DIAGNOSTICS CONDITION 1 @var35= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var36= ROW_NUMBER;
+SELECT @var35, @var36;
+
+
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 SET id1=9, val1=CAST(123 AS CHAR(1)), d1=1.00109;
+GET DIAGNOSTICS CONDITION 1 @var37= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var38= ROW_NUMBER;
+SELECT @var37, @var38;
+
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 SET id1='x', val1='foo', d1=1.0203;
+GET DIAGNOSTICS CONDITION 1 @var39= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var40= ROW_NUMBER;
+SELECT @var39, @var40;
+
+--error ER_DIVISION_BY_ZERO
+INSERT INTO t1 SET id1=3/0, val1='p', d1=1.0116;
+GET DIAGNOSTICS CONDITION 1 @var41= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var42= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var43= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var44= ROW_NUMBER;
+SELECT @var41, @var42, @var43, @var44;
+
+TRUNCATE TABLE t1;
+
+--echo # INSERT ... ON DUPLICATE KEY UPDATE
+
+INSERT INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+
+INSERT INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101)
+ON DUPLICATE KEY UPDATE val1='a', d1=1.00101;
+GET DIAGNOSTICS CONDITION 1 @var45= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var46= ROW_NUMBER;
+SELECT @var45, @var46;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT INTO t1 VALUES (5,'e',1.00105),(3,'f',1.79769313486232e+308)
+ON DUPLICATE KEY UPDATE val1='c';
+GET DIAGNOSTICS CONDITION 1 @var47= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var48= ROW_NUMBER;
+SELECT @var47, @var48;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (5,'e',1.00105), (3,'i')
+ON DUPLICATE KEY UPDATE val1='c';
+GET DIAGNOSTICS CONDITION 1 @var49= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var50= ROW_NUMBER;
+SELECT @var49, @var50;
+
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES (3, CAST(123 AS CHAR(1)), 1.00103)
+ON DUPLICATE KEY UPDATE val1='c';
+GET DIAGNOSTICS CONDITION 1 @var51= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var52= ROW_NUMBER;
+SELECT @var51, @var52;
+
+INSERT INTO t1 VALUES (10,10,10),('x','foo',1.0203)
+ON DUPLICATE KEY UPDATE val1='c';
+GET DIAGNOSTICS CONDITION 1 @var53= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var54= ROW_NUMBER;
+SELECT @var53, @var54;
+
+--error ER_OPERAND_COLUMNS
+INSERT INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113)) ON DUPLICATE KEY UPDATE val1='c';
+GET DIAGNOSTICS CONDITION 1 @var55= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var56= ROW_NUMBER;
+SELECT @var55, @var56;
+
+INSERT INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (2/0,'p',1.00102)
+ON DUPLICATE KEY UPDATE val1='b';
+GET DIAGNOSTICS CONDITION 1 @var57= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var58= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var59= ROW_NUMBER;
+SELECT @var57, @var58, @var59;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1,'e',1.0),(5,'e',1.0),(5,'f',1.7)
+ON DUPLICATE KEY UPDATE id1='1';
+GET DIAGNOSTICS CONDITION 1 @var60= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var61= ROW_NUMBER;
+SELECT @var60, @var61;
+
+TRUNCATE TABLE t1;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo INSERT ... SELECT
+
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+
+INSERT INTO t2 VALUES(1,'a',1.00101,PointFromText('POINT(20 10)')),
+ (2,'b',1.00102,PointFromText('POINT(20 10)')),
+ (3,'c',1.00103,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2 WHERE id2=1;
+GET DIAGNOSTICS CONDITION 1 @var62= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var63= ROW_NUMBER;
+SELECT @var62, @var63;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 SELECT id2, val2, p2 from t2;
+GET DIAGNOSTICS CONDITION 1 @var64= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var65= ROW_NUMBER;
+SELECT @var64, @var65;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 SELECT id2, val2 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var66= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var67= ROW_NUMBER;
+SELECT @var66, @var67;
+
+INSERT INTO t2 VALUES(4,'a',1.00101,PointFromText('POINT(20 10)'));
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 SELECT id2, CAST(123 AS CHAR(1)), d2 FROM t2 WHERE id2=4;
+GET DIAGNOSTICS CONDITION 1 @var68= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var69= ROW_NUMBER;
+SELECT @var68, @var69;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT INTO t1 SELECT id2, val2, 1.79769313486232e+308 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var70= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var71= ROW_NUMBER;
+SELECT @var70, @var71;
+
+
+--error ER_DIVISION_BY_ZERO
+INSERT INTO t1 SELECT id2/0, val2, d2 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var72= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var73= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var74= ROW_NUMBER;
+SELECT @var72, @var73, @var74;
+
+DROP TABLE t1,t2;
+
+--echo # Checking ROW_NUMBER in STORED PROCEDURE for INSERT
+
+CREATE TABLE t1(id1 INT PRIMARY KEY);
+
+DELIMITER |;
+
+CREATE PROCEDURE proc1 ()
+BEGIN
+
+ DECLARE var75 INT;
+ DECLARE var76 INT;
+
+ INSERT INTO t1 VALUES (1),(2);
+ INSERT IGNORE INTO t1 VALUES(2);
+
+ GET DIAGNOSTICS CONDITION 1 var75= ROW_NUMBER;
+ GET DIAGNOSTICS CONDITION 2 var76= ROW_NUMBER;
+
+ SELECT var75, var76;
+
+END;
+|
+
+DELIMITER ;|
+
+CALL proc1();
+TRUNCATE TABLE t1;
+
+--echo # Checking ROW_NUMBER in PREPARED STATEMENTS for INSERT
+
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT IGNORE INTO t1 VALUES(2),(3),(4);
+
+PREPARE stmt1 FROM "GET DIAGNOSTICS CONDITION 2 @var77= ROW_NUMBER";
+EXECUTE stmt1;
+SELECT @var77;
+
+DROP PROCEDURE proc1;
+DROP PREPARE stmt1;
+DROP TABLE t1;
+
+--echo #
+--echo # REPLACE STATEMENT
+--echo #
+
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE);
+
+
+--echo # Simple REPLACE statement
+
+REPLACE INTO t1 VALUES(1,'a',1.00101), (2,'b',1.00102), (3,'c',1.00103);
+REPLACE INTO t1 VALUES (4,'d',1.00104),(1,'a',1.00101),(2,'b',1.00102);
+GET DIAGNOSTICS CONDITION 1 @var78= ROW_NUMBER;
+SELECT @var78;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+REPLACE INTO t1 VALUES (5,'e',1.00105),(6,'f',1.79769313486232e+308);
+GET DIAGNOSTICS CONDITION 1 @var79= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var80= ROW_NUMBER;
+SELECT @var79, @var80;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+REPLACE INTO t1 VALUES (7,'g',1.00107),(8,'h',1.00108),(9,'i'),(10,'j');
+GET DIAGNOSTICS CONDITION 1 @var81= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var82= ROW_NUMBER;
+SELECT @var81, @var82;
+
+REPLACE INTO t1 VALUES (8,8,8),(9,CAST(123 AS CHAR(1)),1.00109);
+GET DIAGNOSTICS CONDITION 1 @var83= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var84= ROW_NUMBER;
+SELECT @var83, @var84;
+
+REPLACE INTO t1 VALUES (10,10,10),('x','foo',1.0203);
+GET DIAGNOSTICS CONDITION 1 @var85= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var86= ROW_NUMBER;
+SELECT @var85, @var86;
+
+--error ER_OPERAND_COLUMNS
+REPLACE INTO t1 VALUES (11,11,11),(12,12,(13,'m',1.0113));
+GET DIAGNOSTICS CONDITION 1 @var87= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var88= ROW_NUMBER;
+SELECT @var87, @var88;
+
+REPLACE INTO t1 VALUES (14,'n',1.0114), (15,'o',1.0115), (16/0,'p',1.0116);
+GET DIAGNOSTICS CONDITION 1 @var89= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var90= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var91= ROW_NUMBER;
+SELECT @var89, @var90, @var91;
+
+TRUNCATE TABLE t1;
+
+--echo # REPLACE ... SET
+
+REPLACE INTO t1 SET id1=1, val1='a', d1=1.00101;
+REPLACE INTO t1 SET id1=2, val1='b', d1=1.00102;
+REPLACE INTO t1 SET id1=3, val1='c', d1=1.00103;
+
+REPLACE INTO t1 SET id1=1, val1='a', d1=1.00101;
+GET DIAGNOSTICS CONDITION 1 @var92= ROW_NUMBER;
+SELECT @var92;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+REPLACE INTO t1 SET id1=6, val1='f', d1=1.79769313486232e+308);
+GET DIAGNOSTICS CONDITION 1 @var93= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var94= ROW_NUMBER;
+SELECT @var93, @var94;
+
+
+--error ER_TRUNCATED_WRONG_VALUE
+REPLACE INTO t1 SET id1=9, val1=CAST(123 AS CHAR(1)), d1=1.00109;
+GET DIAGNOSTICS CONDITION 1 @var95= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var96= ROW_NUMBER;
+SELECT @var95, @var96;
+
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+REPLACE INTO t1 SET id1='x', val1='foo', d1=1.0203;
+GET DIAGNOSTICS CONDITION 1 @var97= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var98= ROW_NUMBER;
+SELECT @var97, @var98;
+
+--error ER_DIVISION_BY_ZERO
+REPLACE INTO t1 SET id1=3/0, val1='p', d1=1.0116;
+GET DIAGNOSTICS CONDITION 1 @var99= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var100= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var101= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 4 @var102= ROW_NUMBER;
+SELECT @var99, @var100, @var101, @var102;
+
+TRUNCATE TABLE t1;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo # REPLACE ... SELECT
+
+CREATE TABLE t1(id1 INT PRIMARY KEY, val1 VARCHAR(10), d1 DOUBLE);
+CREATE TABLE t2(id2 INT PRIMARY KEY, val2 VARCHAR(10), d2 DOUBLE, p2 POINT);
+
+
+INSERT INTO t2 VALUES(1,'a',1.00101,PointFromText('POINT(20 10)')),
+ (2,'b',1.00102,PointFromText('POINT(20 10)')),
+ (3,'c',1.00103,PointFromText('POINT(20 10)'));
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2;
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 SELECT id2, val2, d2 FROM t2 WHERE id2=1;
+GET DIAGNOSTICS CONDITION 1 @var103= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var104= ROW_NUMBER;
+SELECT @var103, @var104;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 SELECT id2, val2, p2 from t2;
+GET DIAGNOSTICS CONDITION 1 @var105= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var106= ROW_NUMBER;
+SELECT @var105, @var106;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 SELECT id2, val2 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var107= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var108= ROW_NUMBER;
+SELECT @var107, @var108;
+
+INSERT INTO t2 VALUES(4,'a',1.00101,PointFromText('POINT(20 10)'));
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 SELECT id2, CAST(123 AS CHAR(1)), d2 FROM t2 WHERE id2=4;
+GET DIAGNOSTICS CONDITION 1 @var109= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var110= ROW_NUMBER;
+SELECT @var109, @var110;
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+INSERT INTO t1 SELECT id2, val2, 1.79769313486232e+308 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var111= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var112= ROW_NUMBER;
+SELECT @var111, @var112;
+
+
+--error ER_DIVISION_BY_ZERO
+INSERT INTO t1 SELECT id2/0, val2, d2 FROM t2;
+GET DIAGNOSTICS CONDITION 1 @var113= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 2 @var114= ROW_NUMBER;
+GET DIAGNOSTICS CONDITION 3 @var115= ROW_NUMBER;
+SELECT @var113, @var114, @var115;
+
+DROP TABLE t1,t2;
+
+--echo # Checking ROW_NUMBER in STORED PROCEDURE
+
+CREATE TABLE t1(id1 INT PRIMARY KEY);
+
+DELIMITER |;
+
+CREATE PROCEDURE proc1 ()
+BEGIN
+
+ DECLARE var116 INT;
+
+ REPLACE INTO t1 VALUES (1),(2);
+
+ GET DIAGNOSTICS CONDITION 1 var116= ROW_NUMBER;
+
+ SELECT var116;
+
+END;
+|
+
+DELIMITER ;|
+
+CALL proc1();
+TRUNCATE TABLE t1;
+
+--echo # Checking ROW_NUMBER in PREPARED STATEMENTS
+
+REPLACE INTO t1 VALUES (1), (2), (3);
+
+PREPARE stmt1 FROM "GET DIAGNOSTICS CONDITION 2 @var117= ROW_NUMBER";
+EXECUTE stmt1;
+SELECT @var117;
+
+DROP PROCEDURE proc1;
+DROP PREPARE stmt1;
+DROP TABLE t1;
+
+--echo #
+--echo # Checking that ROW_NUMBER is only for errors with rows/values
+--echo #
+
+--echo # INSERT STATEMENT
+
+CREATE TABLE t1(id1 INT);
+CREATE TABLE t2(id2 INT);
+CREATE VIEW v AS SELECT t1.id1 AS A, t2.id2 AS b FROM t1,t2;
+
+--error ER_FIELD_SPECIFIED_TWICE
+INSERT INTO t1(id1, id1) VALUES (1,1);
+GET DIAGNOSTICS CONDITION 1 @var118= ROW_NUMBER;
+SELECT @var118;
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ INSERT INTO t1 VALUES (1);
+ RETURN 1;
+END |
+delimiter ;|
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT INTO t1 VALUES (1), (f1());
+GET DIAGNOSTICS CONDITION 1 @var119= ROW_NUMBER;
+SELECT @var119;
+
+--error ER_BAD_FIELD_ERROR
+INSERT INTO t1 VALUES (1) RETURNING id2;
+GET DIAGNOSTICS CONDITION 1 @var120= ROW_NUMBER;
+SELECT @var120;
+
+--error ER_BAD_FIELD_ERROR
+INSERT INTO t1(id2) VALUES(1);
+GET DIAGNOSTICS CONDITION 1 @var121= ROW_NUMBER;
+SELECT @var121;
+
+--error ER_VIEW_NO_INSERT_FIELD_LIST
+INSERT INTO v VALUES(1,2);
+GET DIAGNOSTICS CONDITION 1 @var122= ROW_NUMBER;
+SELECT @var122;
+
+--error ER_VIEW_MULTIUPDATE
+INSERT INTO v(a,b) VALUES (1,2);
+GET DIAGNOSTICS CONDITION 1 @var123= ROW_NUMBER;
+SELECT @var123;
+
+--echo # REPLACE STATEMENT
+
+--error ER_FIELD_SPECIFIED_TWICE
+REPLACE INTO t1(id1, id1) VALUES (1,1);
+GET DIAGNOSTICS CONDITION 1 @var124= ROW_NUMBER;
+SELECT @var124;
+
+delimiter |;
+CREATE FUNCTION f2() RETURNS INT
+BEGIN
+ REPLACE INTO t1 VALUES (1);
+ RETURN 1;
+END |
+delimiter ;|
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+REPLACE INTO t1 VALUES (1), (f2());
+GET DIAGNOSTICS CONDITION 1 @var125= ROW_NUMBER;
+SELECT @var125;
+
+--error ER_BAD_FIELD_ERROR
+REPLACE INTO t1 VALUES (1) RETURNING id2;
+GET DIAGNOSTICS CONDITION 1 @var126= ROW_NUMBER;
+SELECT @var126;
+
+--error ER_BAD_FIELD_ERROR
+REPLACE INTO t1(id2) VALUES(1);
+GET DIAGNOSTICS CONDITION 1 @var127= ROW_NUMBER;
+SELECT @var127;
+
+--error ER_VIEW_NO_INSERT_FIELD_LIST
+REPLACE INTO v VALUES(1,2);
+GET DIAGNOSTICS CONDITION 1 @var128= ROW_NUMBER;
+SELECT @var128;
+
+--error ER_VIEW_MULTIUPDATE
+REPLACE INTO v(a,b) VALUES (1,2);
+GET DIAGNOSTICS CONDITION 1 @var129= ROW_NUMBER;
+SELECT @var129;
+
+DROP TABLE t1,t2;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP VIEW v;
+
+--echo #
+--echo # MDEV-26606: ROW_NUMBER property value isn't passed from inside a
+--echo # stored procedure
+--echo #
+
+--echo # Test 1: Without RESIGNAL
+
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY);
+CREATE OR REPLACE PROCEDURE sp(a INT) INSERT INTO t1 VALUES (2),(a);
+SET @num=null, @msg=null;
+
+INSERT INTO t1 VALUES(1);
+
+--error ER_DUP_ENTRY
+CALL sp(1);
+GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @num, @msg;
+
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+--echo # Test 2: With RESIGNAL
+
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY);
+
+DELIMITER |;
+CREATE OR REPLACE PROCEDURE sp(a INT)
+BEGIN
+ DECLARE n INT;
+ DECLARE m VARCHAR(255);
+ DECLARE EXIT HANDLER FOR 1062
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 n = ROW_NUMBER, m = MESSAGE_TEXT;
+ SELECT n, m;
+ RESIGNAL;
+ END;
+ INSERT INTO t1 VALUES (2), (a);
+END |
+DELIMITER ;|
+
+SET @num=null, @msg=null;
+INSERT INTO t1 VALUES (1);
+
+--error ER_DUP_ENTRY
+CALL sp(1);
+GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @num, @msg;
+
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+--echo # Checking more errors
+
+CREATE TABLE t1 (val1 TINYINT);
+
+CREATE PROCEDURE sp(a INT) INSERT INTO t1 VALUES (2),(a);
+
+INSERT INTO t1 VALUES(1);
+
+CALL sp(100000);
+GET DIAGNOSTICS CONDITION 1 @var1= ROW_NUMBER;
+SELECT @var1;
+
+DROP TABLE t1;
+DROP PROCEDURE sp;
+
+--echo #
+--echo # MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(2);
+
+GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
+SHOW WARNINGS;
+
+GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @ind, @msg;
+
+INSERT INTO t1 VALUES (3),(4);
+
+GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @ind, @msg;
+
+GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
+SELECT @ind, @msg;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26681: ROW_NUMBER is not available within compound statement blocks
+--echo #
+
+CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, a CHAR(3));
+INSERT IGNORE INTO t1 VALUES (1,'foo'),(1,'bar'),(2,'foobar');
+
+DELIMITER |;
+
+BEGIN NOT ATOMIC
+ DECLARE i INT DEFAULT 0;
+ DECLARE rnum INT DEFAULT -1;
+ DECLARE msg VARCHAR(1024) DEFAULT '';
+ DECLARE err INT DEFAULT -1;
+ WHILE i < @@warning_count
+ DO
+ SET i = i + 1;
+ GET DIAGNOSTICS CONDITION i rnum = ROW_NUMBER, msg = MESSAGE_TEXT, err = MYSQL_ERRNO;
+ SELECT i, rnum, msg, err;
+ END WHILE;
+END |
+
+DELIMITER ;|
+
+GET DIAGNOSTICS CONDITION 1 @rnum = ROW_NUMBER, @msg = MESSAGE_TEXT, @err = MYSQL_ERRNO;
+select @rnum, @msg, @err;
+
+GET DIAGNOSTICS CONDITION 2 @rnum = ROW_NUMBER, @msg = MESSAGE_TEXT, @err = MYSQL_ERRNO;
+SELECT @rnum, @msg, @err;
+
+DROP TABLE t1;
+
+--echo #
+--echo # ROW_NUMBER differs from the number in the error message upon
+--echo # ER_WARN_DATA_OUT_OF_RANGE
+--echo #
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (1),(2);
+SELECT CAST(a AS DECIMAL(2,2)) AS f FROM t;
+
+GET DIAGNOSTICS CONDITION 2 @n= ROW_NUMBER, @m = MESSAGE_TEXT;
+SELECT @n, @m;
+
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-26832: ROW_NUMBER in SIGNAL/RESIGNAL causes a syntax error
+--echo #
+
+--echo # using signal
+
+DELIMITER |;
+CREATE PROCEDURE signal_syntax()
+BEGIN
+ DECLARE errno INT DEFAULT 0;
+ DECLARE msg TEXT DEFAULT "foo";
+ DECLARE row_num INT DEFAULT 0;
+ DECLARE cond CONDITION FOR SQLSTATE "01234";
+ DECLARE CONTINUE HANDLER for 1012
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 errno = MYSQL_ERRNO, msg = MESSAGE_TEXT, row_num= ROW_NUMBER;
+ END;
+
+ SIGNAL cond SET MESSAGE_TEXT = "Signal message", MYSQL_ERRNO = 1012, ROW_NUMBER= 5;
+
+ SELECT errno, msg, row_num;
+END|
+DELIMITER ;|
+
+CALL signal_syntax();
+
+DROP PROCEDURE signal_syntax;
+
+--echo # using resignal
+
+DELIMITER |;
+
+CREATE PROCEDURE resignal_syntax()
+BEGIN
+ DECLARE CONTINUE HANDLER
+ FOR 1146
+ BEGIN
+ RESIGNAL SET
+ MESSAGE_TEXT = '`temptab` does not exist', ROW_NUMBER= 105;
+ END;
+ SELECT `c` FROM `temptab`;
+END|
+
+DELIMITER ;|
+
+--error ER_NO_SUCH_TABLE
+CALL resignal_syntax();
+
+GET DIAGNOSTICS CONDITION 1 @row_num= ROW_NUMBER;
+SELECT @row_num;
+
+DROP PROCEDURE resignal_syntax;
+
+--echo #
+--echo # MDEV-26842: ROW_NUMBER is not set and differs from the message upon
+--echo # WARN_DATA_TRUNCATED produced by inplace ALTER
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(64)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('foo'),(null);
+
+--error WARN_DATA_TRUNCATED
+ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
+
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26841: ROW_NUMBER is not set and differs from the message upon
+--echo # ER_WRONG_VALUE_COUNT_ON_ROW for the 1st row
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (1,2),(3);
+
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1(a) VALUES(1,2), (3);
+
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER, @m= MESSAGE_TEXT;
+SELECT @n, @m;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26830: Wrong ROW_NUMBER in diagnostics upon INSERT IGNORE with
+--echo # CHECK violation
+--echo #
+
+CREATE TABLE t1 (a INT, CHECK(a>0));
+INSERT IGNORE INTO t1 VALUES (1),(0),(2),(0);
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+GET DIAGNOSTICS CONDITION 2 @n= ROW_NUMBER;
+SELECT @n;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26844: DELETE returns ROW_NUMBER=1 for every row upon
+--echo # ER_TRUNCATED_WRONG_VALUE
+--echo #
+
+--echo # without ORDER BY
+
+CREATE TABLE t (a VARCHAR(8));
+
+INSERT INTO t VALUES ('val1'),('val2'),('100'),('val4');
+SELECT * FROM t;
+
+DELETE FROM t WHERE a = 100;
+SHOW WARNINGS;
+
+GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER;
+SELECT @n;
+
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-26695: Number of an invalid row is not calculated for table value constructor
+--echo #
+
+CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo');
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+CREATE TABLE t2 (a CHAR(1)) VALUES ('a'),('b') UNION VALUES ('foo');
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+
+DROP TABLE t1, t2;
+
+--echo # Checking that CREATE ... SELECT works
+
+CREATE TABLE t1 (val1 CHAR(5));
+INSERT INTO t1 VALUES ('A'),('B'),('C'),('DEF');
+CREATE TABLE t2 (val2 CHAR(1)) SELECT val1 as val2 FROM t1;
+GET DIAGNOSTICS CONDITION 1 @n= ROW_NUMBER;
+SELECT @n;
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
+
diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result
index 61deb087424..5b323bb598c 100644
--- a/mysql-test/main/gis.result
+++ b/mysql-test/main/gis.result
@@ -688,9 +688,9 @@ object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test
index 2d3025308bc..6fd1feda183 100644
--- a/mysql-test/main/gis.test
+++ b/mysql-test/main/gis.test
@@ -369,9 +369,9 @@ t1 where object_id=85984;
drop table t1;
create table t1 (fl geometry not null);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
diff --git a/mysql-test/main/handlersocket.result b/mysql-test/main/handlersocket.result
index 8ef9b289cd0..38027afc414 100644
--- a/mysql-test/main/handlersocket.result
+++ b/mysql-test/main/handlersocket.result
@@ -5,7 +5,7 @@ plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
-plugin_library_version 1.14
+plugin_library_version 1.15
plugin_author higuchi dot akira at dena dot jp
plugin_description Direct access into InnoDB
plugin_license BSD
diff --git a/mysql-test/main/information_schema_part.result b/mysql-test/main/information_schema_part.result
index 2655ef30fc6..1c5b9333550 100644
--- a/mysql-test/main/information_schema_part.result
+++ b/mysql-test/main/information_schema_part.result
@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
select * from information_schema.partitions where table_schema="test"
and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 NULL 1 NULL LIST NULL `b` * `a` NULL 1 0 0 0 # 1024 0 # # NULL NULL default ts1
-def test t1 x2 NULL 2 NULL LIST NULL `b` * `a` NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default ts2
-def test t1 x3 NULL 3 NULL LIST NULL `b` * `a` NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default ts3
+def test t1 x1 NULL 1 NULL LIST NULL `b` * `a` NULL 1 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 x2 NULL 2 NULL LIST NULL `b` * `a` NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 x3 NULL 3 NULL LIST NULL `b` * `a` NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default NULL
create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
partition by range (a)
partitions 3
@@ -19,9 +19,9 @@ partition x3 values less than maxvalue tablespace ts3);
select * from information_schema.partitions where table_schema="test"
and table_name="t2";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t2 x1 NULL 1 NULL RANGE NULL `a` NULL 5 0 0 0 # 1024 0 # # NULL NULL default ts1
-def test t2 x2 NULL 2 NULL RANGE NULL `a` NULL 10 0 0 0 # 1024 0 # # NULL NULL default ts2
-def test t2 x3 NULL 3 NULL RANGE NULL `a` NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
+def test t2 x1 NULL 1 NULL RANGE NULL `a` NULL 5 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x2 NULL 2 NULL RANGE NULL `a` NULL 10 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x3 NULL 3 NULL RANGE NULL `a` NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default NULL
create table t3 (f1 date)
partition by hash(month(f1))
partitions 3;
@@ -63,14 +63,14 @@ subpartition x22 tablespace t2)
);
select * from information_schema.partitions where table_schema="test" order by table_name, partition_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t2 x1 x11 1 1 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t2 x1 x12 1 2 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t2 x2 x21 2 1 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t2 x2 x22 2 2 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2
+def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x1 x11 1 1 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x1 x12 1 2 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x2 x21 2 1 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t2 x2 x22 2 2 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default NULL
drop table t1,t2;
create table t1 (
a int not null,
@@ -88,10 +88,10 @@ subpartition x22 tablespace t2 nodegroup 1)
);
select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 0 t1
-def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 1 t2
-def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 0 t1
-def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 1 t2
+def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 0 NULL
+def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 1 NULL
+def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 0 NULL
+def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 1 NULL
show tables;
Tables_in_test
t1
diff --git a/mysql-test/main/invisible_field_debug.test b/mysql-test/main/invisible_field_debug.test
index 3e844fc4521..b813481110f 100644
--- a/mysql-test/main/invisible_field_debug.test
+++ b/mysql-test/main/invisible_field_debug.test
@@ -201,7 +201,7 @@ drop table t1;
set debug_dbug= "+d,test_pseudo_invisible";
Create table t1( a int default(99) invisible, b int);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
Create table t2( a int default(99) invisible, b int, unique(invisible));
set debug_dbug=@old_debug;
@@ -211,9 +211,9 @@ insert into t1 values(3);
insert into t1 values(4);
select * from t1 order by b;
select invisible, a, b from t1 order by b;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index(invisible);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index(b,invisible);
show index from t1;
drop table t1;
@@ -223,7 +223,7 @@ drop table t1;
set debug_dbug= "+d,test_completely_invisible";
Create table t1( a int default(99) invisible, b int);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
Create table t2( a int default(99) invisible, b int, unique(invisible));
insert into t1 values(1);
insert into t1 values(2);
@@ -233,9 +233,9 @@ select * from t1 order by b;
select invisible, a, b from t1 order by b;
set debug_dbug=@old_debug;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index(invisible);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index(b,invisible);
show index from t1;
drop table t1;
@@ -262,7 +262,7 @@ select invisible, a ,b from t1;
set debug_dbug=@old_debug;
Show index from t1;
## Sytem Generated Index modification
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
create index a1 on t1(invisible);
set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
## index does not exist for user
diff --git a/mysql-test/main/json_equals.result b/mysql-test/main/json_equals.result
new file mode 100644
index 00000000000..1fa13ec2cf8
--- /dev/null
+++ b/mysql-test/main/json_equals.result
@@ -0,0 +1,98 @@
+select json_equals("{}", "{}");
+json_equals("{}", "{}")
+1
+select json_equals("{}", "[]");
+json_equals("{}", "[]")
+0
+select json_equals("{}", NULL);
+json_equals("{}", NULL)
+NULL
+select json_equals("", "");
+json_equals("", "")
+NULL
+select json_equals("", 1);
+json_equals("", 1)
+NULL
+select json_equals(now(), now());
+json_equals(now(), now())
+NULL
+select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}');
+json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}')
+0
+select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3]}');
+json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3]}')
+1
+select json_equals('{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}',
+'{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}');
+json_equals('{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}',
+'{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}')
+1
+select json_equals('{"a" : [0.123456789123456789], "b" : [1, 2, 3]}',
+'{"b" : [1, 2, 3], "a" : [0.123456789123456789]}');
+json_equals('{"a" : [0.123456789123456789], "b" : [1, 2, 3]}',
+'{"b" : [1, 2, 3], "a" : [0.123456789123456789]}')
+1
+#
+# Test max json depth for json_equals.
+#
+with recursive rec_json (step, obj) as (
+select 1, cast('{"key":"value"}' as varchar(1000))
+union
+select r.step + 1, JSON_INSERT('{}', '$.obj', JSON_QUERY(r.obj, '$'))
+from rec_json r
+where r.step < 10
+)
+select step, obj, json_equals(obj, obj) from rec_json;
+step obj json_equals(obj, obj)
+1 {"key":"value"} 1
+2 {"obj": {"key": "value"}} 1
+3 {"obj": {"obj": {"key": "value"}}} 1
+4 {"obj": {"obj": {"obj": {"key": "value"}}}} 1
+5 {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}} 1
+6 {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}} 1
+7 {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}} 1
+8 {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}} 1
+9 {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}} 1
+10 {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}} 1
+#
+# 31 levels of nesting.
+#
+select json_equals('{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}',
+'{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}') as 31_levels;
+31_levels
+1
+#
+# 32 Levels of nesting. This should hit max json depth.
+#
+select json_equals('{"obj":{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}',
+'{"obj":{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}') as 32_levels;
+32_levels
+NULL
+#
+# test values from different charset
+# (UTF-8 two-bytes vs. latin1 single high-byte)
+#
+create table t1 (a varchar(200) character set latin1);
+create table t2 (a varchar(200) character set utf8);
+insert into t1 values (UNHEX('22CA22'));
+set names utf8;
+insert into t2 values (UNHEX('22C38A22'));
+select a from t1;
+a
+"Ê"
+select hex(a) from t1;
+hex(a)
+22CA22
+select a from t2;
+a
+"Ê"
+select hex(a) from t2;
+hex(a)
+22C38A22
+select t1.a, t2.a, t1.a = t2.a,
+json_valid(t1.a), json_valid(t2.a), json_equals(t1.a, t2.a)
+from t1, t2;
+a a t1.a = t2.a json_valid(t1.a) json_valid(t2.a) json_equals(t1.a, t2.a)
+"Ê" "Ê" 1 1 1 1
+drop table t1;
+drop table t2;
diff --git a/mysql-test/main/json_equals.test b/mysql-test/main/json_equals.test
new file mode 100644
index 00000000000..943906e6f01
--- /dev/null
+++ b/mysql-test/main/json_equals.test
@@ -0,0 +1,72 @@
+
+select json_equals("{}", "{}");
+
+select json_equals("{}", "[]");
+
+select json_equals("{}", NULL);
+
+select json_equals("", "");
+
+select json_equals("", 1);
+
+select json_equals(now(), now());
+
+select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}');
+
+select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3]}');
+
+#enable after fix MDEV-27871
+--disable_view_protocol
+select json_equals('{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}',
+ '{"țanțoș":[1, 2, "ț", {"some uâ߀":"uâßr"}]}');
+
+select json_equals('{"a" : [0.123456789123456789], "b" : [1, 2, 3]}',
+ '{"b" : [1, 2, 3], "a" : [0.123456789123456789]}');
+--enable_view_protocol
+
+--echo #
+--echo # Test max json depth for json_equals.
+--echo #
+with recursive rec_json (step, obj) as (
+ select 1, cast('{"key":"value"}' as varchar(1000))
+ union
+ select r.step + 1, JSON_INSERT('{}', '$.obj', JSON_QUERY(r.obj, '$'))
+ from rec_json r
+ where r.step < 10
+)
+select step, obj, json_equals(obj, obj) from rec_json;
+
+--echo #
+--echo # 31 levels of nesting.
+--echo #
+select json_equals('{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}',
+'{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}') as 31_levels;
+
+--echo #
+--echo # 32 Levels of nesting. This should hit max json depth.
+--echo #
+select json_equals('{"obj":{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}',
+'{"obj":{"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"obj": {"key": "value"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}') as 32_levels;
+
+
+--echo #
+--echo # test values from different charset
+--echo # (UTF-8 two-bytes vs. latin1 single high-byte)
+--echo #
+create table t1 (a varchar(200) character set latin1);
+create table t2 (a varchar(200) character set utf8);
+insert into t1 values (UNHEX('22CA22'));
+set names utf8;
+insert into t2 values (UNHEX('22C38A22'));
+
+select a from t1;
+select hex(a) from t1;
+select a from t2;
+select hex(a) from t2;
+
+select t1.a, t2.a, t1.a = t2.a,
+ json_valid(t1.a), json_valid(t2.a), json_equals(t1.a, t2.a)
+from t1, t2;
+
+drop table t1;
+drop table t2;
diff --git a/mysql-test/main/json_normalize.result b/mysql-test/main/json_normalize.result
new file mode 100644
index 00000000000..b1363ea9099
--- /dev/null
+++ b/mysql-test/main/json_normalize.result
@@ -0,0 +1,77 @@
+set names utf8;
+create table t1 (json json);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`json`))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+insert into t1 values
+('{ }'),
+('[ ]'),
+('{ "foo" : "bar" }'),
+('{ "foo" : "bar", "baz" : "whatever" }'),
+('[ 1.2, 0.0, "text", 0, null, true, false ]'),
+('[ "string", { "key" : "val", "a" : "b", "c" : [ 10, 9, 8, "seven", 11 ] }]'),
+('{ "ăț€": "val1", "âț€":"val2" }');
+select json, json_normalize(json) from t1
+order by json;
+json json_normalize(json)
+[ ] []
+[ "string", { "key" : "val", "a" : "b", "c" : [ 10, 9, 8, "seven", 11 ] }] ["string",{"a":"b","c":[1.0E1,9.0E0,8.0E0,"seven",1.1E1],"key":"val"}]
+[ 1.2, 0.0, "text", 0, null, true, false ] [1.2E0,0.0E0,"text",0.0E0,null,true,false]
+{ } {}
+{ "foo" : "bar" } {"foo":"bar"}
+{ "foo" : "bar", "baz" : "whatever" } {"baz":"whatever","foo":"bar"}
+{ "ăț€": "val1", "âț€":"val2" } {"âț€":"val2","ăț€":"val1"}
+create view v1 as (select json, json_normalize(json) norm_json 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`.`json` AS `json`,json_normalize(`t1`.`json`) AS `norm_json` from `t1`) utf8mb3 utf8mb3_general_ci
+select * from v1
+order by json;
+json norm_json
+[ ] []
+[ "string", { "key" : "val", "a" : "b", "c" : [ 10, 9, 8, "seven", 11 ] }] ["string",{"a":"b","c":[1.0E1,9.0E0,8.0E0,"seven",1.1E1],"key":"val"}]
+[ 1.2, 0.0, "text", 0, null, true, false ] [1.2E0,0.0E0,"text",0.0E0,null,true,false]
+{ } {}
+{ "foo" : "bar" } {"foo":"bar"}
+{ "foo" : "bar", "baz" : "whatever" } {"baz":"whatever","foo":"bar"}
+{ "ăț€": "val1", "âț€":"val2" } {"âț€":"val2","ăț€":"val1"}
+select json_normalize(NULL);
+json_normalize(NULL)
+NULL
+select json_normalize('{ "invalid": "no_close"');
+json_normalize('{ "invalid": "no_close"')
+NULL
+drop table t1;
+drop view v1;
+create table t1 (text varchar(200) character set 'latin1');
+insert into t1 values (unhex('22E522'));
+create table t2 (text varchar(200) character set 'utf8mb4');
+insert into t2 SELECT * FROM t1;
+select t1.text, hex(t1.text) from t1;
+text hex(t1.text)
+"Ã¥" 22E522
+select t2.text, hex(t2.text) from t2;
+text hex(t2.text)
+"Ã¥" 22C3A522
+select t1.text
+, t2.text
+, replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385'))
+, replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385'))
+, hex(replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385')))
+, hex(replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385')))
+from t1, t2;
+text text replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385')) replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385')) hex(replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385'))) hex(replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385')))
+"Ã¥" "Ã¥" "Ã…" "Ã…" 22C38522 22C38522
+drop table t1;
+drop table t2;
+create table t1 (text varchar(1));
+insert into t1 values ('0');
+select concat_ws(' ', t1.text, t1.text) from t1;
+concat_ws(' ', t1.text, t1.text)
+0 0
+select concat_ws(' ', json_normalize(t1.text), json_normalize(t1.text)) from t1;
+concat_ws(' ', json_normalize(t1.text), json_normalize(t1.text))
+0.0E0 0.0E0
+drop table t1;
diff --git a/mysql-test/main/json_normalize.test b/mysql-test/main/json_normalize.test
new file mode 100644
index 00000000000..29faa514cca
--- /dev/null
+++ b/mysql-test/main/json_normalize.test
@@ -0,0 +1,58 @@
+set names utf8;
+
+create table t1 (json json);
+show create table t1;
+
+
+insert into t1 values
+('{ }'),
+('[ ]'),
+('{ "foo" : "bar" }'),
+('{ "foo" : "bar", "baz" : "whatever" }'),
+('[ 1.2, 0.0, "text", 0, null, true, false ]'),
+('[ "string", { "key" : "val", "a" : "b", "c" : [ 10, 9, 8, "seven", 11 ] }]'),
+('{ "ăț€": "val1", "âț€":"val2" }');
+
+select json, json_normalize(json) from t1
+order by json;
+
+
+create view v1 as (select json, json_normalize(json) norm_json from t1);
+show create view v1;
+
+select * from v1
+order by json;
+
+select json_normalize(NULL);
+select json_normalize('{ "invalid": "no_close"');
+
+drop table t1;
+drop view v1;
+
+create table t1 (text varchar(200) character set 'latin1');
+insert into t1 values (unhex('22E522'));
+
+create table t2 (text varchar(200) character set 'utf8mb4');
+insert into t2 SELECT * FROM t1;
+
+select t1.text, hex(t1.text) from t1;
+select t2.text, hex(t2.text) from t2;
+
+select t1.text
+ , t2.text
+ , replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385'))
+ , replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385'))
+ , hex(replace(json_normalize(t1.text), unhex('C3A5'), unhex('C385')))
+ , hex(replace(json_normalize(t2.text), unhex('C3A5'), unhex('C385')))
+from t1, t2;
+
+drop table t1;
+drop table t2;
+
+create table t1 (text varchar(1));
+insert into t1 values ('0');
+
+select concat_ws(' ', t1.text, t1.text) from t1;
+select concat_ws(' ', json_normalize(t1.text), json_normalize(t1.text)) from t1;
+
+drop table t1;
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index f2160bb7f68..8d1accd6cd3 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -173,7 +173,7 @@ ALTER TABLE t1 DROP KEY f, ADD INDEX idx1(f), ALGORITHM=INSTANT;
ALTER TABLE t1 ADD KEY idx2(f);
DROP TABLE t1;
CREATE TABLE t1(a blob , b blob , unique(a,b));
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column b;
insert into t1 values(1,1);
--error ER_DUP_ENTRY
diff --git a/mysql-test/main/mdl_sync.test b/mysql-test/main/mdl_sync.test
index 557fbe261a2..3df19aca806 100644
--- a/mysql-test/main/mdl_sync.test
+++ b/mysql-test/main/mdl_sync.test
@@ -113,7 +113,7 @@ insert into t1 values (1), (1);
--echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail when constructing .frm and thus obtaining SU metadata
--echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index (not_exist);
--echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail during copying the table and thus obtaining SNW metadata
@@ -190,7 +190,7 @@ insert into t1 values (1);
--echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail when constructing .frm and thus obtaining SU metadata
--echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index (not_exist);
--echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail during copying the table and thus obtaining SNW metadata
@@ -309,7 +309,7 @@ insert into t1 values (1);
--echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail when constructing .frm and thus obtaining SU metadata
--echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index (not_exist);
--echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail during copying the table and thus obtaining SNW metadata
@@ -418,7 +418,7 @@ insert into t1 values (1);
--echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
--echo # which will fail when constructing .frm and thus obtaining SU metadata
--echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add index (not_exist);
--echo # Check that SNW lock is not compatible with SW lock.
--echo # Again we use ALTER TABLE which fails during copying
diff --git a/mysql-test/main/metadata.result b/mysql-test/main/metadata.result
index 175b09e5a2b..5786e2fd461 100644
--- a/mysql-test/main/metadata.result
+++ b/mysql-test/main/metadata.result
@@ -553,19 +553,19 @@ d0l d09 d10
# MDEV-12862 Data type of @a:=1e0 depends on the session character set
#
SET NAMES utf8;
-CREATE TABLE t1 AS SELECT @:=1e0;
+CREATE TABLE t1 AS SELECT @a:=1e0;
SELECT * FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t1 t1 @:=1e0 @:=1e0 5 3 1 N 36865 31 63
-@:=1e0
+def test t1 t1 @a:=1e0 @a:=1e0 5 3 1 N 36865 31 63
+@a:=1e0
1
DROP TABLE t1;
SET NAMES latin1;
-CREATE TABLE t1 AS SELECT @:=1e0;
+CREATE TABLE t1 AS SELECT @a:=1e0;
SELECT * FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def test t1 t1 @:=1e0 @:=1e0 5 3 1 N 36865 31 63
-@:=1e0
+def test t1 t1 @a:=1e0 @a:=1e0 5 3 1 N 36865 31 63
+@a:=1e0
1
DROP TABLE t1;
#
diff --git a/mysql-test/main/metadata.test b/mysql-test/main/metadata.test
index eade0e0ff01..6cbf99d16b7 100644
--- a/mysql-test/main/metadata.test
+++ b/mysql-test/main/metadata.test
@@ -347,11 +347,11 @@ SELECT
--echo #
--enable_metadata
SET NAMES utf8;
-CREATE TABLE t1 AS SELECT @:=1e0;
+CREATE TABLE t1 AS SELECT @a:=1e0;
SELECT * FROM t1;
DROP TABLE t1;
SET NAMES latin1;
-CREATE TABLE t1 AS SELECT @:=1e0;
+CREATE TABLE t1 AS SELECT @a:=1e0;
SELECT * FROM t1;
DROP TABLE t1;
--disable_metadata
diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result
index 5363bcd12b2..0b91b513b17 100644
--- a/mysql-test/main/mysql.result
+++ b/mysql-test/main/mysql.result
@@ -558,7 +558,9 @@ CREATE TABLE `a1\``b1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `a1\``b1` VALUES (1),(2);
+INSERT INTO `a1\``b1` VALUES
+(1),
+(2);
insert `a1\``b1` values (4),(5);
show create table `a1\``b1`;
Table Create Table
@@ -587,7 +589,9 @@ CREATE TABLE "a1\""b1" (
"a" int(11) DEFAULT NULL
);
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO "a1\""b1" VALUES (1),(2);
+INSERT INTO "a1\""b1" VALUES
+(1),
+(2);
insert "a1\""b1" values (4),(5);
show create table "a1\""b1";
Table Create Table
@@ -603,11 +607,11 @@ set sql_mode=default;
create table t1 (a text);
select count(*) from t1;
count(*)
-41
+43
truncate table t1;
select count(*) from t1;
count(*)
-41
+43
truncate table t1;
select count(*) from t1;
count(*)
@@ -619,7 +623,7 @@ count(*)
truncate table t1;
select count(*) from t1;
count(*)
-41
+43
truncate table t1;
select count(*) from t1;
count(*)
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index a3dac7fcfcb..f2ba6ac2d53 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -1713,7 +1713,7 @@ performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-sql-text-length 1024
performance-schema-max-stage-classes 160
-performance-schema-max-statement-classes 222
+performance-schema-max-statement-classes 221
performance-schema-max-statement-stack 10
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test
index f918670d319..42f551974d9 100644
--- a/mysql-test/main/mysqld--help.test
+++ b/mysql-test/main/mysqld--help.test
@@ -27,16 +27,18 @@ perl;
large-files-support lower-case-file-system system-time-zone
collation-server character-set-server log-tc-size table-cache
table-open-cache table-open-cache-instances max-connections
- tls-version version.*/;
+ tls-version version.* password-reuse-check
+ password-reuse-check-interval/;
# Plugins which may or may not be there:
@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
+ test-sql-discovery query-cache-info password-reuse-check
query-response-time metadata-lock-info locales unix-socket
wsrep file-key-management cracklib-password-check user-variables
+ provider-bzip2 provider-lzma provider-lzo
thread-pool-groups thread-pool-queues thread-pool-stats thread-pool-waits/;
# And substitute the content some environment variables with their
diff --git a/mysql-test/main/mysqldump-max.result b/mysql-test/main/mysqldump-max.result
index eb2cf2aec08..7dd1030eac1 100644
--- a/mysql-test/main/mysqldump-max.result
+++ b/mysql-test/main/mysqldump-max.result
@@ -102,7 +102,12 @@ CREATE TABLE `t1` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED IGNORE INTO `t1` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -114,7 +119,12 @@ CREATE TABLE `t2` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED IGNORE INTO `t2` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -126,7 +136,12 @@ CREATE TABLE `t3` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED IGNORE INTO `t3` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -138,7 +153,12 @@ CREATE TABLE `t4` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED IGNORE INTO `t4` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -150,7 +170,12 @@ CREATE TABLE `t5` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED IGNORE INTO `t5` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -162,7 +187,12 @@ CREATE TABLE `t6` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
-INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT IGNORE INTO `t6` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -199,7 +229,12 @@ CREATE TABLE `t1` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED INTO `t1` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -211,7 +246,12 @@ CREATE TABLE `t2` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED INTO `t2` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -223,7 +263,12 @@ CREATE TABLE `t3` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
-INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED INTO `t3` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -235,7 +280,12 @@ CREATE TABLE `t4` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
-INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED INTO `t4` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -247,7 +297,12 @@ CREATE TABLE `t5` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
-INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT DELAYED INTO `t5` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -259,7 +314,12 @@ CREATE TABLE `t6` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
-INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
+INSERT INTO `t6` VALUES
+(1,'first value'),
+(2,'first value'),
+(3,'first value'),
+(4,'first value'),
+(5,'first value');
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result
index 12b4c763f5d..bf2d60c698c 100644
--- a/mysql-test/main/mysqldump-system.result
+++ b/mysql-test/main/mysqldump-system.result
@@ -93,31 +93,39 @@ USE mysql;
LOCK TABLES `column_stats` WRITE;
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
-REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
+REPLACE INTO `column_stats` VALUES
+('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `index_stats` WRITE;
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
-REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+REPLACE INTO `index_stats` VALUES
+('mysql','tz','PRIMARY',1,98.2500);
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `table_stats` WRITE;
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
-REPLACE INTO `table_stats` VALUES ('mysql','tz',393);
+REPLACE INTO `table_stats` VALUES
+('mysql','tz',393);
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_index_stats` WRITE;
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
-REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+REPLACE INTO `innodb_index_stats` VALUES
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_table_stats` WRITE;
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
-REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+REPLACE INTO `innodb_table_stats` VALUES
+('mysql','tz','2019-12-31 21:00:00',393,1,0);
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
UNLOCK TABLES;
@@ -125,31 +133,488 @@ USE mysql;
LOCK TABLES `time_zone` WRITE;
/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
-REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+REPLACE INTO `time_zone` VALUES
+(1,'N'),
+(2,'N'),
+(3,'N'),
+(4,'Y'),
+(5,'N');
/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_name` WRITE;
/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
-REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+REPLACE INTO `time_zone_name` VALUES
+('Europe/Moscow',3),
+('Japan',5),
+('leap/Europe/Moscow',4),
+('MET',1),
+('Universal',2),
+('UTC',2);
/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_leap_second` WRITE;
/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
-REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+REPLACE INTO `time_zone_leap_second` VALUES
+(78796800,1),
+(94694401,2),
+(126230402,3),
+(157766403,4),
+(189302404,5),
+(220924805,6),
+(252460806,7),
+(283996807,8),
+(315532808,9),
+(362793609,10),
+(394329610,11),
+(425865611,12),
+(489024012,13),
+(567993613,14),
+(631152014,15),
+(662688015,16),
+(709948816,17),
+(741484817,18),
+(773020818,19),
+(820454419,20),
+(867715220,21),
+(915148821,22);
/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition` WRITE;
/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
-REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+REPLACE INTO `time_zone_transition` VALUES
+(1,-1693706400,0),
+(1,-1680483600,1),
+(1,-1663455600,2),
+(1,-1650150000,3),
+(1,-1632006000,2),
+(1,-1618700400,3),
+(1,-938905200,2),
+(1,-857257200,3),
+(1,-844556400,2),
+(1,-828226800,3),
+(1,-812502000,2),
+(1,-796777200,3),
+(1,228877200,2),
+(1,243997200,3),
+(1,260326800,2),
+(1,276051600,3),
+(1,291776400,2),
+(1,307501200,3),
+(1,323830800,2),
+(1,338950800,3),
+(1,354675600,2),
+(1,370400400,3),
+(1,386125200,2),
+(1,401850000,3),
+(1,417574800,2),
+(1,433299600,3),
+(1,449024400,2),
+(1,465354000,3),
+(1,481078800,2),
+(1,496803600,3),
+(1,512528400,2),
+(1,528253200,3),
+(1,543978000,2),
+(1,559702800,3),
+(1,575427600,2),
+(1,591152400,3),
+(1,606877200,2),
+(1,622602000,3),
+(1,638326800,2),
+(1,654656400,3),
+(1,670381200,2),
+(1,686106000,3),
+(1,701830800,2),
+(1,717555600,3),
+(1,733280400,2),
+(1,749005200,3),
+(1,764730000,2),
+(1,780454800,3),
+(1,796179600,2),
+(1,811904400,3),
+(1,828234000,2),
+(1,846378000,3),
+(1,859683600,2),
+(1,877827600,3),
+(1,891133200,2),
+(1,909277200,3),
+(1,922582800,2),
+(1,941331600,3),
+(1,954032400,2),
+(1,972781200,3),
+(1,985482000,2),
+(1,1004230800,3),
+(1,1017536400,2),
+(1,1035680400,3),
+(1,1048986000,2),
+(1,1067130000,3),
+(1,1080435600,2),
+(1,1099184400,3),
+(1,1111885200,2),
+(1,1130634000,3),
+(1,1143334800,2),
+(1,1162083600,3),
+(1,1174784400,2),
+(1,1193533200,3),
+(1,1206838800,2),
+(1,1224982800,3),
+(1,1238288400,2),
+(1,1256432400,3),
+(1,1269738000,2),
+(1,1288486800,3),
+(1,1301187600,2),
+(1,1319936400,3),
+(1,1332637200,2),
+(1,1351386000,3),
+(1,1364691600,2),
+(1,1382835600,3),
+(1,1396141200,2),
+(1,1414285200,3),
+(1,1427590800,2),
+(1,1445734800,3),
+(1,1459040400,2),
+(1,1477789200,3),
+(1,1490490000,2),
+(1,1509238800,3),
+(1,1521939600,2),
+(1,1540688400,3),
+(1,1553994000,2),
+(1,1572138000,3),
+(1,1585443600,2),
+(1,1603587600,3),
+(1,1616893200,2),
+(1,1635642000,3),
+(1,1648342800,2),
+(1,1667091600,3),
+(1,1679792400,2),
+(1,1698541200,3),
+(1,1711846800,2),
+(1,1729990800,3),
+(1,1743296400,2),
+(1,1761440400,3),
+(1,1774746000,2),
+(1,1792890000,3),
+(1,1806195600,2),
+(1,1824944400,3),
+(1,1837645200,2),
+(1,1856394000,3),
+(1,1869094800,2),
+(1,1887843600,3),
+(1,1901149200,2),
+(1,1919293200,3),
+(1,1932598800,2),
+(1,1950742800,3),
+(1,1964048400,2),
+(1,1982797200,3),
+(1,1995498000,2),
+(1,2014246800,3),
+(1,2026947600,2),
+(1,2045696400,3),
+(1,2058397200,2),
+(1,2077146000,3),
+(1,2090451600,2),
+(1,2108595600,3),
+(1,2121901200,2),
+(1,2140045200,3),
+(3,-1688265000,2),
+(3,-1656819048,1),
+(3,-1641353448,2),
+(3,-1627965048,3),
+(3,-1618716648,1),
+(3,-1596429048,3),
+(3,-1593829848,5),
+(3,-1589860800,4),
+(3,-1542427200,5),
+(3,-1539493200,6),
+(3,-1525323600,5),
+(3,-1522728000,4),
+(3,-1491188400,7),
+(3,-1247536800,4),
+(3,354920400,5),
+(3,370728000,4),
+(3,386456400,5),
+(3,402264000,4),
+(3,417992400,5),
+(3,433800000,4),
+(3,449614800,5),
+(3,465346800,8),
+(3,481071600,9),
+(3,496796400,8),
+(3,512521200,9),
+(3,528246000,8),
+(3,543970800,9),
+(3,559695600,8),
+(3,575420400,9),
+(3,591145200,8),
+(3,606870000,9),
+(3,622594800,8),
+(3,638319600,9),
+(3,654649200,8),
+(3,670374000,10),
+(3,686102400,11),
+(3,695779200,8),
+(3,701812800,5),
+(3,717534000,4),
+(3,733273200,9),
+(3,748998000,8),
+(3,764722800,9),
+(3,780447600,8),
+(3,796172400,9),
+(3,811897200,8),
+(3,828226800,9),
+(3,846370800,8),
+(3,859676400,9),
+(3,877820400,8),
+(3,891126000,9),
+(3,909270000,8),
+(3,922575600,9),
+(3,941324400,8),
+(3,954025200,9),
+(3,972774000,8),
+(3,985474800,9),
+(3,1004223600,8),
+(3,1017529200,9),
+(3,1035673200,8),
+(3,1048978800,9),
+(3,1067122800,8),
+(3,1080428400,9),
+(3,1099177200,8),
+(3,1111878000,9),
+(3,1130626800,8),
+(3,1143327600,9),
+(3,1162076400,8),
+(3,1174777200,9),
+(3,1193526000,8),
+(3,1206831600,9),
+(3,1224975600,8),
+(3,1238281200,9),
+(3,1256425200,8),
+(3,1269730800,9),
+(3,1288479600,8),
+(3,1301180400,9),
+(3,1319929200,8),
+(3,1332630000,9),
+(3,1351378800,8),
+(3,1364684400,9),
+(3,1382828400,8),
+(3,1396134000,9),
+(3,1414278000,8),
+(3,1427583600,9),
+(3,1445727600,8),
+(3,1459033200,9),
+(3,1477782000,8),
+(3,1490482800,9),
+(3,1509231600,8),
+(3,1521932400,9),
+(3,1540681200,8),
+(3,1553986800,9),
+(3,1572130800,8),
+(3,1585436400,9),
+(3,1603580400,8),
+(3,1616886000,9),
+(3,1635634800,8),
+(3,1648335600,9),
+(3,1667084400,8),
+(3,1679785200,9),
+(3,1698534000,8),
+(3,1711839600,9),
+(3,1729983600,8),
+(3,1743289200,9),
+(3,1761433200,8),
+(3,1774738800,9),
+(3,1792882800,8),
+(3,1806188400,9),
+(3,1824937200,8),
+(3,1837638000,9),
+(3,1856386800,8),
+(3,1869087600,9),
+(3,1887836400,8),
+(3,1901142000,9),
+(3,1919286000,8),
+(3,1932591600,9),
+(3,1950735600,8),
+(3,1964041200,9),
+(3,1982790000,8),
+(3,1995490800,9),
+(3,2014239600,8),
+(3,2026940400,9),
+(3,2045689200,8),
+(3,2058390000,9),
+(3,2077138800,8),
+(3,2090444400,9),
+(3,2108588400,8),
+(3,2121894000,9),
+(3,2140038000,8),
+(4,-1688265000,2),
+(4,-1656819048,1),
+(4,-1641353448,2),
+(4,-1627965048,3),
+(4,-1618716648,1),
+(4,-1596429048,3),
+(4,-1593829848,5),
+(4,-1589860800,4),
+(4,-1542427200,5),
+(4,-1539493200,6),
+(4,-1525323600,5),
+(4,-1522728000,4),
+(4,-1491188400,7),
+(4,-1247536800,4),
+(4,354920409,5),
+(4,370728010,4),
+(4,386456410,5),
+(4,402264011,4),
+(4,417992411,5),
+(4,433800012,4),
+(4,449614812,5),
+(4,465346812,8),
+(4,481071612,9),
+(4,496796413,8),
+(4,512521213,9),
+(4,528246013,8),
+(4,543970813,9),
+(4,559695613,8),
+(4,575420414,9),
+(4,591145214,8),
+(4,606870014,9),
+(4,622594814,8),
+(4,638319615,9),
+(4,654649215,8),
+(4,670374016,10),
+(4,686102416,11),
+(4,695779216,8),
+(4,701812816,5),
+(4,717534017,4),
+(4,733273217,9),
+(4,748998018,8),
+(4,764722818,9),
+(4,780447619,8),
+(4,796172419,9),
+(4,811897219,8),
+(4,828226820,9),
+(4,846370820,8),
+(4,859676420,9),
+(4,877820421,8),
+(4,891126021,9),
+(4,909270021,8),
+(4,922575622,9),
+(4,941324422,8),
+(4,954025222,9),
+(4,972774022,8),
+(4,985474822,9),
+(4,1004223622,8),
+(4,1017529222,9),
+(4,1035673222,8),
+(4,1048978822,9),
+(4,1067122822,8),
+(4,1080428422,9),
+(4,1099177222,8),
+(4,1111878022,9),
+(4,1130626822,8),
+(4,1143327622,9),
+(4,1162076422,8),
+(4,1174777222,9),
+(4,1193526022,8),
+(4,1206831622,9),
+(4,1224975622,8),
+(4,1238281222,9),
+(4,1256425222,8),
+(4,1269730822,9),
+(4,1288479622,8),
+(4,1301180422,9),
+(4,1319929222,8),
+(4,1332630022,9),
+(4,1351378822,8),
+(4,1364684422,9),
+(4,1382828422,8),
+(4,1396134022,9),
+(4,1414278022,8),
+(4,1427583622,9),
+(4,1445727622,8),
+(4,1459033222,9),
+(4,1477782022,8),
+(4,1490482822,9),
+(4,1509231622,8),
+(4,1521932422,9),
+(4,1540681222,8),
+(4,1553986822,9),
+(4,1572130822,8),
+(4,1585436422,9),
+(4,1603580422,8),
+(4,1616886022,9),
+(4,1635634822,8),
+(4,1648335622,9),
+(4,1667084422,8),
+(4,1679785222,9),
+(4,1698534022,8),
+(4,1711839622,9),
+(4,1729983622,8),
+(4,1743289222,9),
+(4,1761433222,8),
+(4,1774738822,9),
+(4,1792882822,8),
+(4,1806188422,9),
+(4,1824937222,8),
+(4,1837638022,9),
+(4,1856386822,8),
+(4,1869087622,9),
+(4,1887836422,8),
+(4,1901142022,9),
+(4,1919286022,8),
+(4,1932591622,9),
+(4,1950735622,8),
+(4,1964041222,9),
+(4,1982790022,8),
+(4,1995490822,9),
+(4,2014239622,8),
+(4,2026940422,9),
+(4,2045689222,8),
+(4,2058390022,9),
+(4,2077138822,8),
+(4,2090444422,9),
+(4,2108588422,8),
+(4,2121894022,9),
+(4,2140038022,8),
+(5,-1009875600,1);
/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition_type` WRITE;
/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
-REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+REPLACE INTO `time_zone_transition_type` VALUES
+(1,0,7200,1,'MEST'),
+(1,1,3600,0,'MET'),
+(1,2,7200,1,'MEST'),
+(1,3,3600,0,'MET'),
+(2,0,0,0,'UTC'),
+(3,0,9000,0,'MMT'),
+(3,1,12648,1,'MST'),
+(3,2,9048,0,'MMT'),
+(3,3,16248,1,'MDST'),
+(3,4,10800,0,'MSK'),
+(3,5,14400,1,'MSD'),
+(3,6,18000,1,'MSD'),
+(3,7,7200,0,'EET'),
+(3,8,10800,0,'MSK'),
+(3,9,14400,1,'MSD'),
+(3,10,10800,1,'EEST'),
+(3,11,7200,0,'EET'),
+(4,0,9000,0,'MMT'),
+(4,1,12648,1,'MST'),
+(4,2,9048,0,'MMT'),
+(4,3,16248,1,'MDST'),
+(4,4,10800,0,'MSK'),
+(4,5,14400,1,'MSD'),
+(4,6,18000,1,'MSD'),
+(4,7,7200,0,'EET'),
+(4,8,10800,0,'MSK'),
+(4,9,14400,1,'MSD'),
+(4,10,10800,1,'EEST'),
+(4,11,7200,0,'EET'),
+(5,0,32400,0,'CJT'),
+(5,1,32400,0,'JST');
/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -242,31 +707,39 @@ USE mysql;
LOCK TABLES `column_stats` WRITE;
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
-REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
+REPLACE INTO `column_stats` VALUES
+('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `index_stats` WRITE;
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
-REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+REPLACE INTO `index_stats` VALUES
+('mysql','tz','PRIMARY',1,98.2500);
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `table_stats` WRITE;
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
-REPLACE INTO `table_stats` VALUES ('mysql','tz',393);
+REPLACE INTO `table_stats` VALUES
+('mysql','tz',393);
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_index_stats` WRITE;
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
-REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+REPLACE INTO `innodb_index_stats` VALUES
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_table_stats` WRITE;
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
-REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+REPLACE INTO `innodb_table_stats` VALUES
+('mysql','tz','2019-12-31 21:00:00',393,1,0);
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
UNLOCK TABLES;
@@ -274,31 +747,488 @@ USE mysql;
LOCK TABLES `time_zone` WRITE;
/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
-REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+REPLACE INTO `time_zone` VALUES
+(1,'N'),
+(2,'N'),
+(3,'N'),
+(4,'Y'),
+(5,'N');
/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_name` WRITE;
/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
-REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+REPLACE INTO `time_zone_name` VALUES
+('Europe/Moscow',3),
+('Japan',5),
+('leap/Europe/Moscow',4),
+('MET',1),
+('Universal',2),
+('UTC',2);
/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_leap_second` WRITE;
/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
-REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+REPLACE INTO `time_zone_leap_second` VALUES
+(78796800,1),
+(94694401,2),
+(126230402,3),
+(157766403,4),
+(189302404,5),
+(220924805,6),
+(252460806,7),
+(283996807,8),
+(315532808,9),
+(362793609,10),
+(394329610,11),
+(425865611,12),
+(489024012,13),
+(567993613,14),
+(631152014,15),
+(662688015,16),
+(709948816,17),
+(741484817,18),
+(773020818,19),
+(820454419,20),
+(867715220,21),
+(915148821,22);
/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition` WRITE;
/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
-REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+REPLACE INTO `time_zone_transition` VALUES
+(1,-1693706400,0),
+(1,-1680483600,1),
+(1,-1663455600,2),
+(1,-1650150000,3),
+(1,-1632006000,2),
+(1,-1618700400,3),
+(1,-938905200,2),
+(1,-857257200,3),
+(1,-844556400,2),
+(1,-828226800,3),
+(1,-812502000,2),
+(1,-796777200,3),
+(1,228877200,2),
+(1,243997200,3),
+(1,260326800,2),
+(1,276051600,3),
+(1,291776400,2),
+(1,307501200,3),
+(1,323830800,2),
+(1,338950800,3),
+(1,354675600,2),
+(1,370400400,3),
+(1,386125200,2),
+(1,401850000,3),
+(1,417574800,2),
+(1,433299600,3),
+(1,449024400,2),
+(1,465354000,3),
+(1,481078800,2),
+(1,496803600,3),
+(1,512528400,2),
+(1,528253200,3),
+(1,543978000,2),
+(1,559702800,3),
+(1,575427600,2),
+(1,591152400,3),
+(1,606877200,2),
+(1,622602000,3),
+(1,638326800,2),
+(1,654656400,3),
+(1,670381200,2),
+(1,686106000,3),
+(1,701830800,2),
+(1,717555600,3),
+(1,733280400,2),
+(1,749005200,3),
+(1,764730000,2),
+(1,780454800,3),
+(1,796179600,2),
+(1,811904400,3),
+(1,828234000,2),
+(1,846378000,3),
+(1,859683600,2),
+(1,877827600,3),
+(1,891133200,2),
+(1,909277200,3),
+(1,922582800,2),
+(1,941331600,3),
+(1,954032400,2),
+(1,972781200,3),
+(1,985482000,2),
+(1,1004230800,3),
+(1,1017536400,2),
+(1,1035680400,3),
+(1,1048986000,2),
+(1,1067130000,3),
+(1,1080435600,2),
+(1,1099184400,3),
+(1,1111885200,2),
+(1,1130634000,3),
+(1,1143334800,2),
+(1,1162083600,3),
+(1,1174784400,2),
+(1,1193533200,3),
+(1,1206838800,2),
+(1,1224982800,3),
+(1,1238288400,2),
+(1,1256432400,3),
+(1,1269738000,2),
+(1,1288486800,3),
+(1,1301187600,2),
+(1,1319936400,3),
+(1,1332637200,2),
+(1,1351386000,3),
+(1,1364691600,2),
+(1,1382835600,3),
+(1,1396141200,2),
+(1,1414285200,3),
+(1,1427590800,2),
+(1,1445734800,3),
+(1,1459040400,2),
+(1,1477789200,3),
+(1,1490490000,2),
+(1,1509238800,3),
+(1,1521939600,2),
+(1,1540688400,3),
+(1,1553994000,2),
+(1,1572138000,3),
+(1,1585443600,2),
+(1,1603587600,3),
+(1,1616893200,2),
+(1,1635642000,3),
+(1,1648342800,2),
+(1,1667091600,3),
+(1,1679792400,2),
+(1,1698541200,3),
+(1,1711846800,2),
+(1,1729990800,3),
+(1,1743296400,2),
+(1,1761440400,3),
+(1,1774746000,2),
+(1,1792890000,3),
+(1,1806195600,2),
+(1,1824944400,3),
+(1,1837645200,2),
+(1,1856394000,3),
+(1,1869094800,2),
+(1,1887843600,3),
+(1,1901149200,2),
+(1,1919293200,3),
+(1,1932598800,2),
+(1,1950742800,3),
+(1,1964048400,2),
+(1,1982797200,3),
+(1,1995498000,2),
+(1,2014246800,3),
+(1,2026947600,2),
+(1,2045696400,3),
+(1,2058397200,2),
+(1,2077146000,3),
+(1,2090451600,2),
+(1,2108595600,3),
+(1,2121901200,2),
+(1,2140045200,3),
+(3,-1688265000,2),
+(3,-1656819048,1),
+(3,-1641353448,2),
+(3,-1627965048,3),
+(3,-1618716648,1),
+(3,-1596429048,3),
+(3,-1593829848,5),
+(3,-1589860800,4),
+(3,-1542427200,5),
+(3,-1539493200,6),
+(3,-1525323600,5),
+(3,-1522728000,4),
+(3,-1491188400,7),
+(3,-1247536800,4),
+(3,354920400,5),
+(3,370728000,4),
+(3,386456400,5),
+(3,402264000,4),
+(3,417992400,5),
+(3,433800000,4),
+(3,449614800,5),
+(3,465346800,8),
+(3,481071600,9),
+(3,496796400,8),
+(3,512521200,9),
+(3,528246000,8),
+(3,543970800,9),
+(3,559695600,8),
+(3,575420400,9),
+(3,591145200,8),
+(3,606870000,9),
+(3,622594800,8),
+(3,638319600,9),
+(3,654649200,8),
+(3,670374000,10),
+(3,686102400,11),
+(3,695779200,8),
+(3,701812800,5),
+(3,717534000,4),
+(3,733273200,9),
+(3,748998000,8),
+(3,764722800,9),
+(3,780447600,8),
+(3,796172400,9),
+(3,811897200,8),
+(3,828226800,9),
+(3,846370800,8),
+(3,859676400,9),
+(3,877820400,8),
+(3,891126000,9),
+(3,909270000,8),
+(3,922575600,9),
+(3,941324400,8),
+(3,954025200,9),
+(3,972774000,8),
+(3,985474800,9),
+(3,1004223600,8),
+(3,1017529200,9),
+(3,1035673200,8),
+(3,1048978800,9),
+(3,1067122800,8),
+(3,1080428400,9),
+(3,1099177200,8),
+(3,1111878000,9),
+(3,1130626800,8),
+(3,1143327600,9),
+(3,1162076400,8),
+(3,1174777200,9),
+(3,1193526000,8),
+(3,1206831600,9),
+(3,1224975600,8),
+(3,1238281200,9),
+(3,1256425200,8),
+(3,1269730800,9),
+(3,1288479600,8),
+(3,1301180400,9),
+(3,1319929200,8),
+(3,1332630000,9),
+(3,1351378800,8),
+(3,1364684400,9),
+(3,1382828400,8),
+(3,1396134000,9),
+(3,1414278000,8),
+(3,1427583600,9),
+(3,1445727600,8),
+(3,1459033200,9),
+(3,1477782000,8),
+(3,1490482800,9),
+(3,1509231600,8),
+(3,1521932400,9),
+(3,1540681200,8),
+(3,1553986800,9),
+(3,1572130800,8),
+(3,1585436400,9),
+(3,1603580400,8),
+(3,1616886000,9),
+(3,1635634800,8),
+(3,1648335600,9),
+(3,1667084400,8),
+(3,1679785200,9),
+(3,1698534000,8),
+(3,1711839600,9),
+(3,1729983600,8),
+(3,1743289200,9),
+(3,1761433200,8),
+(3,1774738800,9),
+(3,1792882800,8),
+(3,1806188400,9),
+(3,1824937200,8),
+(3,1837638000,9),
+(3,1856386800,8),
+(3,1869087600,9),
+(3,1887836400,8),
+(3,1901142000,9),
+(3,1919286000,8),
+(3,1932591600,9),
+(3,1950735600,8),
+(3,1964041200,9),
+(3,1982790000,8),
+(3,1995490800,9),
+(3,2014239600,8),
+(3,2026940400,9),
+(3,2045689200,8),
+(3,2058390000,9),
+(3,2077138800,8),
+(3,2090444400,9),
+(3,2108588400,8),
+(3,2121894000,9),
+(3,2140038000,8),
+(4,-1688265000,2),
+(4,-1656819048,1),
+(4,-1641353448,2),
+(4,-1627965048,3),
+(4,-1618716648,1),
+(4,-1596429048,3),
+(4,-1593829848,5),
+(4,-1589860800,4),
+(4,-1542427200,5),
+(4,-1539493200,6),
+(4,-1525323600,5),
+(4,-1522728000,4),
+(4,-1491188400,7),
+(4,-1247536800,4),
+(4,354920409,5),
+(4,370728010,4),
+(4,386456410,5),
+(4,402264011,4),
+(4,417992411,5),
+(4,433800012,4),
+(4,449614812,5),
+(4,465346812,8),
+(4,481071612,9),
+(4,496796413,8),
+(4,512521213,9),
+(4,528246013,8),
+(4,543970813,9),
+(4,559695613,8),
+(4,575420414,9),
+(4,591145214,8),
+(4,606870014,9),
+(4,622594814,8),
+(4,638319615,9),
+(4,654649215,8),
+(4,670374016,10),
+(4,686102416,11),
+(4,695779216,8),
+(4,701812816,5),
+(4,717534017,4),
+(4,733273217,9),
+(4,748998018,8),
+(4,764722818,9),
+(4,780447619,8),
+(4,796172419,9),
+(4,811897219,8),
+(4,828226820,9),
+(4,846370820,8),
+(4,859676420,9),
+(4,877820421,8),
+(4,891126021,9),
+(4,909270021,8),
+(4,922575622,9),
+(4,941324422,8),
+(4,954025222,9),
+(4,972774022,8),
+(4,985474822,9),
+(4,1004223622,8),
+(4,1017529222,9),
+(4,1035673222,8),
+(4,1048978822,9),
+(4,1067122822,8),
+(4,1080428422,9),
+(4,1099177222,8),
+(4,1111878022,9),
+(4,1130626822,8),
+(4,1143327622,9),
+(4,1162076422,8),
+(4,1174777222,9),
+(4,1193526022,8),
+(4,1206831622,9),
+(4,1224975622,8),
+(4,1238281222,9),
+(4,1256425222,8),
+(4,1269730822,9),
+(4,1288479622,8),
+(4,1301180422,9),
+(4,1319929222,8),
+(4,1332630022,9),
+(4,1351378822,8),
+(4,1364684422,9),
+(4,1382828422,8),
+(4,1396134022,9),
+(4,1414278022,8),
+(4,1427583622,9),
+(4,1445727622,8),
+(4,1459033222,9),
+(4,1477782022,8),
+(4,1490482822,9),
+(4,1509231622,8),
+(4,1521932422,9),
+(4,1540681222,8),
+(4,1553986822,9),
+(4,1572130822,8),
+(4,1585436422,9),
+(4,1603580422,8),
+(4,1616886022,9),
+(4,1635634822,8),
+(4,1648335622,9),
+(4,1667084422,8),
+(4,1679785222,9),
+(4,1698534022,8),
+(4,1711839622,9),
+(4,1729983622,8),
+(4,1743289222,9),
+(4,1761433222,8),
+(4,1774738822,9),
+(4,1792882822,8),
+(4,1806188422,9),
+(4,1824937222,8),
+(4,1837638022,9),
+(4,1856386822,8),
+(4,1869087622,9),
+(4,1887836422,8),
+(4,1901142022,9),
+(4,1919286022,8),
+(4,1932591622,9),
+(4,1950735622,8),
+(4,1964041222,9),
+(4,1982790022,8),
+(4,1995490822,9),
+(4,2014239622,8),
+(4,2026940422,9),
+(4,2045689222,8),
+(4,2058390022,9),
+(4,2077138822,8),
+(4,2090444422,9),
+(4,2108588422,8),
+(4,2121894022,9),
+(4,2140038022,8),
+(5,-1009875600,1);
/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition_type` WRITE;
/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
-REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+REPLACE INTO `time_zone_transition_type` VALUES
+(1,0,7200,1,'MEST'),
+(1,1,3600,0,'MET'),
+(1,2,7200,1,'MEST'),
+(1,3,3600,0,'MET'),
+(2,0,0,0,'UTC'),
+(3,0,9000,0,'MMT'),
+(3,1,12648,1,'MST'),
+(3,2,9048,0,'MMT'),
+(3,3,16248,1,'MDST'),
+(3,4,10800,0,'MSK'),
+(3,5,14400,1,'MSD'),
+(3,6,18000,1,'MSD'),
+(3,7,7200,0,'EET'),
+(3,8,10800,0,'MSK'),
+(3,9,14400,1,'MSD'),
+(3,10,10800,1,'EEST'),
+(3,11,7200,0,'EET'),
+(4,0,9000,0,'MMT'),
+(4,1,12648,1,'MST'),
+(4,2,9048,0,'MMT'),
+(4,3,16248,1,'MDST'),
+(4,4,10800,0,'MSK'),
+(4,5,14400,1,'MSD'),
+(4,6,18000,1,'MSD'),
+(4,7,7200,0,'EET'),
+(4,8,10800,0,'MSK'),
+(4,9,14400,1,'MSD'),
+(4,10,10800,1,'EEST'),
+(4,11,7200,0,'EET'),
+(5,0,32400,0,'CJT'),
+(5,1,32400,0,'JST');
/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -368,31 +1298,39 @@ USE mysql;
LOCK TABLES `column_stats` WRITE;
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
-INSERT IGNORE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
+INSERT IGNORE INTO `column_stats` VALUES
+('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,254,'DOUBLE_PREC_HB','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿ÿ¿');
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `index_stats` WRITE;
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
-INSERT IGNORE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+INSERT IGNORE INTO `index_stats` VALUES
+('mysql','tz','PRIMARY',1,98.2500);
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `table_stats` WRITE;
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
-INSERT IGNORE INTO `table_stats` VALUES ('mysql','tz',393);
+INSERT IGNORE INTO `table_stats` VALUES
+('mysql','tz',393);
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_index_stats` WRITE;
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
-INSERT IGNORE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+INSERT IGNORE INTO `innodb_index_stats` VALUES
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
+('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `innodb_table_stats` WRITE;
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
-INSERT IGNORE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+INSERT IGNORE INTO `innodb_table_stats` VALUES
+('mysql','tz','2019-12-31 21:00:00',393,1,0);
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
UNLOCK TABLES;
@@ -400,31 +1338,488 @@ USE mysql;
LOCK TABLES `time_zone` WRITE;
/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
-INSERT IGNORE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+INSERT IGNORE INTO `time_zone` VALUES
+(1,'N'),
+(2,'N'),
+(3,'N'),
+(4,'Y'),
+(5,'N');
/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_name` WRITE;
/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
-INSERT IGNORE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+INSERT IGNORE INTO `time_zone_name` VALUES
+('Europe/Moscow',3),
+('Japan',5),
+('leap/Europe/Moscow',4),
+('MET',1),
+('Universal',2),
+('UTC',2);
/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_leap_second` WRITE;
/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
-INSERT IGNORE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+INSERT IGNORE INTO `time_zone_leap_second` VALUES
+(78796800,1),
+(94694401,2),
+(126230402,3),
+(157766403,4),
+(189302404,5),
+(220924805,6),
+(252460806,7),
+(283996807,8),
+(315532808,9),
+(362793609,10),
+(394329610,11),
+(425865611,12),
+(489024012,13),
+(567993613,14),
+(631152014,15),
+(662688015,16),
+(709948816,17),
+(741484817,18),
+(773020818,19),
+(820454419,20),
+(867715220,21),
+(915148821,22);
/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition` WRITE;
/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
-INSERT IGNORE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+INSERT IGNORE INTO `time_zone_transition` VALUES
+(1,-1693706400,0),
+(1,-1680483600,1),
+(1,-1663455600,2),
+(1,-1650150000,3),
+(1,-1632006000,2),
+(1,-1618700400,3),
+(1,-938905200,2),
+(1,-857257200,3),
+(1,-844556400,2),
+(1,-828226800,3),
+(1,-812502000,2),
+(1,-796777200,3),
+(1,228877200,2),
+(1,243997200,3),
+(1,260326800,2),
+(1,276051600,3),
+(1,291776400,2),
+(1,307501200,3),
+(1,323830800,2),
+(1,338950800,3),
+(1,354675600,2),
+(1,370400400,3),
+(1,386125200,2),
+(1,401850000,3),
+(1,417574800,2),
+(1,433299600,3),
+(1,449024400,2),
+(1,465354000,3),
+(1,481078800,2),
+(1,496803600,3),
+(1,512528400,2),
+(1,528253200,3),
+(1,543978000,2),
+(1,559702800,3),
+(1,575427600,2),
+(1,591152400,3),
+(1,606877200,2),
+(1,622602000,3),
+(1,638326800,2),
+(1,654656400,3),
+(1,670381200,2),
+(1,686106000,3),
+(1,701830800,2),
+(1,717555600,3),
+(1,733280400,2),
+(1,749005200,3),
+(1,764730000,2),
+(1,780454800,3),
+(1,796179600,2),
+(1,811904400,3),
+(1,828234000,2),
+(1,846378000,3),
+(1,859683600,2),
+(1,877827600,3),
+(1,891133200,2),
+(1,909277200,3),
+(1,922582800,2),
+(1,941331600,3),
+(1,954032400,2),
+(1,972781200,3),
+(1,985482000,2),
+(1,1004230800,3),
+(1,1017536400,2),
+(1,1035680400,3),
+(1,1048986000,2),
+(1,1067130000,3),
+(1,1080435600,2),
+(1,1099184400,3),
+(1,1111885200,2),
+(1,1130634000,3),
+(1,1143334800,2),
+(1,1162083600,3),
+(1,1174784400,2),
+(1,1193533200,3),
+(1,1206838800,2),
+(1,1224982800,3),
+(1,1238288400,2),
+(1,1256432400,3),
+(1,1269738000,2),
+(1,1288486800,3),
+(1,1301187600,2),
+(1,1319936400,3),
+(1,1332637200,2),
+(1,1351386000,3),
+(1,1364691600,2),
+(1,1382835600,3),
+(1,1396141200,2),
+(1,1414285200,3),
+(1,1427590800,2),
+(1,1445734800,3),
+(1,1459040400,2),
+(1,1477789200,3),
+(1,1490490000,2),
+(1,1509238800,3),
+(1,1521939600,2),
+(1,1540688400,3),
+(1,1553994000,2),
+(1,1572138000,3),
+(1,1585443600,2),
+(1,1603587600,3),
+(1,1616893200,2),
+(1,1635642000,3),
+(1,1648342800,2),
+(1,1667091600,3),
+(1,1679792400,2),
+(1,1698541200,3),
+(1,1711846800,2),
+(1,1729990800,3),
+(1,1743296400,2),
+(1,1761440400,3),
+(1,1774746000,2),
+(1,1792890000,3),
+(1,1806195600,2),
+(1,1824944400,3),
+(1,1837645200,2),
+(1,1856394000,3),
+(1,1869094800,2),
+(1,1887843600,3),
+(1,1901149200,2),
+(1,1919293200,3),
+(1,1932598800,2),
+(1,1950742800,3),
+(1,1964048400,2),
+(1,1982797200,3),
+(1,1995498000,2),
+(1,2014246800,3),
+(1,2026947600,2),
+(1,2045696400,3),
+(1,2058397200,2),
+(1,2077146000,3),
+(1,2090451600,2),
+(1,2108595600,3),
+(1,2121901200,2),
+(1,2140045200,3),
+(3,-1688265000,2),
+(3,-1656819048,1),
+(3,-1641353448,2),
+(3,-1627965048,3),
+(3,-1618716648,1),
+(3,-1596429048,3),
+(3,-1593829848,5),
+(3,-1589860800,4),
+(3,-1542427200,5),
+(3,-1539493200,6),
+(3,-1525323600,5),
+(3,-1522728000,4),
+(3,-1491188400,7),
+(3,-1247536800,4),
+(3,354920400,5),
+(3,370728000,4),
+(3,386456400,5),
+(3,402264000,4),
+(3,417992400,5),
+(3,433800000,4),
+(3,449614800,5),
+(3,465346800,8),
+(3,481071600,9),
+(3,496796400,8),
+(3,512521200,9),
+(3,528246000,8),
+(3,543970800,9),
+(3,559695600,8),
+(3,575420400,9),
+(3,591145200,8),
+(3,606870000,9),
+(3,622594800,8),
+(3,638319600,9),
+(3,654649200,8),
+(3,670374000,10),
+(3,686102400,11),
+(3,695779200,8),
+(3,701812800,5),
+(3,717534000,4),
+(3,733273200,9),
+(3,748998000,8),
+(3,764722800,9),
+(3,780447600,8),
+(3,796172400,9),
+(3,811897200,8),
+(3,828226800,9),
+(3,846370800,8),
+(3,859676400,9),
+(3,877820400,8),
+(3,891126000,9),
+(3,909270000,8),
+(3,922575600,9),
+(3,941324400,8),
+(3,954025200,9),
+(3,972774000,8),
+(3,985474800,9),
+(3,1004223600,8),
+(3,1017529200,9),
+(3,1035673200,8),
+(3,1048978800,9),
+(3,1067122800,8),
+(3,1080428400,9),
+(3,1099177200,8),
+(3,1111878000,9),
+(3,1130626800,8),
+(3,1143327600,9),
+(3,1162076400,8),
+(3,1174777200,9),
+(3,1193526000,8),
+(3,1206831600,9),
+(3,1224975600,8),
+(3,1238281200,9),
+(3,1256425200,8),
+(3,1269730800,9),
+(3,1288479600,8),
+(3,1301180400,9),
+(3,1319929200,8),
+(3,1332630000,9),
+(3,1351378800,8),
+(3,1364684400,9),
+(3,1382828400,8),
+(3,1396134000,9),
+(3,1414278000,8),
+(3,1427583600,9),
+(3,1445727600,8),
+(3,1459033200,9),
+(3,1477782000,8),
+(3,1490482800,9),
+(3,1509231600,8),
+(3,1521932400,9),
+(3,1540681200,8),
+(3,1553986800,9),
+(3,1572130800,8),
+(3,1585436400,9),
+(3,1603580400,8),
+(3,1616886000,9),
+(3,1635634800,8),
+(3,1648335600,9),
+(3,1667084400,8),
+(3,1679785200,9),
+(3,1698534000,8),
+(3,1711839600,9),
+(3,1729983600,8),
+(3,1743289200,9),
+(3,1761433200,8),
+(3,1774738800,9),
+(3,1792882800,8),
+(3,1806188400,9),
+(3,1824937200,8),
+(3,1837638000,9),
+(3,1856386800,8),
+(3,1869087600,9),
+(3,1887836400,8),
+(3,1901142000,9),
+(3,1919286000,8),
+(3,1932591600,9),
+(3,1950735600,8),
+(3,1964041200,9),
+(3,1982790000,8),
+(3,1995490800,9),
+(3,2014239600,8),
+(3,2026940400,9),
+(3,2045689200,8),
+(3,2058390000,9),
+(3,2077138800,8),
+(3,2090444400,9),
+(3,2108588400,8),
+(3,2121894000,9),
+(3,2140038000,8),
+(4,-1688265000,2),
+(4,-1656819048,1),
+(4,-1641353448,2),
+(4,-1627965048,3),
+(4,-1618716648,1),
+(4,-1596429048,3),
+(4,-1593829848,5),
+(4,-1589860800,4),
+(4,-1542427200,5),
+(4,-1539493200,6),
+(4,-1525323600,5),
+(4,-1522728000,4),
+(4,-1491188400,7),
+(4,-1247536800,4),
+(4,354920409,5),
+(4,370728010,4),
+(4,386456410,5),
+(4,402264011,4),
+(4,417992411,5),
+(4,433800012,4),
+(4,449614812,5),
+(4,465346812,8),
+(4,481071612,9),
+(4,496796413,8),
+(4,512521213,9),
+(4,528246013,8),
+(4,543970813,9),
+(4,559695613,8),
+(4,575420414,9),
+(4,591145214,8),
+(4,606870014,9),
+(4,622594814,8),
+(4,638319615,9),
+(4,654649215,8),
+(4,670374016,10),
+(4,686102416,11),
+(4,695779216,8),
+(4,701812816,5),
+(4,717534017,4),
+(4,733273217,9),
+(4,748998018,8),
+(4,764722818,9),
+(4,780447619,8),
+(4,796172419,9),
+(4,811897219,8),
+(4,828226820,9),
+(4,846370820,8),
+(4,859676420,9),
+(4,877820421,8),
+(4,891126021,9),
+(4,909270021,8),
+(4,922575622,9),
+(4,941324422,8),
+(4,954025222,9),
+(4,972774022,8),
+(4,985474822,9),
+(4,1004223622,8),
+(4,1017529222,9),
+(4,1035673222,8),
+(4,1048978822,9),
+(4,1067122822,8),
+(4,1080428422,9),
+(4,1099177222,8),
+(4,1111878022,9),
+(4,1130626822,8),
+(4,1143327622,9),
+(4,1162076422,8),
+(4,1174777222,9),
+(4,1193526022,8),
+(4,1206831622,9),
+(4,1224975622,8),
+(4,1238281222,9),
+(4,1256425222,8),
+(4,1269730822,9),
+(4,1288479622,8),
+(4,1301180422,9),
+(4,1319929222,8),
+(4,1332630022,9),
+(4,1351378822,8),
+(4,1364684422,9),
+(4,1382828422,8),
+(4,1396134022,9),
+(4,1414278022,8),
+(4,1427583622,9),
+(4,1445727622,8),
+(4,1459033222,9),
+(4,1477782022,8),
+(4,1490482822,9),
+(4,1509231622,8),
+(4,1521932422,9),
+(4,1540681222,8),
+(4,1553986822,9),
+(4,1572130822,8),
+(4,1585436422,9),
+(4,1603580422,8),
+(4,1616886022,9),
+(4,1635634822,8),
+(4,1648335622,9),
+(4,1667084422,8),
+(4,1679785222,9),
+(4,1698534022,8),
+(4,1711839622,9),
+(4,1729983622,8),
+(4,1743289222,9),
+(4,1761433222,8),
+(4,1774738822,9),
+(4,1792882822,8),
+(4,1806188422,9),
+(4,1824937222,8),
+(4,1837638022,9),
+(4,1856386822,8),
+(4,1869087622,9),
+(4,1887836422,8),
+(4,1901142022,9),
+(4,1919286022,8),
+(4,1932591622,9),
+(4,1950735622,8),
+(4,1964041222,9),
+(4,1982790022,8),
+(4,1995490822,9),
+(4,2014239622,8),
+(4,2026940422,9),
+(4,2045689222,8),
+(4,2058390022,9),
+(4,2077138822,8),
+(4,2090444422,9),
+(4,2108588422,8),
+(4,2121894022,9),
+(4,2140038022,8),
+(5,-1009875600,1);
/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `time_zone_transition_type` WRITE;
/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
-INSERT IGNORE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+INSERT IGNORE INTO `time_zone_transition_type` VALUES
+(1,0,7200,1,'MEST'),
+(1,1,3600,0,'MET'),
+(1,2,7200,1,'MEST'),
+(1,3,3600,0,'MET'),
+(2,0,0,0,'UTC'),
+(3,0,9000,0,'MMT'),
+(3,1,12648,1,'MST'),
+(3,2,9048,0,'MMT'),
+(3,3,16248,1,'MDST'),
+(3,4,10800,0,'MSK'),
+(3,5,14400,1,'MSD'),
+(3,6,18000,1,'MSD'),
+(3,7,7200,0,'EET'),
+(3,8,10800,0,'MSK'),
+(3,9,14400,1,'MSD'),
+(3,10,10800,1,'EEST'),
+(3,11,7200,0,'EET'),
+(4,0,9000,0,'MMT'),
+(4,1,12648,1,'MST'),
+(4,2,9048,0,'MMT'),
+(4,3,16248,1,'MDST'),
+(4,4,10800,0,'MSK'),
+(4,5,14400,1,'MSD'),
+(4,6,18000,1,'MSD'),
+(4,7,7200,0,'EET'),
+(4,8,10800,0,'MSK'),
+(4,9,14400,1,'MSD'),
+(4,10,10800,1,'EEST'),
+(4,11,7200,0,'EET'),
+(5,0,32400,0,'CJT'),
+(5,1,32400,0,'JST');
/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/mysql-test/main/mysqldump-timing.result b/mysql-test/main/mysqldump-timing.result
index fe44a1eadd4..7fa11893274 100644
--- a/mysql-test/main/mysqldump-timing.result
+++ b/mysql-test/main/mysqldump-timing.result
@@ -51,7 +51,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (0);
+INSERT INTO `t1` VALUES
+(0);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/mysql-test/main/mysqldump-utf8mb4.result b/mysql-test/main/mysqldump-utf8mb4.result
index 50c23c5efa9..904771302f8 100644
--- a/mysql-test/main/mysqldump-utf8mb4.result
+++ b/mysql-test/main/mysqldump-utf8mb4.result
@@ -56,7 +56,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('01f300','🌀','U+1F300 CYCLONE');
+INSERT INTO `t1` VALUES
+('01f300','🌀','U+1F300 CYCLONE');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
index efc54bca8d3..b9cdfba9a09 100644
--- a/mysql-test/main/mysqldump.result
+++ b/mysql-test/main/mysqldump.result
@@ -37,7 +37,9 @@ CREATE TABLE `t1` (
`a` decimal(64,20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1234567890123456789012345678901234567890.00000000000000000000),(987654321098765432109876543210987654321.00000000000000000000);
+INSERT INTO `t1` VALUES
+(1234567890123456789012345678901234567890.00000000000000000000),
+(987654321098765432109876543210987654321.00000000000000000000);
DROP TABLE t1;
#
# Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
@@ -52,7 +54,8 @@ CREATE TABLE `t1` (
`a` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (-1.7976931348623157e308);
+INSERT INTO `t1` VALUES
+(-1.7976931348623157e308);
DROP TABLE t1;
#
# Bug#3361 mysqldump quotes DECIMAL values inconsistently
@@ -74,7 +77,12 @@ CREATE TABLE `t1` (
`b` float DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456);
+INSERT INTO `t1` VALUES
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
@@ -82,7 +90,12 @@ CREATE TABLE `t1` (
`b` float DEFAULT NULL
);
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456);
+INSERT INTO `t1` VALUES
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -105,7 +118,12 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456);
+INSERT INTO `t1` VALUES
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -132,7 +150,12 @@ CREATE TABLE `t1` (
);
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456);
+INSERT INTO `t1` VALUES
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456),
+(1.23450,2.3456);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -248,7 +271,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -271,7 +296,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -534,7 +561,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('ÄÖÜß');
+INSERT INTO `t1` VALUES
+('ÄÖÜß');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -567,7 +595,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('Ž™šá');
+INSERT INTO `t1` VALUES
+('Ž™šá');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -590,7 +619,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('Ž™šá');
+INSERT INTO `t1` VALUES
+('Ž™šá');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -613,7 +643,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('ÄÖÜß');
+INSERT INTO `t1` VALUES
+('ÄÖÜß');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -652,7 +683,10 @@ CREATE TABLE `t2` (
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES (4),(5),(6);
+INSERT INTO `t2` VALUES
+(4),
+(5),
+(6);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -734,7 +768,13 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
+INSERT IGNORE INTO `t1` VALUES
+(1),
+(2),
+(3),
+(4),
+(5),
+(6);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -767,7 +807,13 @@ CREATE TABLE `t1` (
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
+INSERT DELAYED IGNORE INTO `t1` VALUES
+(1),
+(2),
+(3),
+(4),
+(5),
+(6);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1512,7 +1558,10 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2),(3);
+INSERT INTO `t1` VALUES
+(1),
+(2),
+(3);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1731,13 +1780,20 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (NULL),(10),(20);
+INSERT INTO `t1` VALUES
+(NULL),
+(10),
+(20);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL);
+INSERT INTO `t2` VALUES
+(1,NULL,NULL,NULL,NULL,NULL),
+(2,10,NULL,NULL,NULL,NULL),
+(3,NULL,'twenty',NULL,NULL,NULL),
+(4,30,'thirty',NULL,NULL,NULL);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1770,7 +1826,10 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (NULL),(10),(20);
+INSERT INTO `t1` VALUES
+(NULL),
+(10),
+(20);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
@@ -1789,7 +1848,11 @@ CREATE TABLE `t2` (
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL);
+INSERT INTO `t2` VALUES
+(1,NULL,NULL,NULL,NULL,NULL),
+(2,10,NULL,NULL,NULL,NULL),
+(3,NULL,'twenty',NULL,NULL,NULL),
+(4,30,'thirty',NULL,NULL,NULL);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1976,7 +2039,8 @@ CREATE TABLE "t1" (
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
-INSERT INTO "t1" VALUES (815,4711,2006);
+INSERT INTO "t1" VALUES
+(815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -2010,7 +2074,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (815,4711,2006);
+INSERT INTO `t1` VALUES
+(815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -2062,7 +2127,12 @@ CREATE TABLE `t2` (
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
+INSERT INTO `t2` VALUES
+('alfred'),
+('angie'),
+('bingo'),
+('waffle'),
+('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
@@ -2226,7 +2296,12 @@ CREATE TABLE `t2` (
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
-INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
+INSERT INTO `t2` VALUES
+('alfred'),
+('angie'),
+('bingo'),
+('waffle'),
+('lemon');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
@@ -2290,7 +2365,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('\'');
+INSERT INTO `t1` VALUES
+('\'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -2338,7 +2414,10 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1,2,'one'),(2,4,'two'),(3,6,'three');
+INSERT INTO `t1` VALUES
+(1,2,'one'),
+(2,4,'two'),
+(3,6,'three');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v1`;
@@ -2490,7 +2569,11 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
+INSERT INTO `t1` VALUES
+(1,NULL),
+(2,NULL),
+(4,NULL),
+(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -2619,7 +2702,11 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
+INSERT INTO `t1` VALUES
+(1,NULL),
+(2,NULL),
+(4,NULL),
+(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
@@ -2765,7 +2852,12 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2),(3),(4),(5);
+INSERT INTO `t1` VALUES
+(1),
+(2),
+(3),
+(4),
+(5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
@@ -2917,7 +3009,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
+INSERT INTO `t1` VALUES
+('2003-10-25 22:00:00'),
+('2003-10-25 23:00:00');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -2954,7 +3048,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES ('2003-10-26 02:00:00'),('2003-10-26 02:00:00');
+INSERT INTO `t1` VALUES
+('2003-10-26 02:00:00'),
+('2003-10-26 02:00:00');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
@@ -3006,7 +3102,10 @@ CREATE TABLE "t1 test" (
LOCK TABLES "t1 test" WRITE;
/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
-INSERT INTO "t1 test" VALUES (1),(2),(3);
+INSERT INTO "t1 test" VALUES
+(1),
+(2),
+(3);
/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -3035,7 +3134,10 @@ CREATE TABLE "t2 test" (
LOCK TABLES "t2 test" WRITE;
/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
-INSERT INTO "t2 test" VALUES (1),(2),(3);
+INSERT INTO "t2 test" VALUES
+(1),
+(2),
+(3);
/*!40000 ALTER TABLE "t2 test" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -3091,7 +3193,10 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1,'first value','xxxx'),(2,'second value','tttt'),(3,'third value','vvv vvv');
+INSERT INTO `t1` VALUES
+(1,'first value','xxxx'),
+(2,'second value','tttt'),
+(3,'third value','vvv vvv');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v0`;
@@ -3309,7 +3414,8 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (0x00,'');
+INSERT INTO `t1` VALUES
+(0x00,'');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -3489,7 +3595,11 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
+INSERT INTO `t1` VALUES
+(1232131),
+(4711),
+(3231),
+(815);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v1`;
@@ -3874,7 +3984,8 @@ CREATE TABLE `t1` (
`c2` longblob DEFAULT NULL
);
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
+INSERT INTO `t1` VALUES
+(11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
DROP TABLE t1;
#
# Bug#28524 mysqldump --skip-add-drop-table is not
@@ -4106,7 +4217,11 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
+REPLACE INTO `t1` VALUES
+(1,1),
+(2,3),
+(3,4),
+(4,5);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -4381,7 +4496,11 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
+INSERT INTO `t1` VALUES
+(1232131),
+(4711),
+(3231),
+(815);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v1`;
@@ -5476,7 +5595,9 @@ CREATE TABLE `basetable` (
`id` smallint(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `basetable` VALUES (5),(6);
+INSERT INTO `basetable` VALUES
+(5),
+(6);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nonunique_table_name` (
@@ -5499,14 +5620,18 @@ CREATE TABLE `nonunique_table_name` (
UNIQUE KEY `i1` (`i1`)
) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_name` VALUES (1),(2);
+INSERT INTO `nonunique_table_name` VALUES
+(1),
+(2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nonunique_table_view_name` (
`i2` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_view_name` VALUES (3),(4);
+INSERT INTO `nonunique_table_view_name` VALUES
+(3),
+(4);
USE `db1`;
/*!50001 DROP VIEW IF EXISTS `nonunique_table_view_name`*/;
@@ -5535,14 +5660,18 @@ CREATE TABLE `nonunique_table_name` (
UNIQUE KEY `i1` (`i1`)
) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_name` VALUES (1),(2);
+INSERT INTO `nonunique_table_name` VALUES
+(1),
+(2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nonunique_table_view_name` (
`i2` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_view_name` VALUES (3),(4);
+INSERT INTO `nonunique_table_view_name` VALUES
+(3),
+(4);
##################################################
# --compact --delayed-insert --no-data-med=0 --databases db2 db1
@@ -5557,14 +5686,18 @@ CREATE TABLE `nonunique_table_name` (
UNIQUE KEY `i1` (`i1`)
) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT DELAYED INTO `nonunique_table_name` VALUES (1),(2);
+INSERT DELAYED INTO `nonunique_table_name` VALUES
+(1),
+(2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nonunique_table_view_name` (
`i2` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_view_name` VALUES (3),(4);
+INSERT INTO `nonunique_table_view_name` VALUES
+(3),
+(4);
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */;
@@ -5575,14 +5708,18 @@ CREATE TABLE `basetable` (
`id` smallint(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT DELAYED INTO `basetable` VALUES (5),(6);
+INSERT DELAYED INTO `basetable` VALUES
+(5),
+(6);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nonunique_table_name` (
`i3` smallint(6) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci INSERT_METHOD=LAST UNION=(`basetable`);
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `nonunique_table_name` VALUES (5),(6);
+INSERT INTO `nonunique_table_name` VALUES
+(5),
+(6);
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `nonunique_table_view_name` AS SELECT
@@ -6048,7 +6185,8 @@ CREATE TABLE `t1` (
`b` int(11) INVISIBLE DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),(1,2);
+INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
+(1,2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
@@ -6056,7 +6194,9 @@ CREATE TABLE `t2` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t2` VALUES (1,2),(1,2);
+INSERT INTO `t2` VALUES
+(1,2),
+(1,2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t3` (
@@ -6065,14 +6205,18 @@ CREATE TABLE `t3` (
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),(5,4,5),(2,4,5),(1,2,3);
+INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
+(5,4,5),
+(2,4,5),
+(1,2,3);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t4` (
`ËÃÃŒÃÎËÃ1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t4` VALUES (1);
+INSERT INTO `t4` VALUES
+(1);
#Check side effect on --complete insert
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@@ -6081,7 +6225,8 @@ CREATE TABLE `t1` (
`b` int(11) INVISIBLE DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),(1,2);
+INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
+(1,2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
@@ -6089,7 +6234,8 @@ CREATE TABLE `t2` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t2` (`a`, `b`) VALUES (1,2),(1,2);
+INSERT INTO `t2` (`a`, `b`) VALUES (1,2),
+(1,2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t3` (
@@ -6098,7 +6244,10 @@ CREATE TABLE `t3` (
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),(5,4,5),(2,4,5),(1,2,3);
+INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
+(5,4,5),
+(2,4,5),
+(1,2,3);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t4` (
diff --git a/mysql-test/main/natural_sort_key.result b/mysql-test/main/natural_sort_key.result
new file mode 100644
index 00000000000..218a3e2cd9c
--- /dev/null
+++ b/mysql-test/main/natural_sort_key.result
@@ -0,0 +1,214 @@
+SET NAMES utf8mb4;
+SELECT NATURAL_SORT_KEY(NULL);
+NATURAL_SORT_KEY(NULL)
+NULL
+SELECT NATURAL_SORT_KEY(repeat('a1',@@max_allowed_packet/2-1));
+NATURAL_SORT_KEY(repeat('a1',@@max_allowed_packet/2-1))
+NULL
+Warnings:
+Warning 1301 Result of natural_sort_key() was larger than max_allowed_packet (16777216) - truncated
+SELECT NATURAL_SORT_KEY(repeat('1',@@max_allowed_packet-1));
+NATURAL_SORT_KEY(repeat('1',@@max_allowed_packet-1))
+NULL
+Warnings:
+Warning 1301 Result of natural_sort_key() was larger than max_allowed_packet (16777216) - truncated
+CREATE TABLE t1(
+c VARCHAR(30) CHARACTER SET latin1 COLLATE latin1_bin,
+k VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS (NATURAL_SORT_KEY(CONVERT(c USING utf8mb4))) VIRTUAL INVISIBLE);
+INSERT INTO t1 values
+('A1'),('a1'),('A100'),('a100'),('A2'),('ä2'),('a2'),('A99'),
+('äb'),('B1'),('B100'),('B9'),('C'),('100');
+#Natural sort order.
+SELECT c FROM t1 ORDER BY k,c;
+c
+100
+A1
+a1
+A2
+a2
+ä2
+A99
+A100
+a100
+äb
+B1
+B9
+B100
+C
+#Unnatural but unicode aware) sort order
+SELECT c FROM t1 ORDER BY CONVERT(c USING utf8mb4) COLLATE utf8mb4_unicode_ci,c;
+c
+100
+A1
+a1
+A100
+a100
+A2
+a2
+ä2
+A99
+äb
+B1
+B100
+B9
+C
+CREATE TABLE t2 AS SELECT c, NATURAL_SORT_KEY(c) FROM t1 WHERE 0;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
+ `NATURAL_SORT_KEY(c)` varchar(45) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1,t2;
+CREATE TABLE t1(c VARCHAR(1), k VARCHAR(2) AS (NATURAL_SORT_KEY(c)) STORED);
+ERROR HY000: Function or expression 'natural_sort_key()' cannot be used in the GENERATED ALWAYS AS clause of `k`
+SELECT RPAD(val,28,' ') value , RPAD(NATURAL_SORT_KEY(val),36,' ') sortkey , LENGTH(NATURAL_SORT_KEY(val)) - LENGTH(val) encoding_overhead
+FROM
+(
+SELECT '0' val
+UNION SELECT seq FROM seq_1_to_9
+UNION SELECT CONCAT('1',repeat('0',seq)) FROM seq_1_to_27
+) AS numbers ORDER BY sortkey;
+value sortkey encoding_overhead
+0 00 1
+1 01 1
+2 02 1
+3 03 1
+4 04 1
+5 05 1
+6 06 1
+7 07 1
+8 08 1
+9 09 1
+10 110 1
+100 2100 1
+1000 31000 1
+10000 410000 1
+100000 5100000 1
+1000000 61000000 1
+10000000 710000000 1
+100000000 8100000000 1
+1000000000 901000000000 2
+10000000000 9110000000000 2
+100000000000 92100000000000 2
+1000000000000 931000000000000 2
+10000000000000 9410000000000000 2
+100000000000000 95100000000000000 2
+1000000000000000 961000000000000000 2
+10000000000000000 9710000000000000000 2
+100000000000000000 98100000000000000000 2
+1000000000000000000 9901000000000000000000 3
+10000000000000000000 99110000000000000000000 3
+100000000000000000000 992100000000000000000000 3
+1000000000000000000000 9931000000000000000000000 3
+10000000000000000000000 99410000000000000000000000 3
+100000000000000000000000 995100000000000000000000000 3
+1000000000000000000000000 9961000000000000000000000000 3
+10000000000000000000000000 99710000000000000000000000000 3
+100000000000000000000000000 998100000000000000000000000000 3
+1000000000000000000000000000 99901271000000000000000000000000000 7
+SELECT natural_sort_key('1') = natural_sort_key('0001');
+natural_sort_key('1') = natural_sort_key('0001')
+1
+SELECT natural_sort_key('1.1') = natural_sort_key('1.00001');
+natural_sort_key('1.1') = natural_sort_key('1.00001')
+1
+SELECT RPAD(val,20,' ') value, NATURAL_SORT_KEY(val) FROM
+(SELECT '' val WHERE 0 UNION VALUES
+('fred'),
+('pic2'),
+('pic100a'),
+('pic120'),
+('pic121'),
+('jane'),
+('tom'),
+('pic02a'),
+('pic3'),
+('pic4'),
+('1-20'),
+('pic100'),
+('pic02000'),
+('10-20'),
+('1-02'),
+('1-2'),
+('pic01'),
+('pic02'),
+('pic 6'),
+('pic 7'),
+('pic 5'),
+('pic05'),
+('pic 5 '),
+('pic 5 something'),
+('pic 4 else'),
+('2000-1-10'),
+('1999-12-25'),
+('1999-3-3'),
+('2000-3-23'),
+('2000-1-2'),
+('100.200.300.400'),
+('100.50.60.70'),
+('100.8.9.0'),
+('a1b1'),
+('a01b2'),
+('a1b2'),
+('a01b3')
+)AS data ORDER BY 2,1;
+value NATURAL_SORT_KEY(val)
+1-02 01-02
+1-2 01-02
+1-20 01-120
+10-20 110-120
+100.8.9.0 2100.08.09.00
+100.50.60.70 2100.150.160.170
+100.200.300.400 2100.2200.2300.2400
+1999-3-3 31999-03-03
+1999-12-25 31999-112-125
+2000-1-2 32000-01-02
+2000-1-10 32000-01-110
+2000-3-23 32000-03-123
+a1b1 a01b01
+a01b2 a01b02
+a1b2 a01b02
+a01b3 a01b03
+fred fred
+jane jane
+pic 7 pic 07
+pic 4 else pic 04 else
+pic 5 pic 05
+pic 5 something pic 05 something
+pic 6 pic 06
+pic01 pic01
+pic02 pic02
+pic2 pic02
+pic02a pic02a
+pic3 pic03
+pic4 pic04
+pic05 pic05
+pic100 pic2100
+pic100a pic2100a
+pic120 pic2120
+pic121 pic2121
+pic02000 pic32000
+tom tom
+create table t (a varchar(8), b varchar(8) as (natural_sort_key(a)));
+insert into t (a) values ('a2'),(NULL),('a11');
+select * from t order by b;
+a b
+NULL NULL
+a2 a02
+a11 a111
+select a, b from t order by b;
+a b
+NULL NULL
+a2 a02
+a11 a111
+drop table t;
+select natural_sort_key(_utf16 0x0031),natural_sort_key(_ucs2 0x0031), natural_sort_key(_utf32 0x00000031);
+natural_sort_key(_utf16 0x0031) natural_sort_key(_ucs2 0x0031) natural_sort_key(_utf32 0x00000031)
+01 01 01
+select get_lock('a', 0);
+get_lock('a', 0)
+1
+select natural_sort_key(release_lock('a'));
+natural_sort_key(release_lock('a'))
+01
diff --git a/mysql-test/main/natural_sort_key.test b/mysql-test/main/natural_sort_key.test
new file mode 100644
index 00000000000..811f937750c
--- /dev/null
+++ b/mysql-test/main/natural_sort_key.test
@@ -0,0 +1,102 @@
+--source include/have_sequence.inc
+
+SET NAMES utf8mb4;
+SELECT NATURAL_SORT_KEY(NULL);
+
+#Test that max packet overflow produces NULL plus warning
+SELECT NATURAL_SORT_KEY(repeat('a1',@@max_allowed_packet/2-1));
+SELECT NATURAL_SORT_KEY(repeat('1',@@max_allowed_packet-1));
+
+#Test with virtual
+CREATE TABLE t1(
+ c VARCHAR(30) CHARACTER SET latin1 COLLATE latin1_bin,
+ k VARCHAR(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS (NATURAL_SORT_KEY(CONVERT(c USING utf8mb4))) VIRTUAL INVISIBLE);
+
+INSERT INTO t1 values
+ ('A1'),('a1'),('A100'),('a100'),('A2'),('ä2'),('a2'),('A99'),
+ ('äb'),('B1'),('B100'),('B9'),('C'),('100');
+
+-- echo #Natural sort order.
+# We sort by 2 colums, for stable sort,as we do not currenly have a case and accent insensitive Unicode collation.
+SELECT c FROM t1 ORDER BY k,c;
+-- echo #Unnatural but unicode aware) sort order
+SELECT c FROM t1 ORDER BY CONVERT(c USING utf8mb4) COLLATE utf8mb4_unicode_ci,c;
+# CREATE TABLE AS SELECT, to see that length of the column is correct.
+CREATE TABLE t2 AS SELECT c, NATURAL_SORT_KEY(c) FROM t1 WHERE 0;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+#Virtual STORED is temporarily disabled
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+CREATE TABLE t1(c VARCHAR(1), k VARCHAR(2) AS (NATURAL_SORT_KEY(c)) STORED);
+
+#Show encoding of numbers.
+SELECT RPAD(val,28,' ') value , RPAD(NATURAL_SORT_KEY(val),36,' ') sortkey , LENGTH(NATURAL_SORT_KEY(val)) - LENGTH(val) encoding_overhead
+FROM
+(
+SELECT '0' val
+UNION SELECT seq FROM seq_1_to_9
+UNION SELECT CONCAT('1',repeat('0',seq)) FROM seq_1_to_27
+) AS numbers ORDER BY sortkey;
+
+# leading zeros ignored
+SELECT natural_sort_key('1') = natural_sort_key('0001');
+SELECT natural_sort_key('1.1') = natural_sort_key('1.00001');
+
+# Some examples from https://github.com/sourcefrog/natsort/
+# words
+SELECT RPAD(val,20,' ') value, NATURAL_SORT_KEY(val) FROM
+(SELECT '' val WHERE 0 UNION VALUES
+('fred'),
+('pic2'),
+('pic100a'),
+('pic120'),
+('pic121'),
+('jane'),
+('tom'),
+('pic02a'),
+('pic3'),
+('pic4'),
+('1-20'),
+('pic100'),
+('pic02000'),
+('10-20'),
+('1-02'),
+('1-2'),
+('pic01'),
+('pic02'),
+('pic 6'),
+('pic 7'),
+('pic 5'),
+('pic05'),
+('pic 5 '),
+('pic 5 something'),
+('pic 4 else'),
+('2000-1-10'),
+('1999-12-25'),
+('1999-3-3'),
+('2000-3-23'),
+('2000-1-2'),
+('100.200.300.400'),
+('100.50.60.70'),
+('100.8.9.0'),
+('a1b1'),
+('a01b2'),
+('a1b2'),
+('a01b3')
+)AS data ORDER BY 2,1;
+
+# MDEV-27686 (null value indicator not always reset)
+create table t (a varchar(8), b varchar(8) as (natural_sort_key(a)));
+insert into t (a) values ('a2'),(NULL),('a11');
+select * from t order by b;
+select a, b from t order by b;
+drop table t;
+
+# MDEV-26796 Natural sort does not work for utf32/utf16/ucs2
+select natural_sort_key(_utf16 0x0031),natural_sort_key(_ucs2 0x0031), natural_sort_key(_utf32 0x00000031);
+
+# MDEV-26806 Server crash in Charset::charset / Item_func_natural_sort_key::val_str
+select get_lock('a', 0);
+select natural_sort_key(release_lock('a'));
+
diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result
index 029fa47f263..a5ac8956b2f 100644
--- a/mysql-test/main/openssl_1.result
+++ b/mysql-test/main/openssl_1.result
@@ -98,7 +98,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -132,7 +134,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -166,7 +170,9 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result
index b2b34b975e3..ac759239de6 100644
--- a/mysql-test/main/partition.result
+++ b/mysql-test/main/partition.result
@@ -2643,7 +2643,7 @@ Note 1517 Duplicate partition name p5
alter table t1 drop partition if exists p5;
alter table t1 drop partition if exists p5;
Warnings:
-Note 1507 Error in list of partitions to DROP
+Note 1507 Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0));
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1));
diff --git a/mysql-test/main/partition_alter.result b/mysql-test/main/partition_alter.result
index 5bf8edea878..28fef4e80d1 100644
--- a/mysql-test/main/partition_alter.result
+++ b/mysql-test/main/partition_alter.result
@@ -313,3 +313,68 @@ test.t check status OK
delete from t order by b limit 1;
drop table t;
# End of 10.5 tests
+create or replace table t1 (x int primary key)
+partition by range(x) (
+p1 values less than (10),
+partition p2 values less than (20),
+p3 values less than (30),
+partition p4 values less than (40),
+p5 values less than (50),
+pn values less than maxvalue);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+create or replace table t1 (x int)
+partition by list(x) (
+partition p1 values in (2, 3, 4),
+partition p2 values in (12, 13, 14),
+partition p3 values in (22, 23, 24),
+p4 values in (32, 33, 34),
+p5 values in (42, 43, 44),
+pn values in (52, 53, 54));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY LIST (`x`)
+(PARTITION `p1` VALUES IN (2,3,4) ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (12,13,14) ENGINE = MyISAM,
+ PARTITION `p3` VALUES IN (22,23,24) ENGINE = MyISAM,
+ PARTITION `p4` VALUES IN (32,33,34) ENGINE = MyISAM,
+ PARTITION `p5` VALUES IN (42,43,44) ENGINE = MyISAM,
+ PARTITION `pn` VALUES IN (52,53,54) ENGINE = MyISAM)
+create or replace table t1 (x int)
+partition by list(x) (
+partition partition p1 values in (2, 3, 4),
+pn values in (52, 53, 54));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'partition p1 values in (2, 3, 4),
+pn values in (52, 53, 54))' at line 3
+create or replace table t1 (x int)
+partition by list(x) (
+partition partition values in (2, 3, 4),
+pn values in (52, 53, 54));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'partition values in (2, 3, 4),
+pn values in (52, 53, 54))' at line 3
+create or replace table t1 (x int)
+partition by list(x) (
+partition values in (2, 3, 4),
+pn values in (52, 53, 54));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'in (2, 3, 4),
+pn values in (52, 53, 54))' at line 3
+create or replace table t1 (x int)
+partition by list(x) (
+partitio values in (2, 3, 4),
+pn values in (52, 53, 54));
+drop table t1;
+# End of 10.7 tests
diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test
index 593169d093d..72b09549b18 100644
--- a/mysql-test/main/partition_alter.test
+++ b/mysql-test/main/partition_alter.test
@@ -264,3 +264,52 @@ delete from t order by b limit 1;
drop table t;
--echo # End of 10.5 tests
+
+create or replace table t1 (x int primary key)
+partition by range(x) (
+ p1 values less than (10),
+ partition p2 values less than (20),
+ p3 values less than (30),
+ partition p4 values less than (40),
+ p5 values less than (50),
+ pn values less than maxvalue);
+
+show create table t1;
+
+create or replace table t1 (x int)
+partition by list(x) (
+ partition p1 values in (2, 3, 4),
+ partition p2 values in (12, 13, 14),
+ partition p3 values in (22, 23, 24),
+ p4 values in (32, 33, 34),
+ p5 values in (42, 43, 44),
+ pn values in (52, 53, 54));
+
+show create table t1;
+
+--error ER_PARSE_ERROR
+create or replace table t1 (x int)
+partition by list(x) (
+ partition partition p1 values in (2, 3, 4),
+ pn values in (52, 53, 54));
+
+--error ER_PARSE_ERROR
+create or replace table t1 (x int)
+partition by list(x) (
+ partition partition values in (2, 3, 4),
+ pn values in (52, 53, 54));
+
+--error ER_PARSE_ERROR
+create or replace table t1 (x int)
+partition by list(x) (
+ partition values in (2, 3, 4),
+ pn values in (52, 53, 54));
+
+create or replace table t1 (x int)
+partition by list(x) (
+ partitio values in (2, 3, 4),
+ pn values in (52, 53, 54));
+
+drop table t1;
+
+--echo # End of 10.7 tests
diff --git a/mysql-test/main/partition_binlog.result b/mysql-test/main/partition_binlog.result
index 3e6100b51d8..45cd636c1f9 100644
--- a/mysql-test/main/partition_binlog.result
+++ b/mysql-test/main/partition_binlog.result
@@ -11,20 +11,20 @@ INSERT INTO t1 VALUES (1), (10), (100), (1000);
ALTER TABLE t1 TRUNCATE PARTITION p1;
ERROR HY000: Unknown partition 'p1' in table 't1'
ALTER TABLE t1 DROP PARTITION p1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
# No error returned, output in table format instead:
ALTER TABLE t1 ANALYZE PARTITION p1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
ALTER TABLE t1 CHECK PARTITION p1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
ALTER TABLE t1 OPTIMIZE PARTITION p1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
ALTER TABLE t1 REPAIR PARTITION p1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
ALTER TABLE t1 ANALYZE PARTITION p0;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
diff --git a/mysql-test/main/partition_binlog.test b/mysql-test/main/partition_binlog.test
index d6986c86ebe..665293d4881 100644
--- a/mysql-test/main/partition_binlog.test
+++ b/mysql-test/main/partition_binlog.test
@@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (1), (10), (100), (1000);
--error ER_UNKNOWN_PARTITION
ALTER TABLE t1 TRUNCATE PARTITION p1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION p1;
--echo # No error returned, output in table format instead:
diff --git a/mysql-test/main/partition_error.result b/mysql-test/main/partition_error.result
index 350e8733220..ba3957bedfd 100644
--- a/mysql-test/main/partition_error.result
+++ b/mysql-test/main/partition_error.result
@@ -29,7 +29,7 @@ INSERT INTO t1 VALUES (5,3),(5,6);
ALTER TABLE t1 PARTITION BY KEY(b) PARTITIONS 3 ;
ALTER TABLE t1 REPAIR PARTITION p1, p3;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
ALTER TABLE t1 ORDER BY b;
DROP TABLE t1;
#
@@ -43,7 +43,7 @@ PARTITION p1 VALUES LESS THAN MAXVALUE ) ;
ALTER TABLE t1 DROP PARTITION p1;
ALTER TABLE t1 ANALYZE PARTITION p0, p1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
ALTER TABLE t1 COMMENT 'altered';
DROP TABLE t1;
#
@@ -765,7 +765,7 @@ ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
#
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
-ERROR HY000: Partitioned tables do not support CREATE TEMPORARY TABLE
+ERROR HY000: Table storage engine 'partition' does not support the create option 'TEMPORARY'
DROP TABLE t1;
#
# Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
diff --git a/mysql-test/main/partition_error.test b/mysql-test/main/partition_error.test
index edfe7c827be..b8d07e595e5 100644
--- a/mysql-test/main/partition_error.test
+++ b/mysql-test/main/partition_error.test
@@ -800,7 +800,7 @@ PARTITION BY HASH (c) PARTITIONS 4;
--echo # with temporary table and partitions
--echo #
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
---error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
+--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
DROP TABLE t1;
--echo #
diff --git a/mysql-test/main/partition_exchange.result b/mysql-test/main/partition_exchange.result
index c82d8d2071b..5a3d7330d96 100644
--- a/mysql-test/main/partition_exchange.result
+++ b/mysql-test/main/partition_exchange.result
@@ -1306,7 +1306,6 @@ ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`)
CREATE TABLE t2 like t1;
ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
-ERROR HY000: Non matching attribute 'TABLESPACE' between partition and table
DROP TABLE t1, t2;
#
# MDEV-14642 Assertion `table->s->db_create_options == part_table->s->db_create_options' failed in compare_table_with_partition
diff --git a/mysql-test/main/partition_exchange.test b/mysql-test/main/partition_exchange.test
index 09629a52add..8e0be49b5ab 100644
--- a/mysql-test/main/partition_exchange.test
+++ b/mysql-test/main/partition_exchange.test
@@ -533,7 +533,7 @@ CREATE TABLE t1 (a VARCHAR(200)) PARTITION BY KEY(a) partitions 10;
ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`);
CREATE TABLE t2 like t1;
ALTER TABLE t2 REMOVE PARTITIONING;
---error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
+# The following works as table spaces are not checked anymore
ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
DROP TABLE t1, t2;
diff --git a/mysql-test/main/partition_mgm_err.result b/mysql-test/main/partition_mgm_err.result
index 01adc4f5adf..864b1cbd37f 100644
--- a/mysql-test/main/partition_mgm_err.result
+++ b/mysql-test/main/partition_mgm_err.result
@@ -16,13 +16,13 @@ ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
PARTITION x11 VALUES LESS THAN (5));
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
(PARTITION x11 VALUES LESS THAN (22));
ERROR HY000: More partitions to reorganize than there are partitions
@@ -34,7 +34,7 @@ ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
ERROR HY000: When reorganizing a set of partitions they must be in consecutive order
ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
(PARTITION x11 VALUES LESS THAN (4));
-ERROR HY000: Error in list of partitions to REORGANIZE
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (5));
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
@@ -113,7 +113,7 @@ PARTITION x1 VALUES LESS THAN (8));
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
ERROR HY000: For RANGE partitions each partition must be defined
ALTER TABLE t1 DROP PARTITION x2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 COALESCE PARTITION 1;
ERROR HY000: COALESCE PARTITION can only be used on HASH/KEY partitions
ALTER TABLE t1 DROP PARTITION x1;
diff --git a/mysql-test/main/partition_mgm_err.test b/mysql-test/main/partition_mgm_err.test
index 0987c427fc7..82b9db7bbe1 100644
--- a/mysql-test/main/partition_mgm_err.test
+++ b/mysql-test/main/partition_mgm_err.test
@@ -29,16 +29,16 @@ ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (2),
PARTITION x11 VALUES LESS THAN (5));
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
--error ER_REORG_PARTITION_NOT_EXIST
@@ -53,7 +53,7 @@ ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
(PARTITION x11 VALUES LESS THAN (2));
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
(PARTITION x11 VALUES LESS THAN (4));
@@ -167,7 +167,7 @@ PARTITION BY RANGE (a)
--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION x2;
--error ER_COALESCE_ONLY_ON_HASH_PARTITION
diff --git a/mysql-test/main/partition_range.result b/mysql-test/main/partition_range.result
index 213997e0758..9cefe83e1e2 100644
--- a/mysql-test/main/partition_range.result
+++ b/mysql-test/main/partition_range.result
@@ -294,9 +294,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
-(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
- PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
- PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
+(PARTITION `x1` VALUES LESS THAN (5) ENGINE = MyISAM,
+ PARTITION `x2` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `x3` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
ALTER TABLE t1
partition by range (a)
partitions 3
@@ -318,9 +318,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
-(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
- PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
- PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
+(PARTITION `x1` VALUES LESS THAN (5) ENGINE = MyISAM,
+ PARTITION `x2` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `x3` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
diff --git a/mysql-test/main/partition_sync.result b/mysql-test/main/partition_sync.result
index badcb10e5da..149eadf257b 100644
--- a/mysql-test/main/partition_sync.result
+++ b/mysql-test/main/partition_sync.result
@@ -15,7 +15,7 @@ a
1
connection default;
ALTER TABLE t1 DROP PARTITION p3;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
connection con1;
# This failed with deadlock and should not do so.
SELECT * FROM t1;
diff --git a/mysql-test/main/partition_sync.test b/mysql-test/main/partition_sync.test
index a07fb6e5c13..9b75ab79edd 100644
--- a/mysql-test/main/partition_sync.test
+++ b/mysql-test/main/partition_sync.test
@@ -22,7 +22,7 @@ BEGIN;
SELECT * FROM t1;
connection default;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION p3;
connection con1;
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index 092e817c48e..50a82efe55a 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -12,7 +12,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@@ -25,7 +25,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
@@ -68,7 +68,7 @@ PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index c95d8033734..91f26907894 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -5241,13 +5241,13 @@ DECLARE a DATETIME;
CALL p1(a);
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 0
BEGIN NOT ATOMIC
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 0
BEGIN NOT ATOMIC
DECLARE a DATETIME;
PREPARE stmt FROM 'CALL p1(?)';
@@ -5255,7 +5255,7 @@ EXECUTE stmt USING a;
DEALLOCATE PREPARE stmt;
END;
$$
-ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1
+ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 0
DROP PROCEDURE p1;
#
# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
diff --git a/mysql-test/main/ps_missed_cmds.result b/mysql-test/main/ps_missed_cmds.result
index 966c4c6313b..bde750434b3 100644
--- a/mysql-test/main/ps_missed_cmds.result
+++ b/mysql-test/main/ps_missed_cmds.result
@@ -521,27 +521,4 @@ EXECUTE stmt_2;
DROP TABLE t1;
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
-# Test Test case 25: Check the statements 'CREATE/ALTER/DROP TABLEPSPACE'
-# can be executed as a prepared statement
-PREPARE stmt_1 FROM "CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB";
-PREPARE stmt_2 FROM "ALTER TABLESPACE ts1 ADD DATAFILE 'ts1_1.ibd' ENGINE=InnoDB";
-PREPARE stmt_3 FROM "DROP TABLESPACE ts1 ENGINE=InnoDB";
-EXECUTE stmt_1;
-# Execute the same prepared statement the second time to check that
-# no internal structures used for handling the 'CREATE TABLESPACE'
-# statement were damaged.
-EXECUTE stmt_1;
-EXECUTE stmt_2;
-# Execute the same prepared statement the second time to check that
-# no internal structures used for handling the 'ALTER TABLESPACE'
-# statement were damaged.
-EXECUTE stmt_2;
-EXECUTE stmt_3;
-# Execute the same prepared statement the second time to check that
-# no internal structures used for handling the 'DROP TABLESPACE'
-# statement were damaged.
-EXECUTE stmt_3;
-DEALLOCATE PREPARE stmt_1;
-DEALLOCATE PREPARE stmt_2;
-DEALLOCATE PREPARE stmt_3;
SET default_storage_engine= @save_storage_engine;
diff --git a/mysql-test/main/ps_missed_cmds.test b/mysql-test/main/ps_missed_cmds.test
index 8b80a7c7e5d..e8b4e263008 100644
--- a/mysql-test/main/ps_missed_cmds.test
+++ b/mysql-test/main/ps_missed_cmds.test
@@ -590,50 +590,5 @@ DROP TABLE t1;
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
---echo # Test Test case 25: Check the statements 'CREATE/ALTER/DROP TABLEPSPACE'
---echo # can be executed as a prepared statement
-
-PREPARE stmt_1 FROM "CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB";
-PREPARE stmt_2 FROM "ALTER TABLESPACE ts1 ADD DATAFILE 'ts1_1.ibd' ENGINE=InnoDB";
-PREPARE stmt_3 FROM "DROP TABLESPACE ts1 ENGINE=InnoDB";
-
-# Since MariaDB supports for tablespaces only on syntax level disable warnings
-# before run CREATE/ALTER/DROP TABLESPACE statements in order to exclude
-# the following in result output
-# Warning 1478 Table storage engine 'InnoDB' does not support the create option 'TABLESPACE
---disable_warnings
-
-EXECUTE stmt_1;
---echo # Execute the same prepared statement the second time to check that
---echo # no internal structures used for handling the 'CREATE TABLESPACE'
---echo # statement were damaged.
-# Since the 'CREATE TABLESPACE' statement is supported by MariaDB on syntax
-# level only the second invocation of the CREATE TABLESPACE statement for
-# the same tablespace name doesn't lead to error.
-EXECUTE stmt_1;
-
-EXECUTE stmt_2;
---echo # Execute the same prepared statement the second time to check that
---echo # no internal structures used for handling the 'ALTER TABLESPACE'
---echo # statement were damaged.
-EXECUTE stmt_2;
-
-EXECUTE stmt_3;
---echo # Execute the same prepared statement the second time to check that
---echo # no internal structures used for handling the 'DROP TABLESPACE'
---echo # statement were damaged.
-
-# Since the 'DROP TABLESPACE' statement is supported by MariaDB on syntax
-# level only the second invocation of the DROP TABLESPACE statement for
-# the same tablespace name doesn't lead to an error that tablespace
-# doesn't exist.
-EXECUTE stmt_3;
-
---enable_warnings
-
-DEALLOCATE PREPARE stmt_1;
-DEALLOCATE PREPARE stmt_2;
-DEALLOCATE PREPARE stmt_3;
-
--enable_ps_protocol
SET default_storage_engine= @save_storage_engine;
diff --git a/mysql-test/main/ps_missed_cmds_bin_prot.result b/mysql-test/main/ps_missed_cmds_bin_prot.result
index 0d75d2b84fc..adb6eda2c56 100644
--- a/mysql-test/main/ps_missed_cmds_bin_prot.result
+++ b/mysql-test/main/ps_missed_cmds_bin_prot.result
@@ -219,9 +219,4 @@ SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT='Hello, world!';
ERROR 45000: Hello, world!
RESIGNAL SET MESSAGE_TEXT = 'New error message';
ERROR 0K000: RESIGNAL when handler not active
-# Test Test case 29: Check the statements 'CREATE/ALTER/DROP TABLEPSPACE'
-# can be executed as a prepared statement
-CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB;
-ALTER TABLESPACE ts1 ADD DATAFILE 'ts1_1.ibd' ENGINE=InnoDB;
-DROP TABLESPACE ts1 ENGINE=InnoDB;
SET default_storage_engine= @save_storage_engine;
diff --git a/mysql-test/main/ps_missed_cmds_bin_prot.test b/mysql-test/main/ps_missed_cmds_bin_prot.test
index 47f9e5b8e0f..44db5192629 100644
--- a/mysql-test/main/ps_missed_cmds_bin_prot.test
+++ b/mysql-test/main/ps_missed_cmds_bin_prot.test
@@ -254,19 +254,6 @@ SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT='Hello, world!';
--error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER
RESIGNAL SET MESSAGE_TEXT = 'New error message';
---echo # Test Test case 29: Check the statements 'CREATE/ALTER/DROP TABLEPSPACE'
---echo # can be executed as a prepared statement
-
-# Since MariaDB supports for tablespaces only on syntax level disable warnings
-# before run CREATE/ALTER/DROP TABLESPACE statements in order to exclude
-# the following in result output
-# Warning 1478 Table storage engine 'InnoDB' does not support the create option 'TABLESPACE
---disable_warnings
-
-CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB;
-ALTER TABLESPACE ts1 ADD DATAFILE 'ts1_1.ibd' ENGINE=InnoDB;
-DROP TABLESPACE ts1 ENGINE=InnoDB;
-
--enable_warnings
SET default_storage_engine= @save_storage_engine;
diff --git a/mysql-test/main/signal_code.result b/mysql-test/main/signal_code.result
index 32192251fe9..2ea3a7e56b2 100644
--- a/mysql-test/main/signal_code.result
+++ b/mysql-test/main/signal_code.result
@@ -20,16 +20,16 @@ return 0;
end $$
show procedure code signal_proc;
Pos Instruction
-0 stmt 130 "SIGNAL foo"
-1 stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2 stmt 131 "RESIGNAL foo"
-3 stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0 stmt 129 "SIGNAL foo"
+1 stmt 129 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2 stmt 130 "RESIGNAL foo"
+3 stmt 130 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
drop procedure signal_proc;
show function code signal_func;
Pos Instruction
-0 stmt 130 "SIGNAL foo"
-1 stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2 stmt 131 "RESIGNAL foo"
-3 stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0 stmt 129 "SIGNAL foo"
+1 stmt 129 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2 stmt 130 "RESIGNAL foo"
+3 stmt 130 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
4 freturn int 0
drop function signal_func;
diff --git a/mysql-test/main/signal_sqlmode.result b/mysql-test/main/signal_sqlmode.result
index db7ac68041c..cb9bd4a8bba 100644
--- a/mysql-test/main/signal_sqlmode.result
+++ b/mysql-test/main/signal_sqlmode.result
@@ -32,7 +32,7 @@ call p;
length(utf8_var) utf8_var
128 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Warnings:
-Warning 1265 Data truncated for column 'utf8_var' at row 1
+Warning 1265 Data truncated for column 'utf8_var' at row 0
call p2;
length(msg) msg
129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
@@ -71,7 +71,7 @@ table_name = name;
end
$$
call p;
-ERROR 22001: Data too long for column 'utf8_var' at row 1
+ERROR 22001: Data too long for column 'utf8_var' at row 0
call p2;
length(msg) msg
513 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
diff --git a/mysql-test/main/sp-anchor-row-type-table.result b/mysql-test/main/sp-anchor-row-type-table.result
index c28d26304db..00fda5f12ad 100644
--- a/mysql-test/main/sp-anchor-row-type-table.result
+++ b/mysql-test/main/sp-anchor-row-type-table.result
@@ -707,7 +707,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` text DEFAULT NULL,
- `c` char(1) DEFAULT NULL
+ `c` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP PROCEDURE p2;
DROP PROCEDURE p1;
diff --git a/mysql-test/main/sp-anchor-type.result b/mysql-test/main/sp-anchor-type.result
index 73699d7ed03..94e5182acb2 100644
--- a/mysql-test/main/sp-anchor-type.result
+++ b/mysql-test/main/sp-anchor-type.result
@@ -62,7 +62,7 @@ CALL p1();
a b
127 200
Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 0
DROP PROCEDURE p1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
@@ -469,8 +469,8 @@ t2 CREATE TABLE `t2` (
`t2` text DEFAULT NULL,
`t3` mediumtext DEFAULT NULL,
`t4` longtext DEFAULT NULL,
- `enum1` char(1) DEFAULT NULL,
- `set1` char(5) DEFAULT NULL,
+ `enum1` varchar(1) DEFAULT NULL,
+ `set1` varchar(5) DEFAULT NULL,
`blob1` tinyblob DEFAULT NULL,
`blob2` blob DEFAULT NULL,
`blob3` mediumblob DEFAULT NULL,
@@ -631,8 +631,8 @@ t2 CREATE TABLE `t2` (
`t2` text DEFAULT NULL,
`t3` mediumtext DEFAULT NULL,
`t4` longtext DEFAULT NULL,
- `enum1` char(1) DEFAULT NULL,
- `set1` char(5) DEFAULT NULL,
+ `enum1` varchar(1) DEFAULT NULL,
+ `set1` varchar(5) DEFAULT NULL,
`blob1` tinyblob DEFAULT NULL,
`blob2` blob DEFAULT NULL,
`blob3` mediumblob DEFAULT NULL,
@@ -1044,7 +1044,7 @@ t1 CREATE TABLE `t1` (
`a_flt0` float DEFAULT NULL,
`a_dbl0` double DEFAULT NULL,
`a_bit3` bit(3) DEFAULT NULL,
- `a_enum0` char(1) DEFAULT NULL,
+ `a_enum0` varchar(1) DEFAULT NULL,
`a_varchar10` varchar(10) DEFAULT NULL,
`a_text1` text DEFAULT NULL,
`a_tinytext1` tinytext DEFAULT NULL,
@@ -1062,7 +1062,7 @@ t1 CREATE TABLE `t1` (
`aa_flt0` float DEFAULT NULL,
`aa_dbl0` double DEFAULT NULL,
`aa_bit3` bit(3) DEFAULT NULL,
- `aa_enum0` char(1) DEFAULT NULL,
+ `aa_enum0` varchar(1) DEFAULT NULL,
`aa_varchar10` varchar(10) DEFAULT NULL,
`aa_text1` text DEFAULT NULL,
`aa_tinytext1` tinytext DEFAULT NULL,
diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result
index 230bf8c66ef..aa23d808352 100644
--- a/mysql-test/main/sp-cursor.result
+++ b/mysql-test/main/sp-cursor.result
@@ -167,12 +167,12 @@ CALL p1('1b');
v_a
1
Warnings:
-Warning 1265 Data truncated for column 'p_a' at row 1
+Warning 1265 Data truncated for column 'p_a' at row 0
CALL p1('b1');
v_a
0
Warnings:
-Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1
+Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 0
DROP PROCEDURE p1;
SET sql_mode=DEFAULT;
#
diff --git a/mysql-test/main/sp-error.result b/mysql-test/main/sp-error.result
index 3832d63c073..c77f58b6a66 100644
--- a/mysql-test/main/sp-error.result
+++ b/mysql-test/main/sp-error.result
@@ -2780,7 +2780,7 @@ END|
CALL p1()|
Warnings:
-Warning 1366 Incorrect integer value: 'string' for column ``.``.`var1` at row 1
+Warning 1366 Incorrect integer value: 'string' for column ``.``.`var1` at row 0
SET sql_mode = DEFAULT|
CREATE PROCEDURE p2()
diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result
index 36a371d8c04..b66455dfdb9 100644
--- a/mysql-test/main/sp-row.result
+++ b/mysql-test/main/sp-row.result
@@ -20,7 +20,7 @@ RETURN a;
END;
$$
SELECT f1(ROW(10,20));
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(ROW(10,20))`
DROP FUNCTION f1;
#
# ROW as an SP parameter
@@ -236,7 +236,7 @@ SELECT f1(a);
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a`
DROP PROCEDURE p1;
DROP FUNCTION f1;
#
@@ -286,7 +286,7 @@ RETURN rec;
END;
$$
SELECT f1(10);
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(10)`
DROP FUNCTION f1;
#
# Using the entire ROW in SELECT..CREATE
diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test
index 527ff9455bd..c49ea293bfe 100644
--- a/mysql-test/main/sp-row.test
+++ b/mysql-test/main/sp-row.test
@@ -27,7 +27,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1(ROW(10,20));
DROP FUNCTION f1;
@@ -307,7 +307,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
DROP FUNCTION f1;
@@ -393,7 +393,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1(10);
DROP FUNCTION f1;
diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result
index 2ee3f730788..a5616b9e231 100644
--- a/mysql-test/main/sp-vars.result
+++ b/mysql-test/main/sp-vars.result
@@ -110,7 +110,7 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
-Note 1265 Data truncated for column 'v20' at row 1
+Note 1265 Data truncated for column 'v20' at row 0
CALL sp_vars_check_assignment();
i1 i2 i3 i4
127 -128 127 -128
@@ -130,22 +130,22 @@ SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
127
Warnings:
-Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 0
SELECT sp_vars_check_ret2();
sp_vars_check_ret2()
127
Warnings:
-Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 0
SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
Warnings:
-Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
+Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 0
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
Warnings:
-Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
+Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 0
SELECT sp_vars_div_zero();
sp_vars_div_zero()
NULL
@@ -165,7 +165,7 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
-Note 1265 Data truncated for column 'v20' at row 1
+Note 1265 Data truncated for column 'v20' at row 0
CALL sp_vars_check_assignment();
i1 i2 i3 i4
127 -128 127 -128
@@ -185,22 +185,22 @@ SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
127
Warnings:
-Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret1()' at row 0
SELECT sp_vars_check_ret2();
sp_vars_check_ret2()
127
Warnings:
-Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 1
+Warning 1264 Out of range value for column 'sp_vars_check_ret2()' at row 0
SELECT sp_vars_check_ret3();
sp_vars_check_ret3()
0
Warnings:
-Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
+Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 0
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
Warnings:
-Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
+Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 0
SELECT sp_vars_div_zero();
sp_vars_div_zero()
NULL
@@ -306,20 +306,20 @@ Calling the routines, created in TRADITIONAL mode.
---------------------------------------------------------------
CALL sp_vars_check_dflt();
-ERROR 22003: Out of range value for column 'v1' at row 1
+ERROR 22003: Out of range value for column 'v1' at row 0
CALL sp_vars_check_assignment();
-ERROR 22003: Out of range value for column 'i1' at row 1
+ERROR 22003: Out of range value for column 'i1' at row 0
SELECT sp_vars_check_ret1();
-ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1
+ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 0
SELECT sp_vars_check_ret2();
-ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1
+ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 0
SELECT sp_vars_check_ret3();
-ERROR 22007: Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1
+ERROR 22007: Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 0
SELECT sp_vars_check_ret4();
sp_vars_check_ret4()
154.12
Warnings:
-Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
+Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 0
SELECT sp_vars_div_zero();
ERROR 22012: Division by 0
SET @@sql_mode = 'ansi';
@@ -385,7 +385,7 @@ FF
HEX(v10)
FF
Warnings:
-Warning 1264 Out of range value for column 'v5' at row 1
+Warning 1264 Out of range value for column 'v5' at row 0
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -602,7 +602,7 @@ CALL p1('alpha', 'abcdef');
x y
alpha abc
Warnings:
-Warning 1265 Data truncated for column 'y' at row 1
+Warning 1265 Data truncated for column 'y' at row 0
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -628,7 +628,7 @@ t1 CREATE TABLE "t1" (
"x" datetime DEFAULT NULL
)
Warnings:
-Warning 1265 Data truncated for column 'x' at row 1
+Warning 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -777,17 +777,17 @@ SET var := arg;
SELECT arg, var;
END|
CALL p1();
-ERROR 22003: Out of range value for column 'v' at row 1
+ERROR 22003: Out of range value for column 'v' at row 0
CALL p2();
-ERROR 22003: Out of range value for column 'v' at row 1
+ERROR 22003: Out of range value for column 'v' at row 0
CALL p3();
-ERROR 22001: Data too long for column 'v' at row 1
+ERROR 22001: Data too long for column 'v' at row 0
CALL p4('aaa');
-ERROR 22001: Data too long for column 'arg' at row 1
+ERROR 22001: Data too long for column 'arg' at row 0
CALL p5('aa');
-ERROR 22001: Data too long for column 'var' at row 1
+ERROR 22001: Data too long for column 'var' at row 0
CALL p6(10);
-ERROR 22003: Out of range value for column 'var' at row 1
+ERROR 22003: Out of range value for column 'var' at row 0
SET @@sql_mode = 'ansi';
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -817,7 +817,7 @@ CALL p1(1929.003);
var
1929.00
Warnings:
-Note 1265 Data truncated for column 'arg' at row 1
+Note 1265 Data truncated for column 'arg' at row 0
DROP PROCEDURE p1;
---------------------------------------------------------------
@@ -950,17 +950,17 @@ CALL p1('c');
arg
Warnings:
-Warning 1265 Data truncated for column 'arg' at row 1
+Warning 1265 Data truncated for column 'arg' at row 0
CALL p2('a');
arg var
a
Warnings:
-Warning 1265 Data truncated for column 'var' at row 1
+Warning 1265 Data truncated for column 'var' at row 0
SELECT f1('a');
f1('a')
Warnings:
-Warning 1265 Data truncated for column 'f1('a')' at row 1
+Warning 1265 Data truncated for column 'f1('a')' at row 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP FUNCTION f1;
@@ -1026,11 +1026,11 @@ BEGIN
SELECT arg;
END|
CALL p1((1, 2));
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
CALL p1((SELECT * FROM t1 LIMIT 1));
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
CALL p1((SELECT col1, col2 FROM t1 LIMIT 1));
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
DROP PROCEDURE p1;
DROP TABLE t1;
@@ -1307,7 +1307,7 @@ $$
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "var" char(1) DEFAULT NULL
+ "var" varchar(1) DEFAULT NULL
)
DROP TABLE t1;
#
diff --git a/mysql-test/main/sp-vars.test b/mysql-test/main/sp-vars.test
index 9edf245acbe..5e1e07888ca 100644
--- a/mysql-test/main/sp-vars.test
+++ b/mysql-test/main/sp-vars.test
@@ -1221,13 +1221,13 @@ BEGIN
END|
delimiter ;|
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1((1, 2));
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1((SELECT * FROM t1 LIMIT 1));
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1((SELECT col1, col2 FROM t1 LIMIT 1));
#
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 88df800b0e0..37c22e45b45 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -255,7 +255,7 @@ return i+1|
call sub1("sub1a", (select 7))|
call sub1("sub1b", (select max(i) from t2))|
call sub1("sub1c", (select i,d from t2 limit 1))|
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `x`
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
select * from t1 order by id|
@@ -3073,14 +3073,14 @@ select bug9775('a'),bug9775('b'),bug9775('c')|
bug9775('a') bug9775('b') bug9775('c')
a b
Warnings:
-Warning 1265 Data truncated for column 'bug9775('c')' at row 1
+Warning 1265 Data truncated for column 'bug9775('c')' at row 0
drop function bug9775|
create function bug9775(v1 int) returns enum('a','b') return v1|
select bug9775(1),bug9775(2),bug9775(3)|
bug9775(1) bug9775(2) bug9775(3)
a b
Warnings:
-Warning 1265 Data truncated for column 'bug9775(3)' at row 1
+Warning 1265 Data truncated for column 'bug9775(3)' at row 0
drop function bug9775|
create function bug9775(v1 char(1)) returns set('a','b') return v1|
select bug9775('a'),bug9775('b'),bug9775('a,b'),bug9775('c')|
@@ -3088,14 +3088,14 @@ bug9775('a') bug9775('b') bug9775('a,b') bug9775('c')
a b a
Warnings:
Warning 1265 Data truncated for column 'v1' at row 1
-Warning 1265 Data truncated for column 'bug9775('c')' at row 1
+Warning 1265 Data truncated for column 'bug9775('c')' at row 0
drop function bug9775|
create function bug9775(v1 int) returns set('a','b') return v1|
select bug9775(1),bug9775(2),bug9775(3),bug9775(4)|
bug9775(1) bug9775(2) bug9775(3) bug9775(4)
a b a,b
Warnings:
-Warning 1265 Data truncated for column 'bug9775(4)' at row 1
+Warning 1265 Data truncated for column 'bug9775(4)' at row 0
drop function bug9775|
drop function if exists bug8861|
create function bug8861(v1 int) returns year return v1|
@@ -3118,10 +3118,10 @@ create procedure bug9004_2(x char(16))
call bug9004_1(x)|
call bug9004_1('12345678901234567')|
Warnings:
-Warning 1265 Data truncated for column 'x' at row 1
+Warning 1265 Data truncated for column 'x' at row 0
call bug9004_2('12345678901234567890')|
Warnings:
-Warning 1265 Data truncated for column 'x' at row 1
+Warning 1265 Data truncated for column 'x' at row 0
delete from t1|
drop procedure bug9004_1|
drop procedure bug9004_2|
@@ -4591,7 +4591,7 @@ call bug15231_3()|
Result
Missed it (correct)
Level Code Message
-Warning 1366 Incorrect decimal value: 'zap' for column ``.``.`x` at row 1
+Warning 1366 Incorrect decimal value: 'zap' for column ``.``.`x` at row 0
Result
Caught it (correct)
call bug15231_5()|
@@ -6438,7 +6438,7 @@ DROP TABLE t1;
CALL p1('text');
Warnings:
-Warning 1265 Data truncated for column 'v' at row 1
+Warning 1265 Data truncated for column 'v' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -6458,7 +6458,7 @@ DROP TABLE t1;
CALL p2('text');
Warnings:
-Warning 1366 Incorrect integer value: 'text' for column ``.``.`v` at row 1
+Warning 1366 Incorrect integer value: 'text' for column ``.``.`v` at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -7070,10 +7070,10 @@ CALL p1(4, 'a');
1
1
Warnings:
-Warning 1265 Data truncated for column 'b' at row 1
-Warning 1265 Data truncated for column 'b' at row 1
-Warning 1265 Data truncated for column 'b' at row 1
-Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b' at row 0
+Warning 1265 Data truncated for column 'b' at row 0
+Warning 1265 Data truncated for column 'b' at row 0
+Warning 1265 Data truncated for column 'b' at row 0
SET @@max_sp_recursion_depth= @save_max_sp_recursion;
DROP PROCEDURE p1;
DROP PROCEDURE IF EXISTS p1;
@@ -7091,7 +7091,7 @@ CAST('10 ' as UNSIGNED INTEGER)
1
1
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 0
Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE IF EXISTS p1;
@@ -7144,7 +7144,7 @@ SELECT f1();
f1()
a
Warnings:
-Warning 1265 Data truncated for column 'f4()' at row 1
+Warning 1265 Data truncated for column 'f4()' at row 0
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
@@ -8972,3 +8972,15 @@ select @counter;
5
drop function f1;
drop table t1,t2;
+#
+# MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)
+#
+CREATE PROCEDURE sp() SELECT 1 INTO @;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+CREATE PROCEDURE sp() SET @=1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=1' at line 1
+CREATE PROCEDURE sp() SELECT @;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index baf89eeaba5..2e3a492659e 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -387,7 +387,7 @@ create function sub3(i int) returns int deterministic
call sub1("sub1a", (select 7))|
call sub1("sub1b", (select max(i) from t2))|
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
call sub1("sub1c", (select i,d from t2 limit 1))|
call sub1("sub1d", (select 1 from (select 1) a))|
call sub2("sub2")|
@@ -10556,3 +10556,20 @@ select f1(col1) from t2 order by col2 desc limit 5;
select @counter;
drop function f1;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)
+--echo #
+
+--error ER_PARSE_ERROR
+CREATE PROCEDURE sp() SELECT 1 INTO @;
+
+--error ER_PARSE_ERROR
+CREATE PROCEDURE sp() SET @=1;
+
+--error ER_PARSE_ERROR
+CREATE PROCEDURE sp() SELECT @;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result
index 55ca537f992..410c5a53ce2 100644
--- a/mysql-test/main/trigger.result
+++ b/mysql-test/main/trigger.result
@@ -2308,18 +2308,20 @@ DROP TABLE t1, t2;
set time_zone="+00:00";
SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
+set @rpt=1;
CREATE TABLE t1 (c CHAR(1) NOT NULL);
CREATE TRIGGER t1_bi
BEFORE INSERT
ON t1
FOR EACH ROW
BEGIN
-SET NEW.c = 'www';
+SET NEW.c = repeat(@rpt,@rpt);
+set @rpt=@rpt+1;
END;
|
SET @@session.sql_mode = default;
-INSERT INTO t1 VALUES ('a');
-ERROR 22001: Data too long for column 'c' at row 1
+INSERT INTO t1 VALUES ('a'),('b');
+ERROR 22001: Data too long for column 'c' at row 0
show create trigger t1_bi;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
t1_bi STRICT_TRANS_TABLES,STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi
@@ -2327,7 +2329,8 @@ BEFORE INSERT
ON t1
FOR EACH ROW
BEGIN
-SET NEW.c = 'www';
+SET NEW.c = repeat(@rpt,@rpt);
+set @rpt=@rpt+1;
END latin1 latin1_swedish_ci latin1_swedish_ci 2001-01-01 10:20:30.00
DROP TRIGGER t1_bi;
DROP TABLE t1;
diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test
index 4e51c0ae434..466e9b8f3e5 100644
--- a/mysql-test/main/trigger.test
+++ b/mysql-test/main/trigger.test
@@ -2630,6 +2630,7 @@ DROP TABLE t1, t2;
set time_zone="+00:00";
SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
+set @rpt=1;
CREATE TABLE t1 (c CHAR(1) NOT NULL);
DELIMITER |;
CREATE TRIGGER t1_bi
@@ -2637,13 +2638,14 @@ CREATE TRIGGER t1_bi
ON t1
FOR EACH ROW
BEGIN
- SET NEW.c = 'www';
+ SET NEW.c = repeat(@rpt,@rpt);
+ set @rpt=@rpt+1;
END;
|
DELIMITER ;|
SET @@session.sql_mode = default;
--error ER_DATA_TOO_LONG
-INSERT INTO t1 VALUES ('a');
+INSERT INTO t1 VALUES ('a'),('b'); # this is a BUG, must be "at row 2"
show create trigger t1_bi;
DROP TRIGGER t1_bi;
DROP TABLE t1;
diff --git a/mysql-test/main/truncate_notembedded.result b/mysql-test/main/truncate_notembedded.result
index 67beb79707c..e8bf6c2575b 100644
--- a/mysql-test/main/truncate_notembedded.result
+++ b/mysql-test/main/truncate_notembedded.result
@@ -5,7 +5,7 @@
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
LOCK TABLE t1 READ;
connect con1,localhost,root,,test;
-SET SESSION max_session_mem_used= 45500;
+SET SESSION max_session_mem_used= 8192;
LOCK TABLE t1 WRITE;
connection default;
SELECT * FROM t1;
@@ -13,6 +13,7 @@ a
UNLOCK TABLES;
connection con1;
TRUNCATE TABLE t1;
+ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
disconnect con1;
connection default;
DROP TABLE t1;
diff --git a/mysql-test/main/truncate_notembedded.test b/mysql-test/main/truncate_notembedded.test
index bf5606aa51b..764a353ad34 100644
--- a/mysql-test/main/truncate_notembedded.test
+++ b/mysql-test/main/truncate_notembedded.test
@@ -10,7 +10,7 @@ CREATE TABLE t1 (a INT) ENGINE=MyISAM;
LOCK TABLE t1 READ;
--connect (con1,localhost,root,,test)
-SET SESSION max_session_mem_used= 45500;
+SET SESSION max_session_mem_used= 8192;
--send
LOCK TABLE t1 WRITE;
@@ -21,10 +21,7 @@ UNLOCK TABLES;
--connection con1
--error 0,ER_OPTION_PREVENTS_STATEMENT
--reap
-# This may work or fail as different servers uses different amount of
-# memory and the statement may work or not. What is important is that we
-# don't get a crash here!
---error 0,ER_OPTION_PREVENTS_STATEMENT
+--error ER_OPTION_PREVENTS_STATEMENT
TRUNCATE TABLE t1;
--disconnect con1
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index abd777f3520..0a9da9eb8aa 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -391,7 +391,7 @@ call test5041();
d
2013-09-21
Warnings:
-Note 1265 Data truncated for column 'd' at row 1
+Note 1265 Data truncated for column 'd' at row 0
drop procedure test5041;
SET @@timestamp=DEFAULT;
#
diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result
index 2293050292a..3e864d0ffa9 100644
--- a/mysql-test/main/type_datetime.result
+++ b/mysql-test/main/type_datetime.result
@@ -199,7 +199,7 @@ CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6))
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
Warnings:
-Note 1265 Data truncated for column 'da' at row 1
+Note 1265 Data truncated for column 'da' at row 0
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -595,7 +595,7 @@ End of 5.0 tests
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
Warnings:
-Note 1265 Data truncated for column 'da' at row 1
+Note 1265 Data truncated for column 'da' at row 0
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result
index 29067f8f5a5..3643dbea272 100644
--- a/mysql-test/main/type_decimal.result
+++ b/mysql-test/main/type_decimal.result
@@ -1091,7 +1091,7 @@ a
Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
Warning 1292 Truncated incorrect DECIMAL value: '.00000000000000000000000000000000000001e111111111111111111111'
-Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 0
CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
INSERT INTO t1 VALUES
('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'),
@@ -1152,13 +1152,13 @@ CAST(str AS DECIMAL(38,0))
Level Code Message
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111'
-Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 1
+Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 2
CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
99999999999999999999999999999999999999
Level Code Message
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111garbage'
-Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 1
+Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 2
DROP TABLE t1;
#
# End of 10.2 tests
diff --git a/mysql-test/main/type_decimal.test b/mysql-test/main/type_decimal.test
index 1076592fe62..9e294410a38 100644
--- a/mysql-test/main/type_decimal.test
+++ b/mysql-test/main/type_decimal.test
@@ -675,7 +675,10 @@ DROP TABLE t1dec102;
SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a;
SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a;
+#enable after fix MDEV-29647
+--disable_view_protocol
SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a;
+--disable_view_protocol
CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
INSERT INTO t1 VALUES
diff --git a/mysql-test/main/type_enum.result b/mysql-test/main/type_enum.result
index f9300b81b39..9e313f5b302 100644
--- a/mysql-test/main/type_enum.result
+++ b/mysql-test/main/type_enum.result
@@ -2353,3 +2353,34 @@ a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a)
999999999999999999999999999999999999999999999999999999999999 1 1 1 1
DROP TABLE t2;
DROP TABLE t1;
+#
+# MDEV-29062 Wrong result set metadata for a mix of INT+ENUM
+#
+CREATE TABLE t1
+(
+c_int INT,
+c_enum ENUM('1')
+);
+CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_enum FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c_int` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_enum) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(c_int, c_enum)` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+SELECT c_int FROM t1 UNION SELECT c_enum FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def c_int c_int 253 11 0 Y 0 0 8
+c_int
+SELECT COALESCE(c_int, c_enum) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(c_int, c_enum) 253 11 0 Y 0 39 8
+COALESCE(c_int, c_enum)
+DROP TABLE t1;
diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test
index bcbc4cc520e..30a10407f89 100644
--- a/mysql-test/main/type_enum.test
+++ b/mysql-test/main/type_enum.test
@@ -555,3 +555,33 @@ SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-29062 Wrong result set metadata for a mix of INT+ENUM
+--echo #
+
+CREATE TABLE t1
+(
+ c_int INT,
+ c_enum ENUM('1')
+);
+
+CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_enum FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_enum) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+--disable_view_protocol
+--disable_ps_protocol
+--enable_metadata
+SELECT c_int FROM t1 UNION SELECT c_enum FROM t1;
+SELECT COALESCE(c_int, c_enum) FROM t1;
+--disable_metadata
+--enable_ps_protocol
+--enable_view_protocol
+
+DROP TABLE t1;
diff --git a/mysql-test/main/type_geometry_mix_int.result b/mysql-test/main/type_geometry_mix_int.result
new file mode 100644
index 00000000000..773eaabc65a
--- /dev/null
+++ b/mysql-test/main/type_geometry_mix_int.result
@@ -0,0 +1,351 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` geometry DEFAULT point(1,1),
+ `source` int(11) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT * FROM v3;
+id target source
+1 POINT(1 1) 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT * FROM v3;
+id target source
+1 POINT(1 1) 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target int(11)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE dst geometry DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a geometry) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a geometry) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst geometry)
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst geometry DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'int' as 'geometry' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS geometry
+BEGIN
+DECLARE rc int(11) DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE cur1 CURSOR(t geometry) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst geometry DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1));
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` int(11) DEFAULT 0,
+ `source` geometry DEFAULT point(1,1),
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect integer value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 POINT(1 1)
+2 0 POINT(1 1)
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect integer value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 POINT(1 1)
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target geometry
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src geometry DEFAULT NULL;
+DECLARE dst int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a int(11)) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst int(11))
+BEGIN
+DECLARE src geometry DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'geometry' as 'int' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS int(11)
+BEGIN
+DECLARE rc geometry DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src geometry DEFAULT NULL;
+DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'geometry' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/type_geometry_mix_int.test b/mysql-test/main/type_geometry_mix_int.test
new file mode 100644
index 00000000000..1c64a13e1e8
--- /dev/null
+++ b/mysql-test/main/type_geometry_mix_int.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target GEOMETRY DEFAULT POINT(1,1), source INT DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target INT DEFAULT 0, source GEOMETRY DEFAULT POINT(1,1));
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result
index 645178db2ce..1aa8c28b44a 100644
--- a/mysql-test/main/type_newdecimal.result
+++ b/mysql-test/main/type_newdecimal.result
@@ -956,14 +956,14 @@ f6 decimal unsigned not null default 199.91,
f7 decimal unsigned not null default 999.9,
f8 decimal unsigned not null default 9999.99);
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
-Note 1265 Data truncated for column 'f2' at row 1
-Note 1265 Data truncated for column 'f3' at row 1
-Note 1265 Data truncated for column 'f4' at row 1
-Note 1265 Data truncated for column 'f5' at row 1
-Note 1265 Data truncated for column 'f6' at row 1
-Note 1265 Data truncated for column 'f7' at row 1
-Note 1265 Data truncated for column 'f8' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
+Note 1265 Data truncated for column 'f2' at row 0
+Note 1265 Data truncated for column 'f3' at row 0
+Note 1265 Data truncated for column 'f4' at row 0
+Note 1265 Data truncated for column 'f5' at row 0
+Note 1265 Data truncated for column 'f6' at row 0
+Note 1265 Data truncated for column 'f7' at row 0
+Note 1265 Data truncated for column 'f8' at row 0
insert into t1 (f1) values (1);
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8
@@ -1458,8 +1458,8 @@ cast(a as DECIMAL(3,2))
9.99
Warnings:
Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
-Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
-Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
+Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 2
+Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 3
select cast(a as DECIMAL(3,2)), count(*)
from (select 11.1233 as a
UNION select 11.1234
@@ -1470,8 +1470,8 @@ cast(a as DECIMAL(3,2)) count(*)
Warnings:
Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
-Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
-Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
+Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 2
+Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 3
create table t1 (s varchar(100));
insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
drop table t1;
@@ -2292,7 +2292,7 @@ a
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '1e-10000');
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2301,7 +2301,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.1 ');
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2310,7 +2310,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001 ');
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2319,7 +2319,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001');
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2328,7 +2328,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001);
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2337,7 +2337,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0);
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/main/type_row.result b/mysql-test/main/type_row.result
index dc74cfc88a4..45f4fd895bf 100644
--- a/mysql-test/main/type_row.result
+++ b/mysql-test/main/type_row.result
@@ -49,3 +49,26 @@ ERROR HY000: Illegal parameter data types row and int for operation 'MOD'
#
# End of 10.5 tests
#
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT
+#
+SET sql_mode='';
+CREATE TABLE t1 (c1 INT,c2 INT);
+CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=(SELECT * FROM t1);
+INSERT INTO t1 VALUES (0,0);
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1`
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+SET sql_mode='';
+CREATE TABLE t1 (c1 INT,c2 INT) ENGINE=MyISAM;
+CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=ROW(1,1);
+INSERT INTO t1 VALUES (0,0);
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1`
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/type_row.test b/mysql-test/main/type_row.test
index 2a5902351e2..6f8312d5f18 100644
--- a/mysql-test/main/type_row.test
+++ b/mysql-test/main/type_row.test
@@ -60,3 +60,31 @@ SELECT ROW(1,1) % 1;
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1 (c1 INT,c2 INT);
+CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=(SELECT * FROM t1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (0,0);
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+SET sql_mode='';
+CREATE TABLE t1 (c1 INT,c2 INT) ENGINE=MyISAM;
+CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=ROW(1,1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (0,0);
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/mysql-test/main/type_set.result b/mysql-test/main/type_set.result
index ea057157569..571e0d36eaf 100644
--- a/mysql-test/main/type_set.result
+++ b/mysql-test/main/type_set.result
@@ -379,3 +379,34 @@ a FLOOR(a) CEILING(a) TRUNCATE(a,0) ROUND(a)
999999999999999999999999999999999999999999999999999999999999 1 1 1 1
DROP TABLE t2;
DROP TABLE t1;
+#
+# MDEV-29062 Wrong result set metadata for a mix of INT+ENUM
+#
+CREATE TABLE t1
+(
+c_int INT,
+c_set SET('1')
+);
+CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_set FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c_int` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_set) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(c_int, c_set)` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+SELECT c_int FROM t1 UNION SELECT c_set FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def c_int c_int 253 33 0 Y 0 0 33
+c_int
+SELECT COALESCE(c_int, c_set) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(c_int, c_set) 253 33 0 Y 0 39 33
+COALESCE(c_int, c_set)
+DROP TABLE t1;
diff --git a/mysql-test/main/type_set.test b/mysql-test/main/type_set.test
index 2d0c81340ae..0ef2d158c4d 100644
--- a/mysql-test/main/type_set.test
+++ b/mysql-test/main/type_set.test
@@ -261,3 +261,33 @@ SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-29062 Wrong result set metadata for a mix of INT+ENUM
+--echo #
+
+CREATE TABLE t1
+(
+ c_int INT,
+ c_set SET('1')
+);
+
+CREATE TABLE t2 AS SELECT c_int FROM t1 UNION SELECT c_set FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(c_int, c_set) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+--disable_view_protocol
+--disable_ps_protocol
+--enable_metadata
+SELECT c_int FROM t1 UNION SELECT c_set FROM t1;
+SELECT COALESCE(c_int, c_set) FROM t1;
+--disable_metadata
+--enable_ps_protocol
+--enable_view_protocol
+
+DROP TABLE t1;
diff --git a/mysql-test/main/type_time_hires.result b/mysql-test/main/type_time_hires.result
index cf7dce59f1f..ed00a8d473d 100644
--- a/mysql-test/main/type_time_hires.result
+++ b/mysql-test/main/type_time_hires.result
@@ -271,8 +271,8 @@ create table t1 (a time(6), b time(6));
create procedure foo(x time, y time(4)) insert into t1 values (x, y);
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
-Note 1265 Data truncated for column 'y' at row 1
+Note 1265 Data truncated for column 'x' at row 0
+Note 1265 Data truncated for column 'y' at row 0
select * from t1;
a b
04:05:06.000000 04:05:06.789100
@@ -284,7 +284,7 @@ insert t1 values (b, c + interval a microsecond);
end|
call bar(1111111, '2011-01-02 3:4:5.123456');
Warnings:
-Note 1265 Data truncated for column 'c' at row 1
+Note 1265 Data truncated for column 'c' at row 0
select * from t1;
a b
04:05:06.000000 04:05:06.789100
@@ -297,7 +297,7 @@ select xyz('1:1:1.010101');
xyz('1:1:1.010101')
11:11:11.1111
Warnings:
-Note 1265 Data truncated for column 'xyz('1:1:1.010101')' at row 1
+Note 1265 Data truncated for column 'xyz('1:1:1.010101')' at row 0
drop function xyz;
create view v1 as select * from t1 group by a,b;
select * from v1;
diff --git a/mysql-test/main/type_varchar.result b/mysql-test/main/type_varchar.result
index d00531018a4..ea31dddabda 100644
--- a/mysql-test/main/type_varchar.result
+++ b/mysql-test/main/type_varchar.result
@@ -709,14 +709,14 @@ CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
-Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c' at row 0
Error 1067 Invalid default value for 'c'
SET sql_mode='STRICT_ALL_TABLES';
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
-Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c' at row 0
Error 1067 Invalid default value for 'c'
CREATE TABLE t1 (c VARCHAR(1));
SET sql_mode='';
@@ -724,14 +724,14 @@ ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
-Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c' at row 0
Error 1067 Invalid default value for 'c'
SET sql_mode='STRICT_ALL_TABLES';
ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
-Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c' at row 0
Error 1067 Invalid default value for 'c'
DROP TABLE t1;
SET sql_mode=DEFAULT;
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index 72b59f42178..e2d7cc09947 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1913,7 +1913,7 @@ set @save_default_storage_engine=@@default_storage_engine;
SET @@default_storage_engine=MEMORY;
CREATE TABLE t1 SELECT NULL UNION SELECT NULL;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1 ADD INDEX (`PRIMARY`);
CREATE TABLE t2 SELECT NULL;
diff --git a/mysql-test/suite/archive/archive_gis.result b/mysql-test/suite/archive/archive_gis.result
index b629f09f5f2..a137888662f 100644
--- a/mysql-test/suite/archive/archive_gis.result
+++ b/mysql-test/suite/archive/archive_gis.result
@@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
create table t1 (pk integer primary key auto_increment, fl geometry not null);
insert into t1 (fl) values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
diff --git a/mysql-test/suite/atomic/alter_partition,innodb.rdiff b/mysql-test/suite/atomic/alter_partition,innodb.rdiff
new file mode 100644
index 00000000000..571136eb626
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_partition,innodb.rdiff
@@ -0,0 +1,525 @@
+--- alter_partition.result
++++ alter_partition,innodb.reject
+@@ -17,12 +17,9 @@
+ end $
+ # QUERY: ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+ # CRASH: crash_create_before_create_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -38,12 +35,9 @@
+ 12
+ 22
+ # CRASH: crash_alter_partition_after_create_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -59,12 +53,9 @@
+ 12
+ 22
+ # CRASH: crash_alter_partition_after_write_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -80,12 +71,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_1
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -101,12 +89,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_2
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -122,12 +107,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_3
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -143,12 +125,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_4
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -164,12 +143,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_5
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -185,12 +161,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_6
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -206,12 +179,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_7
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -227,12 +197,9 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_8
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ Table Create Table
+@@ -248,15 +215,12 @@
+ 12
+ 22
+ # CRASH: crash_convert_partition_9
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp1.MYD
+-tp1.MYI
+ tp1.frm
++tp1.ibd
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+@@ -275,15 +239,12 @@
+ x
+ 12
+ # CRASH: crash_convert_partition_10
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp1.MYD
+-tp1.MYI
+ tp1.frm
++tp1.ibd
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+@@ -302,15 +263,12 @@
+ x
+ 12
+ # CRASH: crash_convert_partition_11
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp1.MYD
+-tp1.MYI
+ tp1.frm
++tp1.ibd
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+@@ -330,14 +288,10 @@
+ 12
+ # QUERY: ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+ # NO CRASH: crash_create_before_create_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+@@ -357,14 +311,10 @@
+ 32
+ 39
+ # NO CRASH: crash_alter_partition_after_create_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+@@ -384,14 +334,10 @@
+ 32
+ 39
+ # NO CRASH: crash_alter_partition_after_write_frm
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+@@ -411,17 +357,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_1
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -442,17 +384,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_2
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -473,17 +411,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_3
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -504,17 +438,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_4
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -535,17 +465,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_5
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -566,17 +492,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_6
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -597,17 +519,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_7
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -628,17 +546,13 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_8
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+-tp2.MYD
+-tp2.MYI
+ tp2.frm
++tp2.ibd
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+@@ -659,14 +573,10 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_9
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+@@ -686,14 +596,10 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_10
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+@@ -713,14 +619,10 @@
+ 32
+ 39
+ # CRASH: crash_convert_partition_11
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1#P#p2.MYD
+-t1#P#p2.MYI
+-t1#P#pn.MYD
+-t1#P#pn.MYI
++t1#P#p0.ibd
++t1#P#p1.ibd
++t1#P#p2.ibd
++t1#P#pn.ibd
+ t1.frm
+ t1.par
+ master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
diff --git a/mysql-test/suite/atomic/alter_partition.combinations b/mysql-test/suite/atomic/alter_partition.combinations
new file mode 100644
index 00000000000..898d2f2f332
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_partition.combinations
@@ -0,0 +1,6 @@
+[innodb]
+innodb
+
+[myisam]
+
+[aria]
diff --git a/mysql-test/suite/atomic/alter_partition.result b/mysql-test/suite/atomic/alter_partition.result
new file mode 100644
index 00000000000..c4af43ad1bd
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_partition.result
@@ -0,0 +1,743 @@
+# Crash recovery
+create or replace procedure prepare_table(r int)
+begin
+create or replace table t1 (x int)
+with system versioning
+partition by range(x) (
+partition p0 values less than (10),
+partition p1 values less than (20),
+partition pn values less than (30));
+insert into t1 values (2), (12), (22);
+if r > 1 then
+create or replace table tp2 (x int)
+with system versioning;
+insert into tp2 values (32), (39);
+end if;
+flush tables;
+end $
+# QUERY: ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+# CRASH: crash_create_before_create_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_alter_partition_after_create_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_alter_partition_after_write_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_1
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_2
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_3
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_4
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_5
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_6
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_7
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_8
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+# CRASH: crash_convert_partition_9
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp1.MYD
+tp1.MYI
+tp1.frm
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+22
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+12
+# CRASH: crash_convert_partition_10
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp1.MYD
+tp1.MYI
+tp1.frm
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+22
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+12
+# CRASH: crash_convert_partition_11
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp1.MYD
+tp1.MYI
+tp1.frm
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+22
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+12
+# QUERY: ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+# NO CRASH: crash_create_before_create_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+# NO CRASH: crash_alter_partition_after_create_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+# NO CRASH: crash_alter_partition_after_write_frm
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+# CRASH: crash_convert_partition_1
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_2
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_3
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_4
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_5
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_6
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_7
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_8
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+x
+32
+39
+# CRASH: crash_convert_partition_9
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+# CRASH: crash_convert_partition_10
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+# CRASH: crash_convert_partition_11
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` VALUES LESS THAN (30) ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` VALUES LESS THAN (40) ENGINE = DEFAULT_ENGINE)
+x
+2
+12
+22
+32
+39
+Warnings:
+Note 1051 Unknown table 'test.t1'
diff --git a/mysql-test/suite/atomic/alter_partition.test b/mysql-test/suite/atomic/alter_partition.test
new file mode 100644
index 00000000000..23b996cf5a1
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_partition.test
@@ -0,0 +1,174 @@
+--source include/have_partition.inc
+--source include/have_debug.inc
+--source include/have_sequence.inc
+--source include/binlog_combinations.inc
+--source include/have_binlog_format_row_or_statement.inc
+--source include/not_valgrind.inc
+
+let $default_engine=InnoDB;
+let $extra_option=;
+let $save_debug=`select @@debug_dbug`;
+
+if ($MTR_COMBINATION_MYISAM)
+{
+ let $default_engine=MyISAM;
+}
+if ($MTR_COMBINATION_ARIA)
+{
+ let $default_engine=Aria;
+ let $extra_option=transactional=1;
+}
+
+if ($MTR_COMBINATION_STMT)
+{
+ let $binlog_format=include/set_binlog_format_statement.sql;
+}
+if ($MTR_COMBINATION_ROW)
+{
+ let $binlog_format=include/set_binlog_format_row.sql;
+}
+
+--disable_query_log
+--eval set @@default_storage_engine=$default_engine
+--enable_query_log
+
+--echo # Crash recovery
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+let $crash_count= 14;
+let $crash_points='crash_create_before_create_frm',
+ 'crash_alter_partition_after_create_frm',
+ 'crash_alter_partition_after_write_frm',
+ 'crash_convert_partition_1',
+ 'crash_convert_partition_2',
+ 'crash_convert_partition_3',
+ 'crash_convert_partition_4',
+ 'crash_convert_partition_5',
+ 'crash_convert_partition_6',
+ 'crash_convert_partition_7',
+ 'crash_convert_partition_8',
+ 'crash_convert_partition_9',
+ 'crash_convert_partition_10',
+ 'crash_convert_partition_11';
+
+#let $crash_count= 1;
+#let $crash_points= 'crash_convert_partition_10';
+
+let $statement_count= 2;
+let $statements= 'ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1',
+ 'ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)';
+
+#let $statement_count= 1;
+#let $statements= 'ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 values less than (40)';
+
+--delimiter $
+create or replace procedure prepare_table(r int)
+begin
+ create or replace table t1 (x int)
+ with system versioning
+ partition by range(x) (
+ partition p0 values less than (10),
+ partition p1 values less than (20),
+ partition pn values less than (30));
+ insert into t1 values (2), (12), (22);
+
+ if r > 1 then
+ create or replace table tp2 (x int)
+ with system versioning;
+ insert into tp2 values (32), (39);
+ end if;
+
+ flush tables;
+end $
+--delimiter ;
+
+let $old_debug=`select @@debug_dbug`;
+
+let $keep_include_silent=1;
+let $grep_script=ALTER;
+--disable_query_log
+
+let $r=0;
+while ($r < $statement_count)
+{
+ inc $r;
+ let $statement=`select ELT($r, $statements)`;
+ --echo # QUERY: $statement
+
+ let $c=0;
+ while ($c < $crash_count)
+ {
+ inc $c;
+ let $crash=`select ELT($c, $crash_points)`;
+
+ --eval set @@default_storage_engine=$default_engine
+ eval call prepare_table($r);
+ if (!$c)
+ {
+ lock tables t1 write;
+ }
+
+ --source $binlog_format
+
+ RESET MASTER;
+ --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+ --disable_reconnect
+ --eval set @@debug_dbug="+d,$crash"
+ let $errno=0;
+ --error 0,2013
+ --eval $statement;
+ let $error=$errno;
+ --enable_reconnect
+ --source include/wait_until_connected_again.inc
+ --disable_query_log
+ --eval set @@debug_dbug="$old_debug"
+
+ if ($error == 0)
+ {
+ --echo # NO CRASH: $crash
+ }
+ if ($error)
+ {
+ --echo # CRASH: $crash
+ }
+ # Check which tables still exists
+ --replace_result MAI MYI MAD MYD
+ --list_files $MYSQLD_DATADIR/test t*
+ --replace_regex /backup-\d+/backup/
+ --list_files $MYSQLD_DATADIR/test *sql*
+ --remove_files_wildcard $MYSQLD_DATADIR/test *sql-backup-*
+
+ --let $binlog_file=master-bin.000001
+ --source include/show_binlog_events.inc
+ if ($error)
+ {
+ --let $binlog_file=master-bin.000002
+ --source include/show_binlog_events.inc
+ }
+
+ --replace_result $default_engine DEFAULT_ENGINE ' PAGE_CHECKSUM=1' ''
+ show create table t1;
+ select * from t1;
+ --replace_result $default_engine DEFAULT_ENGINE ' PAGE_CHECKSUM=1' ''
+ --error 0, ER_NO_SUCH_TABLE
+ show create table tp1;
+ --error 0, ER_NO_SUCH_TABLE
+ select * from tp1;
+ --replace_result $default_engine DEFAULT_ENGINE ' PAGE_CHECKSUM=1' ''
+ --error 0, ER_NO_SUCH_TABLE
+ show create table tp2;
+ --error 0, ER_NO_SUCH_TABLE
+ select * from tp2;
+ # Drop the tables. The warnings will show what was dropped
+ --disable_warnings
+ drop table t1;
+ drop table if exists tp1;
+ --enable_warnings
+ }
+}
+drop table if exists t1;
+drop procedure prepare_table;
+--eval set @@debug_dbug="$save_debug"
+
+--enable_query_log
diff --git a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result
index 936f604be2e..71332034b15 100644
--- a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result
@@ -41,16 +41,16 @@ select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
ROW ROW
CREATE TABLE t1 (a varchar(100));
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_1_";
insert into t1 values("work_2_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
+insert into t1 values(concat(SYS_GUID(),"work_3_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_4_",UUID()));
+insert into t1 values(concat("for_4_",SYS_GUID()));
insert into t1 select "yesterday_5_";
create temporary table tmp(a char(100));
insert into tmp values("see_6_");
@@ -116,43 +116,43 @@ set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_17_";
insert into t1 values("work_18_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
+insert into t1 values(concat(SYS_GUID(),"work_19_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_20_",UUID()));
+insert into t1 values(concat("for_20_",SYS_GUID()));
insert into t1 select "yesterday_21_";
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
+insert into t1 values(concat(SYS_GUID(),"work_22_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_23_",UUID()));
+insert into t1 values(concat("for_23_",SYS_GUID()));
insert into t1 select "yesterday_24_";
-create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
+create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
+create table t3 select 1 union select SYS_GUID();
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
Warnings:
Warning 1292 Truncated incorrect datetime value: '3'
-insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
create procedure foo()
begin
insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
+insert into t1 values(concat("for_26_",SYS_GUID()));
insert into t1 select "yesterday_27_";
end|
create procedure foo2()
begin
-insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values(concat("emergency_28_",SYS_GUID()));
insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
+insert into t1 values(concat("for_30_",SYS_GUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work_31_");
set session binlog_format=mixed;
@@ -171,7 +171,7 @@ end|
call foo();
call foo2();
call foo4("hello");
-call foo4(UUID());
+call foo4(SYS_GUID());
call foo4("world");
select foo3();
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
@@ -207,7 +207,7 @@ foo4()
deallocate prepare stmt1;
create function foo5() returns bigint unsigned
begin
-insert into t2 select UUID();
+insert into t2 select SYS_GUID();
return 100;
end|
select foo5();
@@ -229,18 +229,18 @@ end|
select foo6("foo6_1_");
foo6("foo6_1_")
100
-select foo6(concat("foo6_2_",UUID()));
-foo6(concat("foo6_2_",UUID()))
+select foo6(concat("foo6_2_",SYS_GUID()));
+foo6(concat("foo6_2_",SYS_GUID()))
100
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
deallocate prepare stmt1;
-create view v1 as select uuid();
+create view v1 as select SYS_GUID();
create table t11 (data varchar(255));
insert into t11 select * from v1;
insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
@@ -250,11 +250,11 @@ execute stmt1;
deallocate prepare stmt1;
create trigger t11_bi before insert on t11 for each row
begin
-set NEW.data = concat(NEW.data,UUID());
+set NEW.data = concat(NEW.data,SYS_GUID());
end|
insert into t11 values("try_560_");
insert delayed into t2 values("delay_1_");
-insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
insert delayed into t2 values("delay_6_");
insert delayed into t2 values(rand());
set @a=2.345;
@@ -356,7 +356,7 @@ alter table t1 modify a int, drop primary key;
insert into t1 values(null,"try_57_");
connection slave;
connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
+CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
insert into t16 values("try_65_");
@@ -427,7 +427,7 @@ DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
+INSERT INTO t12 VALUES(SYS_GUID());
UNLOCK TABLES;
connection slave;
connection master;
diff --git a/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result b/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
index 9edec669908..b878042174b 100644
--- a/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
+++ b/mysql-test/suite/compat/oracle/r/sp-anchor-row-type-table.result
@@ -21,7 +21,7 @@ Table Create Table
t2 CREATE TABLE "t2" (
"a" int(11) DEFAULT NULL,
"b" text DEFAULT NULL,
- "c" char(1) DEFAULT NULL
+ "c" varchar(1) DEFAULT NULL
)
DROP PROCEDURE p2;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor.result b/mysql-test/suite/compat/oracle/r/sp-cursor.result
index 2e0c43c8b87..d7e88430bc7 100644
--- a/mysql-test/suite/compat/oracle/r/sp-cursor.result
+++ b/mysql-test/suite/compat/oracle/r/sp-cursor.result
@@ -454,12 +454,12 @@ CALL p1('1b');
msg
Fetched a record a=1
Warnings:
-Warning 1265 Data truncated for column 'p_a' at row 1
+Warning 1265 Data truncated for column 'p_a' at row 0
CALL p1('b1');
msg
Fetched a record a=0
Warnings:
-Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1
+Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 0
DROP PROCEDURE p1;
#
# One parameter in SELECT list + subselect
diff --git a/mysql-test/suite/compat/oracle/r/sp-param.result b/mysql-test/suite/compat/oracle/r/sp-param.result
index 3b9be4585d4..bb415bd74a7 100644
--- a/mysql-test/suite/compat/oracle/r/sp-param.result
+++ b/mysql-test/suite/compat/oracle/r/sp-param.result
@@ -152,7 +152,7 @@ begin
call p1(w,'0123456789');
end;
/
-ERROR 22001: Data too long for column 'pinout' at row 1
+ERROR 22001: Data too long for column 'pinout' at row 0
declare w varchar(20);
begin
w:='aaa';
@@ -165,7 +165,7 @@ w:='aaa';
call p1(w,'0123456789');
end;
/
-ERROR 22001: Data too long for column 'pinout' at row 1
+ERROR 22001: Data too long for column 'pinout' at row 0
declare str varchar(6000);
pout varchar(6000);
begin
@@ -184,7 +184,7 @@ call p1(pout,str);
select length(pout);
end;
/
-ERROR 22001: Data too long for column 'pinout' at row 1
+ERROR 22001: Data too long for column 'pinout' at row 0
declare str varchar(40000);
pout varchar(60000);
begin
@@ -203,7 +203,7 @@ call p1(pout,str);
select length(pout);
end;
/
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
declare str text(80000);
pout text(80000);
begin
@@ -240,7 +240,7 @@ CALL p2(11);
LENGTH(pinout)
10
Warnings:
-Warning 1265 Data truncated for column 'pinout' at row 1
+Warning 1265 Data truncated for column 'pinout' at row 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode=ORACLE;
@@ -261,12 +261,12 @@ CALL p2(65535);
LENGTH(f1(str,padlen))
65532
Warnings:
-Warning 1265 Data truncated for column 'pin' at row 1
+Warning 1265 Data truncated for column 'pin' at row 0
CALL p2(65536);
LENGTH(f1(str,padlen))
65532
Warnings:
-Warning 1265 Data truncated for column 'pin' at row 1
+Warning 1265 Data truncated for column 'pin' at row 0
DROP PROCEDURE p2;
DROP FUNCTION f1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -290,9 +290,9 @@ CALL p2(21844);
length(pout)
21844
CALL p2(21845);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(21846);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP PROCEDURE p1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -316,9 +316,9 @@ CALL p2(21844);
length(pout)
21844
CALL p2(21845);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(21846);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP PROCEDURE p1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -339,13 +339,13 @@ CALL p2(65532);
LENGTH(f1(str,padlen))
65532
CALL p2(65533);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65534);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65535);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65536);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP FUNCTION f1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -366,9 +366,9 @@ CALL p2(21844);
LENGTH(f1(str,padlen))
21844
CALL p2(21845);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(21846);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP FUNCTION f1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -389,9 +389,9 @@ CALL p2(21844);
LENGTH(f1(str,padlen))
21844
CALL p2(21845);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(21846);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP FUNCTION f1;
SET sql_mode='ORACLE,STRICT_TRANS_TABLES';
@@ -412,12 +412,12 @@ CALL p2(65532);
LENGTH(f1(str,padlen))
65532
CALL p2(65533);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65534);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65535);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
CALL p2(65536);
-ERROR 22001: Data too long for column 'pin' at row 1
+ERROR 22001: Data too long for column 'pin' at row 0
DROP PROCEDURE p2;
DROP FUNCTION f1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result
index 3ed11d7f9de..0b23f303030 100644
--- a/mysql-test/suite/compat/oracle/r/sp-row.result
+++ b/mysql-test/suite/compat/oracle/r/sp-row.result
@@ -24,7 +24,7 @@ RETURN a;
END;
$$
SELECT f1(ROW(10,20));
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(ROW(10,20))`
DROP FUNCTION f1;
#
# ROW as an SP parameter
@@ -261,7 +261,7 @@ SELECT f1(a);
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a`
DROP PROCEDURE p1;
DROP FUNCTION f1;
CREATE FUNCTION f1(a INT) RETURN INT
@@ -278,7 +278,7 @@ SELECT f1(a);
END;
$$
CALL p1();
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a`
DROP PROCEDURE p1;
DROP FUNCTION f1;
#
@@ -332,7 +332,7 @@ RETURN rec;
END;
$$
SELECT f1(10);
-ERROR 21000: Operand should contain 1 column(s)
+ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(10)`
DROP FUNCTION f1;
#
# Using the entire ROW in SELECT..CREATE
diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result
index 2e7b21b2d75..2e212530ae5 100644
--- a/mysql-test/suite/compat/oracle/r/sp.result
+++ b/mysql-test/suite/compat/oracle/r/sp.result
@@ -1286,7 +1286,7 @@ CALL p1();
a b
127 200
Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 0
DROP PROCEDURE p1;
DROP TABLE t1;
#
@@ -1703,8 +1703,8 @@ t2 CREATE TABLE "t2" (
"t2" text DEFAULT NULL,
"t3" mediumtext DEFAULT NULL,
"t4" longtext DEFAULT NULL,
- "enum1" char(1) DEFAULT NULL,
- "set1" char(5) DEFAULT NULL,
+ "enum1" varchar(1) DEFAULT NULL,
+ "set1" varchar(5) DEFAULT NULL,
"blob1" tinyblob DEFAULT NULL,
"blob2" longblob DEFAULT NULL,
"blob3" mediumblob DEFAULT NULL,
@@ -1865,8 +1865,8 @@ t2 CREATE TABLE "t2" (
"t2" text DEFAULT NULL,
"t3" mediumtext DEFAULT NULL,
"t4" longtext DEFAULT NULL,
- "enum1" char(1) DEFAULT NULL,
- "set1" char(5) DEFAULT NULL,
+ "enum1" varchar(1) DEFAULT NULL,
+ "set1" varchar(5) DEFAULT NULL,
"blob1" tinyblob DEFAULT NULL,
"blob2" longblob DEFAULT NULL,
"blob3" mediumblob DEFAULT NULL,
@@ -2370,7 +2370,7 @@ t1 CREATE TABLE "t1" (
"a_flt0" float DEFAULT NULL,
"a_dbl0" double DEFAULT NULL,
"a_bit3" bit(3) DEFAULT NULL,
- "a_enum0" char(1) DEFAULT NULL,
+ "a_enum0" varchar(1) DEFAULT NULL,
"a_varchar10" varchar(10) DEFAULT NULL,
"a_text1" text DEFAULT NULL,
"a_tinytext1" tinytext DEFAULT NULL,
@@ -2388,7 +2388,7 @@ t1 CREATE TABLE "t1" (
"aa_flt0" float DEFAULT NULL,
"aa_dbl0" double DEFAULT NULL,
"aa_bit3" bit(3) DEFAULT NULL,
- "aa_enum0" char(1) DEFAULT NULL,
+ "aa_enum0" varchar(1) DEFAULT NULL,
"aa_varchar10" varchar(10) DEFAULT NULL,
"aa_text1" text DEFAULT NULL,
"aa_tinytext1" tinytext DEFAULT NULL,
diff --git a/mysql-test/suite/compat/oracle/t/sp-row.test b/mysql-test/suite/compat/oracle/t/sp-row.test
index ebd0a2a2137..c7658c76838 100644
--- a/mysql-test/suite/compat/oracle/t/sp-row.test
+++ b/mysql-test/suite/compat/oracle/t/sp-row.test
@@ -35,7 +35,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1(ROW(10,20));
DROP FUNCTION f1;
@@ -334,7 +334,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
DROP FUNCTION f1;
@@ -355,7 +355,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
DROP FUNCTION f1;
@@ -427,7 +427,7 @@ BEGIN
END;
$$
DELIMITER ;$$
---error ER_OPERAND_COLUMNS
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1(10);
DROP FUNCTION f1;
diff --git a/mysql-test/suite/encryption/r/bulk_insert.result b/mysql-test/suite/encryption/r/bulk_insert.result
new file mode 100644
index 00000000000..840cb0cd38b
--- /dev/null
+++ b/mysql-test/suite/encryption/r/bulk_insert.result
@@ -0,0 +1,7 @@
+SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL,
+UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB;
+INSERT INTO t1 SELECT seq FROM seq_1_to_65536;
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
index 356dce64f8d..2b29bf260e1 100644
--- a/mysql-test/suite/encryption/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(2);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
SELECT * FROM t2;
a
2
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
index 1ca9d784d57..e2034f14e31 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -1,10 +1,10 @@
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` has an unreadable root page");
+call mtr.add_suppression("Table .*t[12].* is corrupted");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("failed to read \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# Start server with keys2.txt
@@ -46,29 +46,29 @@ INSERT INTO t2 VALUES ('foobar',1,2);
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist in engine
SELECT * FROM t2 where id = 1;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
SELECT * FROM t2 where b = 1;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
INSERT INTO t2 VALUES ('tmp',3,3);
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
DELETE FROM t2 where b = 3;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
DELETE FROM t2 where id = 3;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
UPDATE t2 set b = b +1;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
OPTIMIZE TABLE t2;
Table Op Msg_type Msg_text
-test.t2 optimize Error Table 'test.t2' doesn't exist in engine
-test.t2 optimize status Operation failed
+test.t2 optimize Error Table test/t2 is corrupted. Please drop the table and recreate.
+test.t2 optimize error Corrupt
ALTER TABLE t2 ADD COLUMN d INT;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
-test.t2 analyze Error Table 'test.t2' doesn't exist in engine
-test.t2 analyze status Operation failed
+test.t2 analyze Error Table test/t2 is corrupted. Please drop the table and recreate.
+test.t2 analyze error Corrupt
TRUNCATE TABLE t2;
-ERROR 42S02: Table 'test.t2' doesn't exist in engine
+ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate.
DROP TABLE t2;
# Start server with keys2.txt
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
index 46df2d440c6..7e59ad4aec3 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result
@@ -1,9 +1,9 @@
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted|does not exist.*is trying to rename)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|does not exist.*is trying to rename)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\.");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache");
call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
@@ -19,20 +19,20 @@ SHOW WARNINGS;
Level Code Message
Error 1932 Table 'test.t1' doesn't exist in engine
ALTER TABLE t1 ENGINE=InnoDB;
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
SHOW WARNINGS;
Level Code Message
-Error 1932 Table 'test.t1' doesn't exist in engine
+Error 1877 Table test/t1 is corrupted. Please drop the table and recreate.
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
-test.t1 optimize Error Table 'test.t1' doesn't exist in engine
-test.t1 optimize status Operation failed
+test.t1 optimize Error Table test/t1 is corrupted. Please drop the table and recreate.
+test.t1 optimize error Corrupt
SHOW WARNINGS;
Level Code Message
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check Error Table 'test.t1' doesn't exist in engine
-test.t1 check status Operation failed
+test.t1 check Error Table test/t1 is corrupted. Please drop the table and recreate.
+test.t1 check error Corrupt
SHOW WARNINGS;
Level Code Message
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
@@ -65,5 +65,5 @@ t1 CREATE TABLE `t1` (
RENAME TABLE t1 TO t1new;
ERROR HY000: Error on rename of './test/t1' to './test/t1new' (errno: 155 "The table does not exist in the storage engine")
ALTER TABLE t1 RENAME TO t1new;
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
index 5a3e275dda9..e808d50b544 100644
--- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
+++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result
@@ -1,8 +1,8 @@
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON;
@@ -18,8 +18,8 @@ SHOW WARNINGS;
Level Code Message
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check Error Table 'test.t1' doesn't exist in engine
-test.t1 check status Operation failed
+test.t1 check Error Table test/t1 is corrupted. Please drop the table and recreate.
+test.t1 check error Corrupt
SHOW WARNINGS;
Level Code Message
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result
index 6bacbfe78b2..d5c1e079e96 100644
--- a/mysql-test/suite/encryption/r/innodb-missing-key.result
+++ b/mysql-test/suite/encryption/r/innodb-missing-key.result
@@ -1,8 +1,8 @@
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
# Start server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
@@ -40,9 +40,9 @@ COUNT(1)
SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
SELECT COUNT(1) FROM t1 where b = 'ab';
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
SELECT COUNT(1) FROM t1;
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
# Start server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
diff --git a/mysql-test/suite/encryption/t/bulk_insert.opt b/mysql-test/suite/encryption/t/bulk_insert.opt
new file mode 100644
index 00000000000..95455f5f75e
--- /dev/null
+++ b/mysql-test/suite/encryption/t/bulk_insert.opt
@@ -0,0 +1 @@
+--innodb_encrypt_log=1
diff --git a/mysql-test/suite/encryption/t/bulk_insert.test b/mysql-test/suite/encryption/t/bulk_insert.test
new file mode 100644
index 00000000000..ce7804cb4e0
--- /dev/null
+++ b/mysql-test/suite/encryption/t/bulk_insert.test
@@ -0,0 +1,11 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+--source include/have_file_key_management_plugin.inc
+
+SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (
+ `id` int(10) unsigned NOT NULL,
+ UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB;
+INSERT INTO t1 SELECT seq FROM seq_1_to_65536;
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
index bccac2bb182..e4a31a0b478 100644
--- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
@@ -6,7 +6,7 @@ call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
-call mtr.add_suppression("InnoDB: Failed to read page [123] from file '.*test.t1\\.ibd': Table is encrypted but decrypt failed");
+call mtr.add_suppression("InnoDB: Failed to read page [123] from file '.*test.t1\\.ibd': Table is compressed or encrypted but uncompress or decrypt failed");
call mtr.add_suppression("InnoDB: The page \\[page id: space=\\d+, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted");
call mtr.add_suppression("InnoDB: Table in tablespace \\d+ encrypted. However key management plugin or used key_version \\d+ is not found or used encryption algorithm or method does not match. Can't continue opening the table.");
call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page ");
@@ -55,12 +55,12 @@ EOF
SELECT * FROM t1;
--disable_query_log
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[1].ibd looks corrupted; key_version=");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted. Please drop the table and recreate.");
+call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and recreate.");
--enable_query_log
let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
index 30beff4bd85..05a3b5f4d06 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test
@@ -10,11 +10,11 @@
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` has an unreadable root page");
+call mtr.add_suppression("Table .*t[12].* is corrupted");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("failed to read \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
@@ -75,32 +75,32 @@ INSERT INTO t2 VALUES ('foobar',1,2);
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t2;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT * FROM t2 where id = 1;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT * FROM t2 where b = 1;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
INSERT INTO t2 VALUES ('tmp',3,3);
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
DELETE FROM t2 where b = 3;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
DELETE FROM t2 where id = 3;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
UPDATE t2 set b = b +1;
OPTIMIZE TABLE t2;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
ALTER TABLE t2 ADD COLUMN d INT;
ANALYZE TABLE t2;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
TRUNCATE TABLE t2;
DROP TABLE t2;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
index ad252b6c92f..21a9ddb217d 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test
@@ -8,13 +8,13 @@
# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
# MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key
#
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted|does not exist.*is trying to rename)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|does not exist.*is trying to rename)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
# Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\.");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache");
call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace");
# for innodb_checksum_algorithm=full_crc32 only
@@ -36,7 +36,7 @@ INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
SELECT * FROM t1;
--replace_regex /key_id [1-9][0-9]*/\1 /
SHOW WARNINGS;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
ALTER TABLE t1 ENGINE=InnoDB;
--replace_regex /key_id [1-9][0-9]*/\1 /
SHOW WARNINGS;
@@ -97,7 +97,7 @@ SHOW CREATE TABLE t1;
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO t1new;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
ALTER TABLE t1 RENAME TO t1new;
-# Drop should pass even with incorrect keys
+# Drop should succeed even with incorrect keys
DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
index 759f4e58280..c37eb365e7c 100644
--- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
+++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test
@@ -7,12 +7,12 @@
# MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys
#
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page)");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted; key_version=1");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
# Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test
index e5bee99fee2..53fc820a1c9 100644
--- a/mysql-test/suite/encryption/t/innodb-missing-key.test
+++ b/mysql-test/suite/encryption/t/innodb-missing-key.test
@@ -7,11 +7,11 @@
# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing
#
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Recovery failed to read page");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
+call mtr.add_suppression("Table .*t1.* is corrupted");
--echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
@@ -48,9 +48,9 @@ SELECT COUNT(1) FROM t3;
SELECT COUNT(1) FROM t2;
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT COUNT(1) FROM t1 where b = 'ab';
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT COUNT(1) FROM t1;
--echo
diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
index 936f604be2e..71332034b15 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
@@ -41,16 +41,16 @@ select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
ROW ROW
CREATE TABLE t1 (a varchar(100));
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_1_";
insert into t1 values("work_2_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
+insert into t1 values(concat(SYS_GUID(),"work_3_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_4_",UUID()));
+insert into t1 values(concat("for_4_",SYS_GUID()));
insert into t1 select "yesterday_5_";
create temporary table tmp(a char(100));
insert into tmp values("see_6_");
@@ -116,43 +116,43 @@ set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_17_";
insert into t1 values("work_18_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
+insert into t1 values(concat(SYS_GUID(),"work_19_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_20_",UUID()));
+insert into t1 values(concat("for_20_",SYS_GUID()));
insert into t1 select "yesterday_21_";
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
+insert into t1 values(concat(SYS_GUID(),"work_22_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_23_",UUID()));
+insert into t1 values(concat("for_23_",SYS_GUID()));
insert into t1 select "yesterday_24_";
-create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
+create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
+create table t3 select 1 union select SYS_GUID();
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
Warnings:
Warning 1292 Truncated incorrect datetime value: '3'
-insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
create procedure foo()
begin
insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
+insert into t1 values(concat("for_26_",SYS_GUID()));
insert into t1 select "yesterday_27_";
end|
create procedure foo2()
begin
-insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values(concat("emergency_28_",SYS_GUID()));
insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
+insert into t1 values(concat("for_30_",SYS_GUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work_31_");
set session binlog_format=mixed;
@@ -171,7 +171,7 @@ end|
call foo();
call foo2();
call foo4("hello");
-call foo4(UUID());
+call foo4(SYS_GUID());
call foo4("world");
select foo3();
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
@@ -207,7 +207,7 @@ foo4()
deallocate prepare stmt1;
create function foo5() returns bigint unsigned
begin
-insert into t2 select UUID();
+insert into t2 select SYS_GUID();
return 100;
end|
select foo5();
@@ -229,18 +229,18 @@ end|
select foo6("foo6_1_");
foo6("foo6_1_")
100
-select foo6(concat("foo6_2_",UUID()));
-foo6(concat("foo6_2_",UUID()))
+select foo6(concat("foo6_2_",SYS_GUID()));
+foo6(concat("foo6_2_",SYS_GUID()))
100
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
deallocate prepare stmt1;
-create view v1 as select uuid();
+create view v1 as select SYS_GUID();
create table t11 (data varchar(255));
insert into t11 select * from v1;
insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
@@ -250,11 +250,11 @@ execute stmt1;
deallocate prepare stmt1;
create trigger t11_bi before insert on t11 for each row
begin
-set NEW.data = concat(NEW.data,UUID());
+set NEW.data = concat(NEW.data,SYS_GUID());
end|
insert into t11 values("try_560_");
insert delayed into t2 values("delay_1_");
-insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
insert delayed into t2 values("delay_6_");
insert delayed into t2 values(rand());
set @a=2.345;
@@ -356,7 +356,7 @@ alter table t1 modify a int, drop primary key;
insert into t1 values(null,"try_57_");
connection slave;
connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
+CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
insert into t16 values("try_65_");
@@ -427,7 +427,7 @@ DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
+INSERT INTO t12 VALUES(SYS_GUID());
UNLOCK TABLES;
connection slave;
connection master;
diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result
index 8343df73110..b1d455e610a 100644
--- a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result
+++ b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result
@@ -51,7 +51,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -132,7 +132,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -213,7 +213,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -294,7 +294,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -375,7 +375,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -456,7 +456,7 @@ t1 CREATE TABLE `t1` (
PARTITION `p2` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION s2;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
c1 c2
diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result
index 3804f883be0..494a9dfdcdb 100644
--- a/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result
+++ b/mysql-test/suite/engines/funcs/r/tc_partition_reorg_merge.result
@@ -46,7 +46,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -117,7 +117,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -188,7 +188,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -259,7 +259,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -330,7 +330,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
@@ -401,7 +401,7 @@ t1 CREATE TABLE `t1` (
PARTITION `m0` VALUES LESS THAN (30) ENGINE = ENGINE,
PARTITION `p3` VALUES LESS THAN MAXVALUE ENGINE = ENGINE)
ALTER TABLE t1 DROP PARTITION m1;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
c1 c2
diff --git a/mysql-test/suite/engines/funcs/t/tc_partition_reorg_divide.test b/mysql-test/suite/engines/funcs/t/tc_partition_reorg_divide.test
index 89a75bb06af..03f4ccb23df 100644
--- a/mysql-test/suite/engines/funcs/t/tc_partition_reorg_divide.test
+++ b/mysql-test/suite/engines/funcs/t/tc_partition_reorg_divide.test
@@ -21,7 +21,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
@@ -52,7 +52,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
@@ -83,7 +83,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
@@ -114,7 +114,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
@@ -145,7 +145,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
@@ -176,7 +176,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION s2;
ALTER TABLE t1 DROP PARTITION s1;
SELECT * FROM t1 ORDER BY c1;
diff --git a/mysql-test/suite/engines/funcs/t/tc_partition_reorg_merge.test b/mysql-test/suite/engines/funcs/t/tc_partition_reorg_merge.test
index fe9b0ba108f..e2059ff6336 100644
--- a/mysql-test/suite/engines/funcs/t/tc_partition_reorg_merge.test
+++ b/mysql-test/suite/engines/funcs/t/tc_partition_reorg_merge.test
@@ -18,7 +18,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
@@ -46,7 +46,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
@@ -74,7 +74,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
@@ -102,7 +102,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
@@ -130,7 +130,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
@@ -158,7 +158,7 @@ SHOW TABLES;
let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
--replace_result $ENGINE ENGINE
SHOW CREATE TABLE t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
ALTER TABLE t1 DROP PARTITION m1;
ALTER TABLE t1 DROP PARTITION m0;
SELECT * FROM t1 ORDER BY c1;
diff --git a/mysql-test/suite/federated/error_row_number.result b/mysql-test/suite/federated/error_row_number.result
new file mode 100644
index 00000000000..a53f3a87a17
--- /dev/null
+++ b/mysql-test/suite/federated/error_row_number.result
@@ -0,0 +1,26 @@
+#
+# MDEV-26654 ROW_NUMBER is wrong upon INSERT into Federated table
+#
+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;
+connection master;
+create table t (pk int primary key);
+create table tfed engine=FEDERATED connection='mysql://root@localhost:$MASTER_MYPORT/test/t';
+insert into tfed values (1),(2),(1);
+ERROR 23000: Can't write; duplicate key in table 'tfed'
+get diagnostics condition 1 @val = row_number;
+# federated is doing bulk insert here, the exact row number is unknown
+select @val;
+@val
+0
+drop table tfed, t;
+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/error_row_number.test b/mysql-test/suite/federated/error_row_number.test
new file mode 100644
index 00000000000..8d943589e07
--- /dev/null
+++ b/mysql-test/suite/federated/error_row_number.test
@@ -0,0 +1,18 @@
+--echo #
+--echo # MDEV-26654 ROW_NUMBER is wrong upon INSERT into Federated table
+--echo #
+
+--source suite/federated/have_federatedx.inc
+--source include/federated.inc
+--connection master
+
+create table t (pk int primary key);
+--evalp create table tfed engine=FEDERATED connection='mysql://root@localhost:$MASTER_MYPORT/test/t'
+--error ER_DUP_KEY
+insert into tfed values (1),(2),(1);
+get diagnostics condition 1 @val = row_number;
+--echo # federated is doing bulk insert here, the exact row number is unknown
+select @val;
+
+drop table tfed, t;
+--source include/federated_cleanup.inc
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index adf4c2bc10c..b603d36f5ec 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -3322,9 +3322,9 @@ NULL NULL 1
-3333.33 -3333.3333 30
Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 2
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
index 36115ecad83..b44ef1fdee2 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
@@ -55,9 +55,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5.1.1:
------------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
index f52585cfc45..051e0d1e125 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase 3.5.3:
---------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
index fb5d105448f..d551575960e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index 98613a20b49..2a57496800e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_09.result b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
index 6664994543b..89815594a7e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
@@ -55,9 +55,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result
index de9b73c2bf5..9e09c50d968 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_1011ext.result
@@ -55,9 +55,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
index fbca906a9fb..beb8ad88de1 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
@@ -63,19 +63,19 @@ f57 numeric (0) not null DEFAULT 99,
f58 numeric (64) not null DEFAULT 99
) engine = innodb;
Warnings:
-Note 1265 Data truncated for column 'f36' at row 1
-Note 1265 Data truncated for column 'f37' at row 1
-Note 1265 Data truncated for column 'f38' at row 1
-Note 1265 Data truncated for column 'f39' at row 1
-Note 1265 Data truncated for column 'f40' at row 1
-Note 1265 Data truncated for column 'f41' at row 1
-Note 1265 Data truncated for column 'f42' at row 1
-Note 1265 Data truncated for column 'f43' at row 1
-Note 1265 Data truncated for column 'f44' at row 1
-Note 1265 Data truncated for column 'f45' at row 1
-Note 1265 Data truncated for column 'f47' at row 1
-Note 1265 Data truncated for column 'f49' at row 1
-Note 1265 Data truncated for column 'f51' at row 1
+Note 1265 Data truncated for column 'f36' at row 0
+Note 1265 Data truncated for column 'f37' at row 0
+Note 1265 Data truncated for column 'f38' at row 0
+Note 1265 Data truncated for column 'f39' at row 0
+Note 1265 Data truncated for column 'f40' at row 0
+Note 1265 Data truncated for column 'f41' at row 0
+Note 1265 Data truncated for column 'f42' at row 0
+Note 1265 Data truncated for column 'f43' at row 0
+Note 1265 Data truncated for column 'f44' at row 0
+Note 1265 Data truncated for column 'f45' at row 0
+Note 1265 Data truncated for column 'f47' at row 0
+Note 1265 Data truncated for column 'f49' at row 0
+Note 1265 Data truncated for column 'f51' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb1.txt'
into table tb1;
drop table if exists tb2 ;
@@ -198,9 +198,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = innodb;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb3.txt'
into table tb3;
drop table if exists tb4;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result
index 5eaa5b08cc2..b33d6a28efb 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_memory.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result
@@ -56,22 +56,22 @@ f57 numeric (0) not null DEFAULT 99,
f58 numeric (64) not null DEFAULT 99
) engine = memory;
Warnings:
-Note 1265 Data truncated for column 'f33' at row 1
-Note 1265 Data truncated for column 'f34' at row 1
-Note 1265 Data truncated for column 'f35' at row 1
-Note 1265 Data truncated for column 'f36' at row 1
-Note 1265 Data truncated for column 'f37' at row 1
-Note 1265 Data truncated for column 'f38' at row 1
-Note 1265 Data truncated for column 'f39' at row 1
-Note 1265 Data truncated for column 'f40' at row 1
-Note 1265 Data truncated for column 'f41' at row 1
-Note 1265 Data truncated for column 'f42' at row 1
-Note 1265 Data truncated for column 'f43' at row 1
-Note 1265 Data truncated for column 'f44' at row 1
-Note 1265 Data truncated for column 'f45' at row 1
-Note 1265 Data truncated for column 'f47' at row 1
-Note 1265 Data truncated for column 'f49' at row 1
-Note 1265 Data truncated for column 'f51' at row 1
+Note 1265 Data truncated for column 'f33' at row 0
+Note 1265 Data truncated for column 'f34' at row 0
+Note 1265 Data truncated for column 'f35' at row 0
+Note 1265 Data truncated for column 'f36' at row 0
+Note 1265 Data truncated for column 'f37' at row 0
+Note 1265 Data truncated for column 'f38' at row 0
+Note 1265 Data truncated for column 'f39' at row 0
+Note 1265 Data truncated for column 'f40' at row 0
+Note 1265 Data truncated for column 'f41' at row 0
+Note 1265 Data truncated for column 'f42' at row 0
+Note 1265 Data truncated for column 'f43' at row 0
+Note 1265 Data truncated for column 'f44' at row 0
+Note 1265 Data truncated for column 'f45' at row 0
+Note 1265 Data truncated for column 'f47' at row 0
+Note 1265 Data truncated for column 'f49' at row 0
+Note 1265 Data truncated for column 'f51' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb1.txt'
into table tb1;
drop table if exists tb2 ;
@@ -188,9 +188,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = memory;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
drop table if exists tb4 ;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
index 4426583ac4c..e7a8a176188 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
@@ -64,22 +64,22 @@ f57 numeric (0) not null DEFAULT 99,
f58 numeric (64) not null DEFAULT 99
) engine = myisam;
Warnings:
-Note 1265 Data truncated for column 'f33' at row 1
-Note 1265 Data truncated for column 'f34' at row 1
-Note 1265 Data truncated for column 'f35' at row 1
-Note 1265 Data truncated for column 'f36' at row 1
-Note 1265 Data truncated for column 'f37' at row 1
-Note 1265 Data truncated for column 'f38' at row 1
-Note 1265 Data truncated for column 'f39' at row 1
-Note 1265 Data truncated for column 'f40' at row 1
-Note 1265 Data truncated for column 'f41' at row 1
-Note 1265 Data truncated for column 'f42' at row 1
-Note 1265 Data truncated for column 'f43' at row 1
-Note 1265 Data truncated for column 'f44' at row 1
-Note 1265 Data truncated for column 'f45' at row 1
-Note 1265 Data truncated for column 'f47' at row 1
-Note 1265 Data truncated for column 'f49' at row 1
-Note 1265 Data truncated for column 'f51' at row 1
+Note 1265 Data truncated for column 'f33' at row 0
+Note 1265 Data truncated for column 'f34' at row 0
+Note 1265 Data truncated for column 'f35' at row 0
+Note 1265 Data truncated for column 'f36' at row 0
+Note 1265 Data truncated for column 'f37' at row 0
+Note 1265 Data truncated for column 'f38' at row 0
+Note 1265 Data truncated for column 'f39' at row 0
+Note 1265 Data truncated for column 'f40' at row 0
+Note 1265 Data truncated for column 'f41' at row 0
+Note 1265 Data truncated for column 'f42' at row 0
+Note 1265 Data truncated for column 'f43' at row 0
+Note 1265 Data truncated for column 'f44' at row 0
+Note 1265 Data truncated for column 'f45' at row 0
+Note 1265 Data truncated for column 'f47' at row 0
+Note 1265 Data truncated for column 'f49' at row 0
+Note 1265 Data truncated for column 'f51' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb1.txt'
into table tb1;
drop table if exists tb2 ;
@@ -210,9 +210,9 @@ f174 numeric (0),
f175 numeric (64)
) Engine = myisam;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb3.txt'
into table tb3;
drop table if exists tb4 ;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
index 6faa8d7b51a..d44732f5dd5 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
@@ -64,22 +64,22 @@ f57 numeric (0) not null DEFAULT 99,
f58 numeric (64) not null DEFAULT 99
) engine = myisam;
Warnings:
-Note 1265 Data truncated for column 'f33' at row 1
-Note 1265 Data truncated for column 'f34' at row 1
-Note 1265 Data truncated for column 'f35' at row 1
-Note 1265 Data truncated for column 'f36' at row 1
-Note 1265 Data truncated for column 'f37' at row 1
-Note 1265 Data truncated for column 'f38' at row 1
-Note 1265 Data truncated for column 'f39' at row 1
-Note 1265 Data truncated for column 'f40' at row 1
-Note 1265 Data truncated for column 'f41' at row 1
-Note 1265 Data truncated for column 'f42' at row 1
-Note 1265 Data truncated for column 'f43' at row 1
-Note 1265 Data truncated for column 'f44' at row 1
-Note 1265 Data truncated for column 'f45' at row 1
-Note 1265 Data truncated for column 'f47' at row 1
-Note 1265 Data truncated for column 'f49' at row 1
-Note 1265 Data truncated for column 'f51' at row 1
+Note 1265 Data truncated for column 'f33' at row 0
+Note 1265 Data truncated for column 'f34' at row 0
+Note 1265 Data truncated for column 'f35' at row 0
+Note 1265 Data truncated for column 'f36' at row 0
+Note 1265 Data truncated for column 'f37' at row 0
+Note 1265 Data truncated for column 'f38' at row 0
+Note 1265 Data truncated for column 'f39' at row 0
+Note 1265 Data truncated for column 'f40' at row 0
+Note 1265 Data truncated for column 'f41' at row 0
+Note 1265 Data truncated for column 'f42' at row 0
+Note 1265 Data truncated for column 'f43' at row 0
+Note 1265 Data truncated for column 'f44' at row 0
+Note 1265 Data truncated for column 'f45' at row 0
+Note 1265 Data truncated for column 'f47' at row 0
+Note 1265 Data truncated for column 'f49' at row 0
+Note 1265 Data truncated for column 'f51' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb1.txt'
into table tb1;
drop table if exists tb2 ;
@@ -210,9 +210,9 @@ f174 numeric (0),
f175 numeric (64)
) Engine = myisam;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb3.txt'
into table tb3;
drop table if exists tb4 ;
diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
index 056a1fa7559..dba5e7f330e 100644
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@ -197,7 +197,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_STATUS != 'INACTIVE'; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss mariadb.sys@localhost latin1 latin1_swedish_ci latin1_swedish_ci
@@ -213,7 +213,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_STATUS != 'INACTIVE'; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss mariadb.sys@localhost latin1 latin1_swedish_ci latin1_swedish_ci
@@ -229,7 +229,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert') AND TRIGGER_SCHEMA != 'sys'; SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA != 'sys'; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_STATUS != 'INACTIVE'; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8mb3 utf8mb3_general_ci latin1_swedish_ci
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss mariadb.sys@localhost latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index a9b96d15d06..e9b88b9309a 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -3323,9 +3323,9 @@ NULL NULL 1
-3333.33 -3333.3333 30
Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 2
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0102.result b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
index 4608fc8302a..975c014512f 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5.1.1:
------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result
index 8d24426ac75..b76e7d01f59 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase 3.5.3:
---------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
index 7228c4cffd9..ceae360946c 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index 32324600ad5..c9d6454dc5b 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_09.result b/mysql-test/suite/funcs_1/r/memory_trig_09.result
index 7579418dc1f..b3e5e109b82 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_09.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result
index 41904bf0afd..c1b697bd599 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_1011ext.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index a9b96d15d06..e9b88b9309a 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -3323,9 +3323,9 @@ NULL NULL 1
-3333.33 -3333.3333 30
Warnings:
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 2
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
-Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1
+Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
index 4608fc8302a..975c014512f 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5.1.1:
------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
index 8d24426ac75..b76e7d01f59 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase 3.5.3:
---------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
index 7228c4cffd9..ceae360946c 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index 32324600ad5..c9d6454dc5b 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -57,9 +57,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
Testcase: 3.5:
--------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_09.result b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
index 7579418dc1f..b3e5e109b82 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result
index 8302c2bd0f9..cacef967ca9 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_1011ext.result
@@ -56,9 +56,9 @@ f174 numeric (0),
f175 numeric (64)
) engine = <engine_to_be_used>;
Warnings:
-Note 1265 Data truncated for column 'f150' at row 1
-Note 1265 Data truncated for column 'f151' at row 1
-Note 1265 Data truncated for column 'f152' at row 1
+Note 1265 Data truncated for column 'f150' at row 0
+Note 1265 Data truncated for column 'f151' at row 0
+Note 1265 Data truncated for column 'f152' at row 0
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
into table tb3;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index c9f92d51210..efeb63ae616 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -106,7 +106,7 @@ CALL sp1( 34 );
@v1
3
Warnings:
-Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f1' at row 0
SHOW PROCEDURE STATUS WHERE db = 'db_storedproc';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db_storedproc sp1 PROCEDURE root@localhost <modified> <created> INVOKER this is simple latin1 latin1_swedish_ci latin1_swedish_ci
@@ -1430,7 +1430,7 @@ f1
value1
Warnings:
Note 1291 Column 'f1' has duplicated value 'value1' in SET
-Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f1' at row 0
SHOW PROCEDURE STATUS WHERE db = 'db_storedproc';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db_storedproc sp1 PROCEDURE root@localhost <modified> <created> INVOKER this is simple latin1 latin1_swedish_ci latin1_swedish_ci
@@ -7110,7 +7110,7 @@ CALL sp1();
x y z
000 000 000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7148,7 +7148,7 @@ CALL sp1();
x y z
00000 00000 00000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7186,7 +7186,7 @@ CALL sp1();
x y z
00000000 00000000 00000000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7224,7 +7224,7 @@ CALL sp1();
x y z
0000000000 0000000000 0000000000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7262,7 +7262,7 @@ CALL sp1();
x y z
00000000000000000000 00000000000000000000 00000000000000000000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7282,7 +7282,7 @@ CALL sp1();
x y z
-9999999999 -9999999999 -9999999999
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7293,7 +7293,7 @@ CALL sp1();
x y z
0 0 0
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7304,7 +7304,7 @@ CALL sp1();
x y z
0000000000 0000000000 0000000000
Warnings:
-Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7315,7 +7315,7 @@ CALL sp1();
x y z
0000000000 0000000000 0000000000
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7326,7 +7326,7 @@ CALL sp1();
x y z
0 0 0
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7337,7 +7337,7 @@ CALL sp1();
x y z
0 0 0
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7348,7 +7348,7 @@ CALL sp1();
x y z
0000000000 0000000000 0000000000
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -7359,7 +7359,7 @@ CALL sp1();
x y z
0000000000 0000000000 0000000000
Warnings:
-Note 1265 Data truncated for column 'x' at row 1
+Note 1265 Data truncated for column 'x' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -13769,7 +13769,7 @@ CALL sp1();
@xx
0
Warnings:
-Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 1
+Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -13797,7 +13797,7 @@ set @xx = xx;
END//
CALL sp1();
Warnings:
-Warning 1265 Data truncated for column 'xx' at row 1
+Warning 1265 Data truncated for column 'xx' at row 0
SELECT @xx;
@xx
t
@@ -13818,7 +13818,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1366 Incorrect double value: 'asd' for column ``.``.`xx` at row 1
+Warning 1366 Incorrect double value: 'asd' for column ``.``.`xx` at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -13846,7 +13846,7 @@ CALL sp1();
xx
0000-00-00 00:00:00
Warnings:
-Warning 1265 Data truncated for column 'xx' at row 1
+Warning 1265 Data truncated for column 'xx' at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -13890,7 +13890,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 1
+Warning 1366 Incorrect integer value: 'asd' for column ``.``.`xx` at row 0
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -17290,8 +17290,8 @@ CALL sp7(99999999999);
f1
9999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp8;
CREATE PROCEDURE sp8( f1 decimal (0) unsigned zerofill)
BEGIN
@@ -17302,7 +17302,7 @@ CALL sp8(999999999);
f1
1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp9;
CREATE PROCEDURE sp9( f1 decimal (0) zerofill)
BEGIN
@@ -17313,8 +17313,8 @@ CALL sp9(-1.00e+09);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp10;
CREATE PROCEDURE sp10( f1 decimal (0, 0))
BEGIN
@@ -17334,8 +17334,8 @@ CALL sp11(99999999999);
f1
9999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp12;
CREATE PROCEDURE sp12( f1 decimal (0, 0) unsigned zerofill)
BEGIN
@@ -17346,7 +17346,7 @@ CALL sp12(999999999);
f1
1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp13;
CREATE PROCEDURE sp13( f1 decimal (0, 0) zerofill)
BEGIN
@@ -17357,8 +17357,8 @@ CALL sp13(-1.00e+09);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp14;
CREATE PROCEDURE sp14( f1 decimal (63, 30))
BEGIN
@@ -17396,8 +17396,8 @@ CALL sp17(-1.00e+21);
f1
000000000000000000000000000000010.000000000000000000000000000000
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp18_d;
CREATE PROCEDURE sp18_d( f1 decimal (64))
BEGIN
@@ -17456,7 +17456,7 @@ CALL sp21(1.00e+00);
f1
0000000000000000000000000000000000000000000000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp22;
CREATE PROCEDURE sp22( f1 decimal unsigned)
BEGIN
@@ -17467,7 +17467,7 @@ CALL sp22(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp23;
CREATE PROCEDURE sp23( f1 decimal unsigned zerofill)
BEGIN
@@ -17478,7 +17478,7 @@ CALL sp23(1.00e+00);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp24;
CREATE PROCEDURE sp24( f1 decimal zerofill)
BEGIN
@@ -17489,8 +17489,8 @@ CALL sp24(-1.00e+09);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp25;
CREATE PROCEDURE sp25( f1 double)
BEGIN
@@ -17510,7 +17510,7 @@ CALL sp26(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp27;
CREATE PROCEDURE sp27( f1 double unsigned zerofill)
BEGIN
@@ -17521,7 +17521,7 @@ CALL sp27(1.00e+00);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp28;
CREATE PROCEDURE sp28( f1 double zerofill)
BEGIN
@@ -17532,7 +17532,7 @@ CALL sp28(1.00e+00);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp29;
CREATE PROCEDURE sp29( f1 float)
BEGIN
@@ -17552,7 +17552,7 @@ CALL sp30(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp31;
CREATE PROCEDURE sp31( f1 float unsigned zerofill)
BEGIN
@@ -17563,7 +17563,7 @@ CALL sp31(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp32;
CREATE PROCEDURE sp32( f1 float zerofill)
BEGIN
@@ -17574,7 +17574,7 @@ CALL sp32(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp33;
CREATE PROCEDURE sp33( f1 float(0))
BEGIN
@@ -17594,7 +17594,7 @@ CALL sp34(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp35;
CREATE PROCEDURE sp35( f1 float(0) unsigned zerofill)
BEGIN
@@ -17605,7 +17605,7 @@ CALL sp35(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp36;
CREATE PROCEDURE sp36( f1 float(0) zerofill)
BEGIN
@@ -17616,7 +17616,7 @@ CALL sp36(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp37;
CREATE PROCEDURE sp37( f1 float(23))
BEGIN
@@ -17636,7 +17636,7 @@ CALL sp38(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp39;
CREATE PROCEDURE sp39( f1 float(23) unsigned zerofill)
BEGIN
@@ -17647,7 +17647,7 @@ CALL sp39(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp40;
CREATE PROCEDURE sp40( f1 float(23) zerofill)
BEGIN
@@ -17658,7 +17658,7 @@ CALL sp40(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp41;
CREATE PROCEDURE sp41( f1 float(24))
BEGIN
@@ -17678,7 +17678,7 @@ CALL sp42(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp43;
CREATE PROCEDURE sp43( f1 float(24) unsigned zerofill)
BEGIN
@@ -17689,7 +17689,7 @@ CALL sp43(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp44;
CREATE PROCEDURE sp44( f1 float(24) zerofill)
BEGIN
@@ -17700,7 +17700,7 @@ CALL sp44(1.00e+00);
f1
000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp45;
CREATE PROCEDURE sp45( f1 float(53))
BEGIN
@@ -17720,7 +17720,7 @@ CALL sp46(1.00e+00);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp47;
CREATE PROCEDURE sp47( f1 float(53) unsigned zerofill)
BEGIN
@@ -17731,7 +17731,7 @@ CALL sp47(1.00e+00);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp48;
CREATE PROCEDURE sp48( f1 float(53) zerofill)
BEGIN
@@ -17742,7 +17742,7 @@ CALL sp48(1.00e+00);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp49;
CREATE PROCEDURE sp49( f1 int)
BEGIN
@@ -17753,8 +17753,8 @@ CALL sp49(-2.15e+09);
f1
-2147483638
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp50;
CREATE PROCEDURE sp50( f1 int unsigned)
BEGIN
@@ -17792,7 +17792,7 @@ CALL sp53(-8388600);
f1
-8388598
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp54;
CREATE PROCEDURE sp54( f1 mediumint unsigned)
BEGIN
@@ -17829,7 +17829,7 @@ CALL sp57(-999999999);
f1
-1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp58;
CREATE PROCEDURE sp58( f1 numeric (0))
BEGIN
@@ -17840,7 +17840,7 @@ CALL sp58(-999999999);
f1
-1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp59;
CREATE PROCEDURE sp59( f1 numeric (0) unsigned)
BEGIN
@@ -17851,7 +17851,7 @@ CALL sp59(9999999999);
f1
9999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp60;
CREATE PROCEDURE sp60( f1 numeric (0) unsigned zerofill)
BEGIN
@@ -17862,7 +17862,7 @@ CALL sp60(99999999);
f1
0100000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp61;
CREATE PROCEDURE sp61( f1 numeric (0) zerofill)
BEGIN
@@ -17873,8 +17873,8 @@ CALL sp61(-99999999);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp62;
CREATE PROCEDURE sp62( f1 numeric (0, 0))
BEGIN
@@ -17885,7 +17885,7 @@ CALL sp62(-999999999);
f1
-1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp63;
CREATE PROCEDURE sp63( f1 numeric (0, 0) unsigned)
BEGIN
@@ -17896,7 +17896,7 @@ CALL sp63(9999999999);
f1
9999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp64;
CREATE PROCEDURE sp64( f1 numeric (0, 0) unsigned zerofill)
BEGIN
@@ -17907,7 +17907,7 @@ CALL sp64(99999999);
f1
0100000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp65;
CREATE PROCEDURE sp65( f1 numeric (0, 0) zerofill)
BEGIN
@@ -17918,8 +17918,8 @@ CALL sp65(-99999999);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp66_n;
CREATE PROCEDURE sp66_n( f1 numeric (63, 30))
BEGIN
@@ -17930,14 +17930,14 @@ CALL sp66_n(-1e+36);
f1
-999999999999999999999999999999989.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
CALL sp66_n( -1000000000000000000000000000000000000 );
f1
-999999999999999999999999999999989.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp67_nu;
CREATE PROCEDURE sp67_nu( f1 numeric (63, 30) unsigned)
BEGIN
@@ -17948,14 +17948,14 @@ CALL sp67_nu(1e+36);
f1
999999999999999999999999999999999.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
CALL sp67_nu( 1000000000000000000000000000000000000 );
f1
999999999999999999999999999999999.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp68_nuz;
CREATE PROCEDURE sp68_nuz( f1 numeric (63, 30) unsigned zerofill)
BEGIN
@@ -17966,14 +17966,14 @@ CALL sp68_nuz(1e+36);
f1
999999999999999999999999999999999.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
CALL sp68_nuz( 1000000000000000000000000000000000000 );
f1
999999999999999999999999999999999.999999999999999999999999999999
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp69_n_z;
CREATE PROCEDURE sp69_n_z( f1 numeric (63, 30) zerofill)
BEGIN
@@ -17984,14 +17984,14 @@ CALL sp69_n_z(-1e+36);
f1
000000000000000000000000000000010.000000000000000000000000000000
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
CALL sp69_n_z( -1000000000000000000000000000000000000 );
f1
000000000000000000000000000000010.000000000000000000000000000000
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp70_n;
CREATE PROCEDURE sp70_n( f1 numeric (64))
BEGIN
@@ -18050,7 +18050,7 @@ CALL sp74(999999999);
f1
1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp75;
CREATE PROCEDURE sp75( f1 numeric unsigned zerofill)
BEGIN
@@ -18061,7 +18061,7 @@ CALL sp75(999999999);
f1
1000000000
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Note 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp76;
CREATE PROCEDURE sp76( f1 numeric zerofill)
BEGIN
@@ -18072,8 +18072,8 @@ CALL sp76(-999999999);
f1
0000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp77;
CREATE PROCEDURE sp77( f1 real)
BEGIN
@@ -18093,7 +18093,7 @@ CALL sp78(1.1);
f1
10
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp79;
CREATE PROCEDURE sp79( f1 real unsigned zerofill)
BEGIN
@@ -18104,7 +18104,7 @@ CALL sp79(1.1);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp80;
CREATE PROCEDURE sp80( f1 real zerofill)
BEGIN
@@ -18115,7 +18115,7 @@ CALL sp80(1.1);
f1
0000000000000000000010
Warnings:
-Warning 1264 Out of range value for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp81;
CREATE PROCEDURE sp81( f1 smallint)
BEGIN
@@ -18235,7 +18235,7 @@ CALL sp94( 'h');
f1
a
Warnings:
-Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp95;
CREATE PROCEDURE sp95( f1 char ascii)
BEGIN
@@ -18246,7 +18246,7 @@ CALL sp95( 'h');
f1
a
Warnings:
-Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp96;
CREATE PROCEDURE sp96( f1 char binary)
BEGIN
@@ -18257,7 +18257,7 @@ CALL sp96( 'h');
f1
a
Warnings:
-Warning 1265 Data truncated for column 'f1' at row 1
+Warning 1265 Data truncated for column 'f1' at row 0
DROP PROCEDURE IF EXISTS sp97;
CREATE PROCEDURE sp97( f1 longtext)
BEGIN
@@ -18358,7 +18358,7 @@ CALL sp107(2.00e+13);
f1
returned
Warnings:
-returned 1265 Data truncated for column 'f1' at row 1
+returned 1265 Data truncated for column 'f1' at row 0
USE db_storedproc;
DROP DATABASE db1;
DROP DATABASE IF EXISTS db1;
diff --git a/mysql-test/suite/galera/include/have_wsrep_replicate_myisam.inc b/mysql-test/suite/galera/include/have_wsrep_replicate_myisam.inc
deleted file mode 100644
index 726fc6e2b18..00000000000
--- a/mysql-test/suite/galera/include/have_wsrep_replicate_myisam.inc
+++ /dev/null
@@ -1,4 +0,0 @@
---require suite/galera/r/have_wsrep_replicate_myisam.require
-disable_query_log;
-SHOW VARIABLES LIKE 'wsrep_replicate_myisam';
-enable_query_log;
diff --git a/mysql-test/suite/galera/r/MDEV-27001.result b/mysql-test/suite/galera/r/MDEV-27001.result
new file mode 100644
index 00000000000..f2dc6a9a937
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27001.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t3 (c INT) PARTITION BY RANGE (c) (PARTITION p1 VALUES LESS THAN (1000));
+CREATE TABLE tp2 (c INT);
+ALTER TABLE t3 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN (2000);
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/MW-416.result b/mysql-test/suite/galera/r/MW-416.result
index ae95b832802..98a72c8d46b 100644
--- a/mysql-test/suite/galera/r/MW-416.result
+++ b/mysql-test/suite/galera/r/MW-416.result
@@ -10,16 +10,12 @@ ALTER EVENT ev1 RENAME TO ev2;
ERROR 42000: Access denied for user 'userMW416'@'localhost' to database 'test'
ALTER FUNCTION fun1 COMMENT 'foo';
ERROR 42000: alter routine command denied to user 'userMW416'@'localhost' for routine 'test.fun1'
-ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB;
-Got one of the listed errors
ALTER PROCEDURE proc1 COMMENT 'foo';
Got one of the listed errors
ALTER SERVER srv OPTIONS (USER 'sally');
Got one of the listed errors
ALTER TABLE tbl DROP COLUMN col;
Got one of the listed errors
-ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb;
-Got one of the listed errors
ALTER VIEW vw AS SELECT 1;
Got one of the listed errors
CREATE DATABASE db;
@@ -34,14 +30,10 @@ CREATE PROCEDURE proc1() BEGIN END;
Got one of the listed errors
CREATE INDEX idx ON tbl(id);
Got one of the listed errors
-CREATE LOGFILE GROUP lfg ADD UNDOFILE 'undofile' ENGINE innodb;
-Got one of the listed errors
CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user');
Got one of the listed errors
CREATE TABLE t (i int);
Got one of the listed errors
-CREATE TABLESPACE tblspc ADD DATAFILE 'file' ENGINE=innodb;
-Got one of the listed errors
CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END;
Got one of the listed errors
CREATE VIEW vw AS SELECT 1;
@@ -54,16 +46,12 @@ DROP FUNCTION fun1;
Got one of the listed errors
DROP INDEX idx ON t0;
Got one of the listed errors
-DROP LOGFILE GROUP lfg;
-Got one of the listed errors
DROP PROCEDURE proc1;
Got one of the listed errors
DROP SERVEr srv;
Got one of the listed errors
DROP TABLE t0;
Got one of the listed errors
-DROP TABLESPACE tblspc;
-Got one of the listed errors
DROP TRIGGER trg;
Got one of the listed errors
DROP VIEW vw;
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index bc9927b21d9..d6bbcbae680 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -1,9 +1,9 @@
connection node_2;
connection node_1;
# Correct Galera library found
-SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
-expect 51
-51
+SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+expect 50
+49
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
@@ -47,7 +47,6 @@ WSREP_ON ON
WSREP_OSU_METHOD TOI
WSREP_RECOVER OFF
WSREP_REJECT_QUERIES NONE
-WSREP_REPLICATE_MYISAM OFF
WSREP_RESTART_SLAVE OFF
WSREP_RETRY_AUTOCOMMIT 1
WSREP_SLAVE_FK_CHECKS ON
@@ -58,7 +57,6 @@ WSREP_SST_AUTH
WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
-WSREP_STRICT_DDL OFF
WSREP_SYNC_WAIT 15
WSREP_TRX_FRAGMENT_SIZE 0
WSREP_TRX_FRAGMENT_UNIT bytes
diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result
index 04f68c29305..6afcda47a23 100644
--- a/mysql-test/suite/galera/r/galera_myisam_transactions.result
+++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result
@@ -38,9 +38,7 @@ COUNT(*) = 0
1
DROP TABLE t1, t2, t3;
SET SESSION lock_wait_timeout=2;
-SET GLOBAL wsrep_replicate_myisam= ON;
-Warnings:
-Warning 1287 '@@wsrep_replicate_myisam' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=REPLICATE_MYISAM' instead
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM;
Warnings:
Warning 1280 Name 'pk' ignored for PRIMARY key.
@@ -49,6 +47,4 @@ INSERT INTO t1 VALUES(4);
DEALLOCATE PREPARE stmt;
COMMIT;
DROP TABLE t1;
-SET GLOBAL wsrep_replicate_myisam=OFF;
-Warnings:
-Warning 1287 '@@wsrep_replicate_myisam' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=REPLICATE_MYISAM' instead
+SET GLOBAL wsrep_mode = DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
index 48625b3ba4a..a15b0c7df69 100644
--- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
@@ -10,31 +10,31 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
connection node_2a;
SET SESSION wsrep_sync_wait=0;
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%';
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification');
+EXPECT_1
1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
-COUNT(*) = 1
-1
-SELECT COUNT(*) = 0 FROM t1;
-COUNT(*) = 0
-1
-SELECT COUNT(*) = 0 FROM t2;
-COUNT(*) = 0
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
+EXPECT_1
1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
connection node_2;
UNLOCK TABLES;
connection node_2a;
SET SESSION wsrep_sync_wait = 15;;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
-SELECT COUNT(*) = 1 FROM t2;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%';
-COUNT(*) = 2
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
1
+SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification');
+EXPECT_2
+2
SET GLOBAL wsrep_slave_threads = 1;;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_strict_ddl.result b/mysql-test/suite/galera/r/galera_var_wsrep_strict_ddl.result
deleted file mode 100644
index d53708b3504..00000000000
--- a/mysql-test/suite/galera/r/galera_var_wsrep_strict_ddl.result
+++ /dev/null
@@ -1,26 +0,0 @@
-connection node_2;
-connection node_1;
-SELECT @@global.wsrep_mode;
-@@global.wsrep_mode
-
-SELECT @@global.wsrep_strict_ddl;
-@@global.wsrep_strict_ddl
-0
-SET @@global.wsrep_strict_ddl=ON;
-Warnings:
-Warning 1287 '@@wsrep_strict_ddl' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=STRICT_REPLICATION' instead
-SELECT @@global.wsrep_mode;
-@@global.wsrep_mode
-STRICT_REPLICATION
-SELECT @@global.wsrep_strict_ddl;
-@@global.wsrep_strict_ddl
-1
-SET @@global.wsrep_strict_ddl=OFF;
-Warnings:
-Warning 1287 '@@wsrep_strict_ddl' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=STRICT_REPLICATION' instead
-SELECT @@global.wsrep_mode;
-@@global.wsrep_mode
-
-SELECT @@global.wsrep_strict_ddl;
-@@global.wsrep_strict_ddl
-0
diff --git a/mysql-test/suite/galera/t/MDEV-27001.opt b/mysql-test/suite/galera/t/MDEV-27001.opt
new file mode 100644
index 00000000000..c62d74cb249
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-27001.opt
@@ -0,0 +1 @@
+--partition=ON \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/MDEV-27001.test b/mysql-test/suite/galera/t/MDEV-27001.test
new file mode 100644
index 00000000000..fb5f57f53e5
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-27001.test
@@ -0,0 +1,7 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t3 (c INT) PARTITION BY RANGE (c) (PARTITION p1 VALUES LESS THAN (1000));
+CREATE TABLE tp2 (c INT);
+ALTER TABLE t3 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN (2000);
+DROP TABLE t3; \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test
index f9a1b47e2ff..f86ffcbf512 100644
--- a/mysql-test/suite/galera/t/MW-416.test
+++ b/mysql-test/suite/galera/t/MW-416.test
@@ -19,16 +19,12 @@ ALTER EVENT ev1 RENAME TO ev2;
ALTER FUNCTION fun1 COMMENT 'foo';
#--error 1044,1227
#ALTER INSTANCE ROTATE INNODB MASTER KEY;
---error 1044,1227
-ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB;
--error 1044,1227,1370
ALTER PROCEDURE proc1 COMMENT 'foo';
--error 1044,1227,1370
ALTER SERVER srv OPTIONS (USER 'sally');
--error 1044,1142,1227,1370
ALTER TABLE tbl DROP COLUMN col;
---error 1044,1227,1370
-ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb;
--error 1044,1142,1227,1370
ALTER VIEW vw AS SELECT 1;
@@ -45,14 +41,10 @@ CREATE PROCEDURE proc1() BEGIN END;
--error 1044,1142,1227,1370
CREATE INDEX idx ON tbl(id);
--error 1044,1142,1227,1370
-CREATE LOGFILE GROUP lfg ADD UNDOFILE 'undofile' ENGINE innodb;
---error 1044,1142,1227,1370
CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user');
--error 1044,1142,1227,1370
CREATE TABLE t (i int);
--error 1044,1142,1227,1370
-CREATE TABLESPACE tblspc ADD DATAFILE 'file' ENGINE=innodb;
---error 1044,1142,1227,1370
CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END;
--error 1044,1142,1227,1370
CREATE VIEW vw AS SELECT 1;
@@ -67,16 +59,12 @@ DROP EVENT ev;
DROP FUNCTION fun1;
--error 1044,1142,1227,1370
DROP INDEX idx ON t0;
---error 1044,1142,1227,1370,1064
-DROP LOGFILE GROUP lfg;
--error 1044,1142,1227,1370
DROP PROCEDURE proc1;
--error 1044,1142,1227,1370
DROP SERVEr srv;
--error 1044,1142,1227,1370
DROP TABLE t0;
---error 1044,1142,1227,1370,1064
-DROP TABLESPACE tblspc;
--error 1044,1142,1227,1360,1370
DROP TRIGGER trg;
--error 1044,1142,1227,1370
diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test
index 31d76816355..20ce6036d0d 100644
--- a/mysql-test/suite/galera/t/galera_backup_stage.test
+++ b/mysql-test/suite/galera/t/galera_backup_stage.test
@@ -56,7 +56,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10));
# reach commit stage. In the unlikely case the interleaving is different, the
# result of the test should not change.
--connection node_1c
---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE State='Commit' AND ID=$insert_id
+--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id
--source include/wait_condition.inc
@@ -83,11 +83,11 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10));
# wait for insert to get blocked
--connection node_1c
---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE State='Commit' AND ID=$insert_id
+--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id
--source include/wait_condition.inc
---let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND State = 'Commit'
+--let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State = 'Commit' OR State='Waiting for certification')
--source include/wait_condition.inc
# nothing after BLOCK_DDL is applied
diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test
index 96389e44d3f..6b76473d6a6 100644
--- a/mysql-test/suite/galera/t/galera_defaults.test
+++ b/mysql-test/suite/galera/t/galera_defaults.test
@@ -18,7 +18,7 @@ source ../wsrep/include/check_galera_version.inc;
# Global Variables
-SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
diff --git a/mysql-test/suite/galera/t/galera_myisam_transactions.test b/mysql-test/suite/galera/t/galera_myisam_transactions.test
index 30677ddbe4d..808aebdcbe4 100644
--- a/mysql-test/suite/galera/t/galera_myisam_transactions.test
+++ b/mysql-test/suite/galera/t/galera_myisam_transactions.test
@@ -39,11 +39,11 @@ DROP TABLE t1, t2, t3;
# MDEV-25201 : Assertion `thd->wsrep_trx_meta.gtid.seqno == (-1)' failed in int wsrep_to_isolation_begin(THD*, const char*, const char*, const TABLE_LIST*, Alter_info*)
#
SET SESSION lock_wait_timeout=2;
-SET GLOBAL wsrep_replicate_myisam= ON;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM;
PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y";
INSERT INTO t1 VALUES(4);
DEALLOCATE PREPARE stmt;
COMMIT;
DROP TABLE t1;
-SET GLOBAL wsrep_replicate_myisam=OFF;
+SET GLOBAL wsrep_mode = DEFAULT;
diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
index 5a33c16c86e..2e9f05cb4af 100644
--- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
+++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test
@@ -32,19 +32,19 @@ INSERT INTO t2 VALUES (1);
--connection node_2a
--sleep 1
SET SESSION wsrep_sync_wait=0;
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%';
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
-SELECT COUNT(*) = 0 FROM t1;
-SELECT COUNT(*) = 0 FROM t2;
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification');
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
--connection node_2
UNLOCK TABLES;
--connection node_2a
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig;
-SELECT COUNT(*) = 1 FROM t1;
-SELECT COUNT(*) = 1 FROM t2;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%';
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification');
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test b/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test
deleted file mode 100644
index 2aa76d46f82..00000000000
--- a/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test
+++ /dev/null
@@ -1,13 +0,0 @@
---source include/galera_cluster.inc
-
-SELECT @@global.wsrep_mode;
-SELECT @@global.wsrep_strict_ddl;
-
-SET @@global.wsrep_strict_ddl=ON;
-SELECT @@global.wsrep_mode;
-SELECT @@global.wsrep_strict_ddl;
-
-SET @@global.wsrep_strict_ddl=OFF;
-SELECT @@global.wsrep_mode;
-SELECT @@global.wsrep_strict_ddl;
-
diff --git a/mysql-test/suite/galera_3nodes/r/GCF-363.result b/mysql-test/suite/galera_3nodes/r/GCF-363.result
index d7078227ec3..fb235aceb77 100644
--- a/mysql-test/suite/galera_3nodes/r/GCF-363.result
+++ b/mysql-test/suite/galera_3nodes/r/GCF-363.result
@@ -1,8 +1,9 @@
connection node_2;
connection node_1;
-connection node_1;
+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 PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
SET GLOBAL wsrep_on=OFF;
@@ -12,7 +13,6 @@ 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;
diff --git a/mysql-test/suite/galera_3nodes/t/GCF-363.test b/mysql-test/suite/galera_3nodes/t/GCF-363.test
index 5867247e6ee..17c510e7c9c 100644
--- a/mysql-test/suite/galera_3nodes/t/GCF-363.test
+++ b/mysql-test/suite/galera_3nodes/t/GCF-363.test
@@ -5,10 +5,12 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
---connection node_1
+--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
@@ -26,7 +28,6 @@ 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;
@@ -72,4 +73,3 @@ CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
--connection node_1
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
-
diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
index 31923f25f01..646dc1abc7b 100644
--- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
+++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
@@ -150,7 +150,7 @@ drop table t2;
--echo FK options
create table t1(a int, b int as (a % 2), c int as (a) stored);
create table t2 (a int);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 add constraint foreign key fk(d) references t2(a);
if ($support_virtual_foreign)
{
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index 06c2553a93c..0228f9be842 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -695,7 +695,7 @@ a b c
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t ADD UNIQUE INDEX (c(1));
Warnings:
-Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'b' at row 0
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result
index b0c29da2f22..52203c0610c 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_index.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result
@@ -284,7 +284,7 @@ INSERT IGNORE INTO t1 (id, a) VALUES (NULL, -1);
Warnings:
Warning 1264 Out of range value for column 'va' at row 1
ALTER TABLE t1 FORCE;
-ERROR 22003: Out of range value for column 'va' at row 1
+ERROR 22003: Out of range value for column 'va' at row 0
DROP TABLE t1;
#
# MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed
diff --git a/mysql-test/suite/innodb/include/have_innodb_bzip2.opt b/mysql-test/suite/innodb/include/have_innodb_bzip2.opt
new file mode 100644
index 00000000000..64680f7b988
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_bzip2.opt
@@ -0,0 +1 @@
+--plugin-load-add=$PROVIDER_BZIP2_SO
diff --git a/mysql-test/suite/innodb/include/have_innodb_lz4.opt b/mysql-test/suite/innodb/include/have_innodb_lz4.opt
new file mode 100644
index 00000000000..eac86deee3a
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_lz4.opt
@@ -0,0 +1,2 @@
+--plugin-load-add=$PROVIDER_LZ4_SO
+
diff --git a/mysql-test/suite/innodb/include/have_innodb_lzma.opt b/mysql-test/suite/innodb/include/have_innodb_lzma.opt
new file mode 100644
index 00000000000..ecb6bd7a614
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_lzma.opt
@@ -0,0 +1,2 @@
+--plugin-load-add=$PROVIDER_LZMA_SO
+
diff --git a/mysql-test/suite/innodb/include/have_innodb_lzo.opt b/mysql-test/suite/innodb/include/have_innodb_lzo.opt
new file mode 100644
index 00000000000..6033fc5d81c
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_lzo.opt
@@ -0,0 +1,2 @@
+--plugin-load-add=$PROVIDER_LZO_SO
+
diff --git a/mysql-test/suite/innodb/include/have_innodb_snappy.opt b/mysql-test/suite/innodb/include/have_innodb_snappy.opt
new file mode 100644
index 00000000000..80c3325a6aa
--- /dev/null
+++ b/mysql-test/suite/innodb/include/have_innodb_snappy.opt
@@ -0,0 +1,2 @@
+--plugin-load-add=$PROVIDER_SNAPPY_SO
+
diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result
index 36b582c6d76..0283d1079e1 100644
--- a/mysql-test/suite/innodb/r/alter_kill.result
+++ b/mysql-test/suite/innodb/r/alter_kill.result
@@ -17,7 +17,7 @@ disconnect con1;
SELECT COUNT(*) FROM bug16720368;
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368 VALUES(1);
-ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
+ERROR HY000: Table test/bug16720368 is corrupted. Please drop the table and recreate.
INSERT INTO bug16720368_1 VALUES(1);
# Shut down the server to uncorrupt the data.
# restart
diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff
new file mode 100644
index 00000000000..b729890c354
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lz4.rdiff
@@ -0,0 +1,19 @@
+--- suite/innodb/r/compression_providers_loaded.result
++++ suite/innodb/r/compression_providers_loaded.reject
+@@ -1,10 +1,10 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lz4
+ #
+-# Innodb_have_bzip2 reflects that the provider is loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lz4 reflects that the provider is loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lz4";
+ Variable_name Value
+-Innodb_have_bzip2 ON
+-# Innodb_compression_algorithm can be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
++Innodb_have_lz4 ON
++# Innodb_compression_algorithm can be set to lz4
++SET GLOBAL Innodb_compression_algorithm = lz4;
+ SET GLOBAL Innodb_compression_algorithm = zlib;
diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff
new file mode 100644
index 00000000000..caba4283977
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lzma.rdiff
@@ -0,0 +1,19 @@
+--- suite/innodb/r/compression_providers_loaded.result
++++ suite/innodb/r/compression_providers_loaded.reject
+@@ -1,10 +1,10 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lzma
+ #
+-# Innodb_have_bzip2 reflects that the provider is loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lzma reflects that the provider is loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzma";
+ Variable_name Value
+-Innodb_have_bzip2 ON
+-# Innodb_compression_algorithm can be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
++Innodb_have_lzma ON
++# Innodb_compression_algorithm can be set to lzma
++SET GLOBAL Innodb_compression_algorithm = lzma;
+ SET GLOBAL Innodb_compression_algorithm = zlib;
diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff
new file mode 100644
index 00000000000..8a1a5403fc2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_loaded,lzo.rdiff
@@ -0,0 +1,19 @@
+--- suite/innodb/r/compression_providers_loaded.result
++++ suite/innodb/r/compression_providers_loaded.reject
+@@ -1,10 +1,10 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lzo
+ #
+-# Innodb_have_bzip2 reflects that the provider is loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lzo reflects that the provider is loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzo";
+ Variable_name Value
+-Innodb_have_bzip2 ON
+-# Innodb_compression_algorithm can be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
++Innodb_have_lzo ON
++# Innodb_compression_algorithm can be set to lzo
++SET GLOBAL Innodb_compression_algorithm = lzo;
+ SET GLOBAL Innodb_compression_algorithm = zlib;
diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff b/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff
new file mode 100644
index 00000000000..4a1261d45d2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_loaded,snappy.rdiff
@@ -0,0 +1,19 @@
+--- suite/innodb/r/compression_providers_loaded.result
++++ suite/innodb/r/compression_providers_loaded.reject
+@@ -1,10 +1,10 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: snappy
+ #
+-# Innodb_have_bzip2 reflects that the provider is loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_snappy reflects that the provider is loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_snappy";
+ Variable_name Value
+-Innodb_have_bzip2 ON
+-# Innodb_compression_algorithm can be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
++Innodb_have_snappy ON
++# Innodb_compression_algorithm can be set to snappy
++SET GLOBAL Innodb_compression_algorithm = snappy;
+ SET GLOBAL Innodb_compression_algorithm = zlib;
diff --git a/mysql-test/suite/innodb/r/compression_providers_loaded.result b/mysql-test/suite/innodb/r/compression_providers_loaded.result
new file mode 100644
index 00000000000..2d1700c2ae2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_loaded.result
@@ -0,0 +1,10 @@
+#
+# Testing unloaded compression provider: bzip2
+#
+# Innodb_have_bzip2 reflects that the provider is loaded
+SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
+Variable_name Value
+Innodb_have_bzip2 ON
+# Innodb_compression_algorithm can be set to bzip2
+SET GLOBAL Innodb_compression_algorithm = bzip2;
+SET GLOBAL Innodb_compression_algorithm = zlib;
diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff
new file mode 100644
index 00000000000..e849fb5c474
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lz4.rdiff
@@ -0,0 +1,26 @@
+--- suite/innodb/r/compression_providers_unloaded.result
++++ suite/innodb/r/compression_providers_unloaded.reject
+@@ -1,14 +1,14 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lz4
+ #
+-# Innodb_have_bzip2 reflects that the provider is not loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lz4 reflects that the provider is not loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lz4";
+ Variable_name Value
+-Innodb_have_bzip2 OFF
+-# Innodb_compression_algorithm cannot be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
+-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Innodb_have_lz4 OFF
++# Innodb_compression_algorithm cannot be set to lz4
++SET GLOBAL Innodb_compression_algorithm = lz4;
++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lz4'
+ show warnings;
+ Level Code Message
+-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin.
+-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Warning 138 InnoDB: compression algorithm lz4 (2) is not available. Please, load the corresponding provider plugin.
++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lz4'
diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff
new file mode 100644
index 00000000000..466fb37c3fb
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzma.rdiff
@@ -0,0 +1,26 @@
+--- suite/innodb/r/compression_providers_unloaded.result
++++ suite/innodb/r/compression_providers_unloaded.reject
+@@ -1,14 +1,14 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lzma
+ #
+-# Innodb_have_bzip2 reflects that the provider is not loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lzma reflects that the provider is not loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzma";
+ Variable_name Value
+-Innodb_have_bzip2 OFF
+-# Innodb_compression_algorithm cannot be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
+-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Innodb_have_lzma OFF
++# Innodb_compression_algorithm cannot be set to lzma
++SET GLOBAL Innodb_compression_algorithm = lzma;
++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lzma'
+ show warnings;
+ Level Code Message
+-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin.
+-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Warning 138 InnoDB: compression algorithm lzma (4) is not available. Please, load the corresponding provider plugin.
++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lzma'
diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff
new file mode 100644
index 00000000000..dec0becf71e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,lzo.rdiff
@@ -0,0 +1,26 @@
+--- suite/innodb/r/compression_providers_unloaded.result
++++ suite/innodb/r/compression_providers_unloaded.reject
+@@ -1,14 +1,14 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: lzo
+ #
+-# Innodb_have_bzip2 reflects that the provider is not loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_lzo reflects that the provider is not loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_lzo";
+ Variable_name Value
+-Innodb_have_bzip2 OFF
+-# Innodb_compression_algorithm cannot be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
+-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Innodb_have_lzo OFF
++# Innodb_compression_algorithm cannot be set to lzo
++SET GLOBAL Innodb_compression_algorithm = lzo;
++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lzo'
+ show warnings;
+ Level Code Message
+-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin.
+-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Warning 138 InnoDB: compression algorithm lzo (3) is not available. Please, load the corresponding provider plugin.
++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'lzo'
diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff b/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff
new file mode 100644
index 00000000000..273ff4e2131
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_unloaded,snappy.rdiff
@@ -0,0 +1,26 @@
+--- suite/innodb/r/compression_providers_unloaded.result
++++ suite/innodb/r/compression_providers_unloaded.reject
+@@ -1,14 +1,14 @@
+ #
+-# Testing unloaded compression provider: bzip2
++# Testing unloaded compression provider: snappy
+ #
+-# Innodb_have_bzip2 reflects that the provider is not loaded
+-SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
++# Innodb_have_snappy reflects that the provider is not loaded
++SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_snappy";
+ Variable_name Value
+-Innodb_have_bzip2 OFF
+-# Innodb_compression_algorithm cannot be set to bzip2
+-SET GLOBAL Innodb_compression_algorithm = bzip2;
+-ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Innodb_have_snappy OFF
++# Innodb_compression_algorithm cannot be set to snappy
++SET GLOBAL Innodb_compression_algorithm = snappy;
++ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'snappy'
+ show warnings;
+ Level Code Message
+-Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin.
+-Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
++Warning 138 InnoDB: compression algorithm snappy (6) is not available. Please, load the corresponding provider plugin.
++Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'snappy'
diff --git a/mysql-test/suite/innodb/r/compression_providers_unloaded.result b/mysql-test/suite/innodb/r/compression_providers_unloaded.result
new file mode 100644
index 00000000000..d4ac9cdb41c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/compression_providers_unloaded.result
@@ -0,0 +1,14 @@
+#
+# Testing unloaded compression provider: bzip2
+#
+# Innodb_have_bzip2 reflects that the provider is not loaded
+SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_bzip2";
+Variable_name Value
+Innodb_have_bzip2 OFF
+# Innodb_compression_algorithm cannot be set to bzip2
+SET GLOBAL Innodb_compression_algorithm = bzip2;
+ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
+show warnings;
+Level Code Message
+Warning 138 InnoDB: compression algorithm bzip2 (5) is not available. Please, load the corresponding provider plugin.
+Error 1231 Variable 'innodb_compression_algorithm' can't be set to the value of 'bzip2'
diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
index 951233ced3c..d67dc8a63d8 100644
--- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
SELECT * FROM t2;
a
1
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index 5bcb7cf963f..16c33ee02a2 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -1068,7 +1068,7 @@ ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'b' at row 0
SELECT * FROM t1;
a b
10 10:20:30
diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
index 9e0dbf49931..6a57be49ac5 100644
--- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
+++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
@@ -42,7 +42,7 @@ drop table t1;
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
-ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 1
+ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 0
DESCRIBE t1;
Field Type Null Key Default Extra
a int(11) YES NULL
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index b00c80643c0..4c89ad4b9fb 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
create table t1 (pk integer primary key auto_increment, fl geometry not null);
insert into t1 (fl) values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
diff --git a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff
new file mode 100644
index 00000000000..9d40decbb30
--- /dev/null
+++ b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff
@@ -0,0 +1,9 @@
+@@ -377,8 +377,6 @@
+ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
+ SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
+ ALTER TABLE t1 FORCE;
+-Warnings:
+-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ INSERT IGNORE INTO t1 VALUES
+ (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
+ (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
diff --git a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff
new file mode 100644
index 00000000000..9d40decbb30
--- /dev/null
+++ b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff
@@ -0,0 +1,9 @@
+@@ -377,8 +377,6 @@
+ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
+ SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
+ ALTER TABLE t1 FORCE;
+-Warnings:
+-Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ INSERT IGNORE INTO t1 VALUES
+ (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
+ (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result
index be5082489f8..dd4451deaa2 100644
--- a/mysql-test/suite/innodb/r/insert_into_empty.result
+++ b/mysql-test/suite/innodb/r/insert_into_empty.result
@@ -190,8 +190,8 @@ CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB
STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
INSERT INTO t1 SELECT * FROM seq_1_to_4096;
# Wait till statistics update after bulk insert operation
-SELECT n_rows>=4096 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
-n_rows>=4096
+SELECT n_rows>=4000 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
+n_rows>=4000
1
DROP TABLE t1;
#
@@ -213,3 +213,178 @@ TABLE_ROWS AVG_ROW_LENGTH>0
3 1
DROP TABLE t1;
# End of 10.6 tests
+#
+# MDEV-26947 UNIQUE column checks fail in InnoDB resulting
+# in table corruption
+#
+CREATE TABLE t (c1 INT KEY,c2 INT UNIQUE) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t VALUES (1,0),(2,0);
+ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
+CHECK TABLE t;
+Table Op Msg_type Msg_text
+test.t check status OK
+COMMIT;
+DROP TABLE t;
+CREATE TABLE t (i INT UNIQUE)ENGINE=InnoDB;
+INSERT INTO t VALUES (0),(0);
+ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
+CHECK TABLE t;
+Table Op Msg_type Msg_text
+test.t check status OK
+DROP TABLE t;
+CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(1) UNIQUE)ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t VALUES(1, ''),(2, '');
+ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
+SELECT * FROM t;
+c c2
+DELETE FROM t;
+COMMIT;
+DROP TABLE t;
+#
+# MDEV-26956 LeakSanitizer/Valgrind errors in
+# trx_mod_table_time_t::start_bulk_insert
+# upon adding system versioning
+#
+CREATE TABLE t1(id INT, s DATE, e DATE, PERIOD FOR p(s,e),
+PRIMARY KEY(id, p WITHOUT OVERLAPS)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
+ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
+ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
+DROP TABLE t1;
+#
+# MDEV-27316 Assertion `!(index)->is_spatial()' failed.
+#
+CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
+INSERT INTO t VALUES (POINT(1, 1));
+SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
+COUNT(*)
+1
+DROP TABLE t;
+#
+# MDEV-27318 Assertion data_size < srv_sort_buf_size failed in row_merge_bulk_buf_add
+#
+CREATE TABLE t1(f1 MEDIUMTEXT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(REPEAT(1, 8459264));
+SELECT length(f1) FROM t1;
+length(f1)
+8459264
+DROP TABLE t1;
+#
+# MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init
+#
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+LOCK TABLES t1 WRITE,t2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DROP TABLE t2, t1;
+#
+# MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
+#
+CREATE TABLE t1(
+f1 SERIAL,
+f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'),
+SPATIAL INDEX(f2))ENGINE=InnoDB;
+INSERT INTO t1(f1) VALUES(0), (1), (2);
+ERROR 23000: Duplicate entry '1' for key 'f1'
+DROP TABLE t1;
+#
+# MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
+#
+CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0);
+ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
+DELETE FROM t1;
+DROP TABLE t1;
+#
+# MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned
+#
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT) ENGINE=InnoDB;
+CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET c=1;
+INSERT INTO t1 VALUES (0);
+SELECT * FROM t1;
+c
+0
+SELECT * FROM t2;
+c
+DROP TABLE t2, t1;
+#
+# MDEV-28242 Assertion `!check_foreigns' failed in
+# trx_t::check_bulk_buffer
+#
+CREATE TABLE t1 (c INT)ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES(1), (1);
+SET SESSION foreign_key_checks=TRUE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t2(d INT)ENGINE=InnoDB;
+DROP TABLE t2, t1;
+#
+# MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert
+#
+SET SESSION foreign_key_checks=0;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(2);
+ALTER TABLE t1 REBUILD PARTITION p0;
+DROP TABLE t1;
+#
+# MDEV-29570 InnoDB fails to clean bulk buffer when server
+# does rollback operation
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB
+PARTITION BY RANGE (pk) (
+PARTITION pn VALUES LESS THAN (20));
+INSERT INTO t1 VALUES (1),(21);
+ERROR HY000: Table has no partition for value 21
+DROP TABLE t1;
+#
+# MDEV-29761 Bulk insert fails to rollback
+# during insert..select
+#
+CREATE TABLE t1 (f1 INT)ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB;
+CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1);
+BEGIN;
+INSERT t1 SELECT 1 FROM seq_1_to_2;
+COMMIT;
+SELECT * FROM t1;
+f1
+SELECT * FROM t2;
+f1
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+CHECK TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+DROP TABLE t1, t2;
+#
+# MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk
+# insert operation
+#
+call mtr.add_suppression("InnoDB: Cannot add field `(c0[36]|c11)` in table");
+SET @format= @@innodb_default_row_format;
+CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
+c04 text, c05 text, c06 text, c07 text, c08 text,
+c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
+SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
+ALTER TABLE t1 FORCE;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+INSERT IGNORE INTO t1 VALUES
+(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
+(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
+# End of 10.7 tests
diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result
index 4a67e04205b..18680432c77 100644
--- a/mysql-test/suite/innodb/r/instant_alter.result
+++ b/mysql-test/suite/innodb/r/instant_alter.result
@@ -314,12 +314,12 @@ ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c7' at row 1
+Note 1265 Data truncated for column 'c7' at row 0
ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c8' at row 1
+Note 1265 Data truncated for column 'c8' at row 0
SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3;
id c2 c3 c4 c5 c6 c7 c8
1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01
@@ -1248,12 +1248,12 @@ ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c7' at row 1
+Note 1265 Data truncated for column 'c7' at row 0
ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c8' at row 1
+Note 1265 Data truncated for column 'c8' at row 0
SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3;
id c2 c3 c4 c5 c6 c7 c8
1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01
@@ -2182,12 +2182,12 @@ ALTER TABLE t3 ADD COLUMN c7 TIME NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c7' at row 1
+Note 1265 Data truncated for column 'c7' at row 0
ALTER TABLE t3 ADD COLUMN c8 DATE NOT NULL DEFAULT current_timestamp();
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1265 Data truncated for column 'c8' at row 1
+Note 1265 Data truncated for column 'c8' at row 0
SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3;
id c2 c3 c4 c5 c6 c7 c8
1 1 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01
diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test
index a371a77971d..277d9b4e71b 100644
--- a/mysql-test/suite/innodb/t/alter_kill.test
+++ b/mysql-test/suite/innodb/t/alter_kill.test
@@ -15,11 +15,10 @@ call mtr.add_suppression("InnoDB: Operating system error.*in a file operation");
call mtr.add_suppression("InnoDB: \(The error means\|If you are\)");
call mtr.add_suppression("InnoDB: Ignoring tablespace `test/bug16720368` because it could not be opened");
call mtr.add_suppression("InnoDB: Tablespace .* was not found at.*bug16735660");
-call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace.");
call mtr.add_suppression("InnoDB: Plugin initialization aborted*");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error.");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed.");
-call mtr.add_suppression("InnoDB: Table `test`\\.`bug16720368` is corrupted");
+call mtr.add_suppression("Table .*bug16720368.* is corrupted");
-- enable_query_log
-- echo #
@@ -79,7 +78,7 @@ EOF
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT COUNT(*) FROM bug16720368;
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
INSERT INTO bug16720368 VALUES(1);
INSERT INTO bug16720368_1 VALUES(1);
diff --git a/mysql-test/suite/innodb/t/compression_providers_loaded.combinations b/mysql-test/suite/innodb/t/compression_providers_loaded.combinations
new file mode 100644
index 00000000000..d2a413f3902
--- /dev/null
+++ b/mysql-test/suite/innodb/t/compression_providers_loaded.combinations
@@ -0,0 +1,19 @@
+[bzip2]
+innodb
+plugin-load-add=$PROVIDER_BZIP2_SO
+
+[lz4]
+innodb
+plugin-load-add=$PROVIDER_LZ4_SO
+
+[lzma]
+innodb
+plugin-load-add=$PROVIDER_LZMA_SO
+
+[lzo]
+innodb
+plugin-load-add=$PROVIDER_LZO_SO
+
+[snappy]
+innodb
+plugin-load-add=$PROVIDER_SNAPPY_SO
diff --git a/mysql-test/suite/innodb/t/compression_providers_loaded.test b/mysql-test/suite/innodb/t/compression_providers_loaded.test
new file mode 100644
index 00000000000..1b6c348ccfa
--- /dev/null
+++ b/mysql-test/suite/innodb/t/compression_providers_loaded.test
@@ -0,0 +1,18 @@
+let $alg = $MTR_COMBINATIONS;
+
+if (`SELECT COUNT(*) = 0 FROM information_schema.plugins WHERE plugin_name = "provider_$alg" AND plugin_status = "active"`)
+{
+ skip Needs provider_$alg plugin;
+}
+
+--echo #
+--echo # Testing unloaded compression provider: $alg
+--echo #
+
+--echo # Innodb_have_$alg reflects that the provider is loaded
+eval SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_$alg";
+
+--echo # Innodb_compression_algorithm can be set to $alg
+let $innodb_compression_algorithm_orig = `SELECT @@Innodb_compression_algorithm`;
+eval SET GLOBAL Innodb_compression_algorithm = $alg;
+eval SET GLOBAL Innodb_compression_algorithm = $innodb_compression_algorithm_orig;
diff --git a/mysql-test/suite/innodb/t/compression_providers_unloaded.combinations b/mysql-test/suite/innodb/t/compression_providers_unloaded.combinations
new file mode 100644
index 00000000000..20c49960390
--- /dev/null
+++ b/mysql-test/suite/innodb/t/compression_providers_unloaded.combinations
@@ -0,0 +1,14 @@
+[bzip2]
+innodb
+
+[lz4]
+innodb
+
+[lzma]
+innodb
+
+[lzo]
+innodb
+
+[snappy]
+innodb
diff --git a/mysql-test/suite/innodb/t/compression_providers_unloaded.test b/mysql-test/suite/innodb/t/compression_providers_unloaded.test
new file mode 100644
index 00000000000..84bcce59729
--- /dev/null
+++ b/mysql-test/suite/innodb/t/compression_providers_unloaded.test
@@ -0,0 +1,13 @@
+let $alg = $MTR_COMBINATIONS;
+
+--echo #
+--echo # Testing unloaded compression provider: $alg
+--echo #
+
+--echo # Innodb_have_$alg reflects that the provider is not loaded
+eval SHOW GLOBAL STATUS WHERE Variable_name = "Innodb_have_$alg";
+
+--echo # Innodb_compression_algorithm cannot be set to $alg
+error ER_WRONG_VALUE_FOR_VAR;
+eval SET GLOBAL Innodb_compression_algorithm = $alg;
+show warnings;
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
index 31d353efa38..f383d9ab9b8 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
@@ -7,7 +7,7 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted.");
call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page .*, page number=3\\]");
-call mtr.add_suppression("InnoDB: Table `test`.`t1` is corrupted. Please drop the table and recreate.");
+call mtr.add_suppression("Table test/t1 is corrupted. Please drop the table and recreate\\.");
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted");
call mtr.add_suppression("InnoDB: A long wait .* was observed for dict_sys");
--enable_query_log
@@ -59,7 +59,7 @@ SELECT * FROM t1;
let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc
---error ER_NO_SUCH_TABLE_IN_ENGINE
+--error ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index 60af7c9df80..78550763a9f 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -317,9 +317,9 @@ ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT,
ALGORITHM=COPY;
SHOW CREATE TABLE t1n;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1n;
diff --git a/mysql-test/suite/innodb/t/innodb-index-online-fk.test b/mysql-test/suite/innodb/t/innodb-index-online-fk.test
index 5c8954064ce..5423516c4b5 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online-fk.test
@@ -245,7 +245,7 @@ CREATE INDEX tb ON child(a2);
SET foreign_key_checks = 0;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE child CHANGE a2 a3 INT,
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
ON DELETE SET NULL ON UPDATE CASCADE,
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index 9350672bee9..c7aa6250da5 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -666,7 +666,7 @@ SET GLOBAL innodb_monitor_reset = module_ddl;
--echo # Skip sort
--echo # Change PK from (f1,f2,f5,f6) to (f1,f2,f5)
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column f6;
--enable_info
alter table t1 drop column f6, drop primary key, add primary key(f1,f2,f5);
@@ -692,7 +692,7 @@ SET GLOBAL innodb_monitor_reset = module_ddl;
--echo # Must sort
--echo # Change PK from (f1,f2,f5) to (f1,f5)
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column f2;
--enable_info
alter table t1 drop column f2, drop primary key, add primary key(f1,f5);
@@ -908,9 +908,9 @@ drop table t1;
create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column f1;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column f1, drop primary key;
# DROP PRIMARY KEY is implied for a single-column PRIMARY KEY
alter table t1 drop column f1, drop key f1;
@@ -1012,7 +1012,7 @@ drop table t1;
# pk(o1,o2,o3) to pk(o2,o3) by drop o1
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,2,2),(2,1,1);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop o1, lock=none;
alter table t1 drop o1, drop primary key, add primary key(o2,o3), lock=none;
drop table t1;
@@ -1020,7 +1020,7 @@ drop table t1;
# pk(o1,o2,o3) to pk(o1,o3) by drop o2
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(1,2,1);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop o2, lock=none;
alter table t1 drop o2, drop primary key, add primary key(o1,o3), lock=none;
drop table t1;
@@ -1028,7 +1028,7 @@ drop table t1;
# pk(o1,o2,o3) to pk(o3) by drop o1,o2
create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,2,2),(2,1,1);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop o1, drop o2, lock=none;
alter table t1 drop o1, drop o2,drop primary key,add primary key(o3),lock=none;
drop table t1;
@@ -1196,7 +1196,6 @@ DROP TABLE t;
--disable_query_log
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*t[12].ibd.");
-call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test
index 77b84fe79db..170ba5072f5 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online.test
+++ b/mysql-test/suite/innodb/t/innodb-table-online.test
@@ -313,7 +313,7 @@ SELECT
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
UPDATE t1 SET c3 = NULL WHERE c3 = '';
SET lock_wait_timeout = 1;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1 DROP COLUMN c22f, ADD PRIMARY KEY c3p5(c3(5));
# NULL -> NOT NULL is only allowed INPLACE without IGNORE.
# Adding a PRIMARY KEY will add NOT NULL implicitly!
diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
index 8f58bc6ce48..09c54db644f 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test
@@ -528,9 +528,9 @@ ALGORITHM=COPY;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t1n;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
diff --git a/mysql-test/suite/innodb/t/innodb_bug44571.test b/mysql-test/suite/innodb/t/innodb_bug44571.test
index e27ed0b9bf8..08f41ed8fd8 100644
--- a/mysql-test/suite/innodb/t/innodb_bug44571.test
+++ b/mysql-test/suite/innodb/t/innodb_bug44571.test
@@ -12,7 +12,7 @@ ALTER TABLE bug44571 CHANGE foo bar INT;
# because the CHANGE foo bar is successful. And
# the column name change would communicate to
# InnoDB with the fix from bug #47621
--- error ER_KEY_COLUMN_DOES_NOT_EXITS
+-- error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
# The following create indexes should succeed,
# indirectly confirm the CHANGE foo bar is successful.
diff --git a/mysql-test/suite/innodb/t/innodb_page_compressed.combinations b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
index f3caab14af3..498c85ee65c 100644
--- a/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
+++ b/mysql-test/suite/innodb/t/innodb_page_compressed.combinations
@@ -1,6 +1,11 @@
[bzip2]
+plugin-load-add=$PROVIDER_BZIP2_SO
[lz4]
+plugin-load-add=$PROVIDER_LZ4_SO
[lzma]
+plugin-load-add=$PROVIDER_LZMA_SO
[lzo]
+plugin-load-add=$PROVIDER_LZO_SO
[snappy]
+plugin-load-add=$PROVIDER_SNAPPY_SO
[zlib]
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index b545927d690..fab1b882868 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -206,7 +206,9 @@ INSERT INTO t1 SELECT * FROM seq_1_to_4096;
let $wait_condition= select n_rows > 100 from mysql.innodb_table_stats
where table_name="t1";
source include/wait_condition.inc;
-SELECT n_rows>=4096 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
+# At innodb_page_size=4k this will be only 4075, not 4096. Add some slack.
+# This is related to MDEV-24621 and possibly MDEV-26740.
+SELECT n_rows>=4000 FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
DROP TABLE t1;
@@ -233,3 +235,174 @@ DROP TABLE t1;
--echo # End of 10.6 tests
+
+--echo #
+--echo # MDEV-26947 UNIQUE column checks fail in InnoDB resulting
+--echo # in table corruption
+--echo #
+
+CREATE TABLE t (c1 INT KEY,c2 INT UNIQUE) ENGINE=InnoDB;
+BEGIN;
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t VALUES (1,0),(2,0);
+CHECK TABLE t;
+COMMIT;
+DROP TABLE t;
+
+CREATE TABLE t (i INT UNIQUE)ENGINE=InnoDB;
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t VALUES (0),(0);
+CHECK TABLE t;
+DROP TABLE t;
+
+CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(1) UNIQUE)ENGINE=InnoDB;
+BEGIN;
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t VALUES(1, ''),(2, '');
+SELECT * FROM t;
+DELETE FROM t;
+COMMIT;
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-26956 LeakSanitizer/Valgrind errors in
+--echo # trx_mod_table_time_t::start_bulk_insert
+--echo # upon adding system versioning
+--echo #
+CREATE TABLE t1(id INT, s DATE, e DATE, PERIOD FOR p(s,e),
+ PRIMARY KEY(id, p WITHOUT OVERLAPS)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
+ ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
+ ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-27316 Assertion `!(index)->is_spatial()' failed.
+--echo #
+CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
+INSERT INTO t VALUES (POINT(1, 1));
+SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-27318 Assertion data_size < srv_sort_buf_size failed in row_merge_bulk_buf_add
+--echo #
+CREATE TABLE t1(f1 MEDIUMTEXT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(REPEAT(1, 8459264));
+SELECT length(f1) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init
+--echo #
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+LOCK TABLES t1 WRITE,t2 WRITE;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
+--echo #
+CREATE TABLE t1(
+ f1 SERIAL,
+ f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'),
+SPATIAL INDEX(f2))ENGINE=InnoDB;
+--error ER_DUP_ENTRY
+INSERT INTO t1(f1) VALUES(0), (1), (2);
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
+--echo #
+CREATE TABLE t1 (c0 YEAR UNIQUE) ENGINE=InnoDB;
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(0),(0);
+DELETE FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned
+--echo #
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT) ENGINE=InnoDB;
+CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET c=1;
+INSERT INTO t1 VALUES (0);
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-28242 Assertion `!check_foreigns' failed in
+--echo # trx_t::check_bulk_buffer
+--echo #
+CREATE TABLE t1 (c INT)ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES(1), (1);
+SET SESSION foreign_key_checks=TRUE;
+SHOW CREATE TABLE t1;
+CREATE TABLE t2(d INT)ENGINE=InnoDB;
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert
+--echo #
+
+SET SESSION foreign_key_checks=0;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(2);
+ALTER TABLE t1 REBUILD PARTITION p0;
+# Cleanup
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-29570 InnoDB fails to clean bulk buffer when server
+--echo # does rollback operation
+--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB
+ PARTITION BY RANGE (pk) (
+ PARTITION pn VALUES LESS THAN (20));
+--error ER_NO_PARTITION_FOR_GIVEN_VALUE
+INSERT INTO t1 VALUES (1),(21);
+# Cleanup
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-29761 Bulk insert fails to rollback
+--echo # during insert..select
+--echo #
+CREATE TABLE t1 (f1 INT)ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB;
+CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1);
+BEGIN;
+INSERT t1 SELECT 1 FROM seq_1_to_2;
+COMMIT;
+SELECT * FROM t1;
+SELECT * FROM t2;
+CHECK TABLE t1;
+CHECK TABLE t2;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk
+--echo # insert operation
+--echo #
+call mtr.add_suppression("InnoDB: Cannot add field `(c0[36]|c11)` in table");
+
+SET @format= @@innodb_default_row_format;
+CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
+ c04 text, c05 text, c06 text, c07 text, c08 text,
+ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
+SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
+--replace_result 1982 8126 4030 8126
+ALTER TABLE t1 FORCE;
+INSERT IGNORE INTO t1 VALUES
+(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
+(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
+CHECK TABLE t1;
+DROP TABLE t1;
+SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
+
+--echo # End of 10.7 tests
diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test
index 333fefee507..6730ec9a3a2 100644
--- a/mysql-test/suite/innodb/t/log_corruption.test
+++ b/mysql-test/suite/innodb/t/log_corruption.test
@@ -17,7 +17,7 @@ call mtr.add_suppression("InnoDB: Log scan aborted at LSN");
call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\\r?$");
call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed");
call mtr.add_suppression("InnoDB: Decrypting checkpoint failed");
-call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfile0 to start up the database\\? Log sequence number in the ib_logfile0 is 1213964,");
+call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfile0 to start up the database\\? The checkpoint is 1213964,");
call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!");
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test
index 89fe04bcdfb..df5b3e9ef97 100644
--- a/mysql-test/suite/innodb/t/log_file_name.test
+++ b/mysql-test/suite/innodb/t/log_file_name.test
@@ -152,7 +152,6 @@ call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
# The following are for aborted startup without --innodb-force-recovery:
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
-call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd': I/O error");
call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9][0-9]*, page number=3\\] of corrupted file './test/t2\\.ibd'");
call mtr.add_suppression("InnoDB: Datafile '.*test.*ibd' is corrupted");
diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result
index c9864fad830..f05c7db24bd 100644
--- a/mysql-test/suite/innodb_gis/r/0.result
+++ b/mysql-test/suite/innodb_gis/r/0.result
@@ -452,9 +452,9 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
create table t1 (pk integer primary key auto_increment, fl geometry not null);
insert into t1 (fl) values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 (fl) values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index b40c24b8fc6..35711a63a8a 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -660,9 +660,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo))
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (ST_pointfromtext('point(1,1)'));
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 08632b67514..5365e7d0f8c 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -779,7 +779,7 @@ 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: 'LINESTRING(0 0,1 1)' for column `test`.`t1`.`p` at row 1
+ERROR 22007: Incorrect POINT value: 'LINESTRING(0 0,1 1)' for column `test`.`t1`.`p` at row 0
drop table t1;
SET timestamp=default;
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index 36711c39050..ca37674b05f 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -661,9 +661,9 @@ object_id ST_geometrytype(geo) ST_ISSIMPLE(GEO) ST_ASTEXT(ST_centroid(geo))
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values (1.11);
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (ST_pointfromtext('point(1,1)'));
diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test
index 950db360794..99651842795 100644
--- a/mysql-test/suite/innodb_gis/t/1.test
+++ b/mysql-test/suite/innodb_gis/t/1.test
@@ -387,9 +387,9 @@ t1 where object_id=85984;
drop table t1;
create table t1 (fl geometry not null);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test
index 966aea7bc77..b27e1852d6e 100644
--- a/mysql-test/suite/innodb_gis/t/gis.test
+++ b/mysql-test/suite/innodb_gis/t/gis.test
@@ -380,9 +380,9 @@ t1 where object_id=85984;
drop table t1;
create table t1 (fl geometry not null);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1);
---error 1416
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
diff --git a/mysql-test/suite/json/r/type_json.result b/mysql-test/suite/json/r/type_json.result
index b9b70f24190..333e933eda9 100644
--- a/mysql-test/suite/json/r/type_json.result
+++ b/mysql-test/suite/json/r/type_json.result
@@ -113,7 +113,7 @@ def COALESCE(c0, c6) 254 30 1 Y 0 39 8
COALESCE(c0, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c0, c7) 254 30 1 Y 0 39 8
+def COALESCE(c0, c7) 253 30 1 Y 0 39 8
COALESCE(c0, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -305,11 +305,11 @@ def COALESCE(c6, c6) 3 11 1 Y 32896 0 63
COALESCE(c6, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c6, c7) 254 11 1 Y 0 39 8
+def COALESCE(c6, c7) 253 11 1 Y 0 39 8
COALESCE(c6, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c0) 254 30 1 Y 0 39 8
+def COALESCE(c7, c0) 253 30 1 Y 0 39 8
COALESCE(c7, c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -333,11 +333,11 @@ def COALESCE(c7, c5) 251 4294967295 1 Y 0 39 8
COALESCE(c7, c5)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c6) 254 11 1 Y 0 39 8
+def COALESCE(c7, c6) 253 11 1 Y 0 39 8
COALESCE(c7, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c7) 254 1 1 Y 0 39 8
+def COALESCE(c7, c7) 253 1 1 Y 0 39 8
COALESCE(c7, c7)
1
CALL p1('t1', 'LEAST(colt1, colt2)');
@@ -370,7 +370,7 @@ def LEAST(c0, c6) 5 23 1 Y 32896 31 63
LEAST(c0, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c0, c7) 254 30 1 Y 0 39 8
+def LEAST(c0, c7) 253 30 1 Y 0 39 8
LEAST(c0, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -566,7 +566,7 @@ def LEAST(c6, c7) 5 17 1 Y 32896 0 63
LEAST(c6, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c7, c0) 254 30 1 Y 0 39 8
+def LEAST(c7, c0) 253 30 1 Y 0 39 8
LEAST(c7, c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -594,7 +594,7 @@ def LEAST(c7, c6) 5 17 1 Y 32896 0 63
LEAST(c7, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c7, c7) 254 1 1 Y 0 39 8
+def LEAST(c7, c7) 253 1 1 Y 0 39 8
LEAST(c7, c7)
1
CALL p1('t1', 'colt1+colt2');
@@ -884,7 +884,7 @@ def COALESCE(c0, c6) 254 30 1 Y 0 39 8
COALESCE(c0, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c0, c7) 254 30 1 Y 0 39 8
+def COALESCE(c0, c7) 253 30 1 Y 0 39 8
COALESCE(c0, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1076,11 +1076,11 @@ def COALESCE(c6, c6) 3 11 1 Y 32896 0 63
COALESCE(c6, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c6, c7) 254 11 1 Y 0 39 8
+def COALESCE(c6, c7) 253 11 1 Y 0 39 8
COALESCE(c6, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c0) 254 30 1 Y 0 39 8
+def COALESCE(c7, c0) 253 30 1 Y 0 39 8
COALESCE(c7, c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1104,11 +1104,11 @@ def COALESCE(c7, c5) 251 4294967295 1 Y 0 39 8
COALESCE(c7, c5)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c6) 254 11 1 Y 0 39 8
+def COALESCE(c7, c6) 253 11 1 Y 0 39 8
COALESCE(c7, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(c7, c7) 254 1 1 Y 0 39 8
+def COALESCE(c7, c7) 253 1 1 Y 0 39 8
COALESCE(c7, c7)
1
CALL p1('t1c', 'LEAST(colt1, colt2)');
@@ -1141,7 +1141,7 @@ def LEAST(c0, c6) 5 23 1 Y 32896 31 63
LEAST(c0, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c0, c7) 254 30 1 Y 0 39 8
+def LEAST(c0, c7) 253 30 1 Y 0 39 8
LEAST(c0, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1337,7 +1337,7 @@ def LEAST(c6, c7) 5 17 1 Y 32896 0 63
LEAST(c6, c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c7, c0) 254 30 1 Y 0 39 8
+def LEAST(c7, c0) 253 30 1 Y 0 39 8
LEAST(c7, c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1365,7 +1365,7 @@ def LEAST(c7, c6) 5 17 1 Y 32896 0 63
LEAST(c7, c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(c7, c7) 254 1 1 Y 0 39 8
+def LEAST(c7, c7) 253 1 1 Y 0 39 8
LEAST(c7, c7)
1
CALL p1('t1c', 'colt1+colt2');
@@ -1675,7 +1675,7 @@ def COALESCE(t1.c0, t2.c11) 254 30 1 Y 0 39 8
COALESCE(t1.c0, t2.c11)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c0, t2.c12) 254 30 1 Y 0 39 8
+def COALESCE(t1.c0, t2.c12) 253 30 1 Y 0 39 8
COALESCE(t1.c0, t2.c12)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -1987,11 +1987,11 @@ def COALESCE(t1.c6, t2.c11) 253 19 1 Y 0 39 8
COALESCE(t1.c6, t2.c11)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c6, t2.c12) 254 11 1 Y 0 39 8
+def COALESCE(t1.c6, t2.c12) 253 11 1 Y 0 39 8
COALESCE(t1.c6, t2.c12)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c0) 254 30 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c0) 253 30 1 Y 0 39 8
COALESCE(t1.c7, t2.c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -2015,31 +2015,31 @@ def COALESCE(t1.c7, t2.c5) 251 4294967295 1 Y 0 39 8
COALESCE(t1.c7, t2.c5)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c6) 254 11 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c6) 253 11 1 Y 0 39 8
COALESCE(t1.c7, t2.c6)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c7) 254 22 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c7) 253 22 1 Y 0 39 8
COALESCE(t1.c7, t2.c7)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c8) 254 12 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c8) 253 12 1 Y 0 39 8
COALESCE(t1.c7, t2.c8)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c9) 254 10 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c9) 253 10 1 Y 0 39 8
COALESCE(t1.c7, t2.c9)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c10) 254 10 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c10) 253 10 1 Y 0 39 8
COALESCE(t1.c7, t2.c10)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c11) 254 19 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c11) 253 19 1 Y 0 39 8
COALESCE(t1.c7, t2.c11)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(t1.c7, t2.c12) 254 1 1 Y 0 39 8
+def COALESCE(t1.c7, t2.c12) 253 1 1 Y 0 39 8
COALESCE(t1.c7, t2.c12)
1
CALL p2('LEAST(t1.colt1, t2.colt2)');
@@ -2092,7 +2092,7 @@ def LEAST(t1.c0, t2.c11) 12 26 26 Y 128 6 63
LEAST(t1.c0, t2.c11)
0000-00-00 00:00:00.000000
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(t1.c0, t2.c12) 254 30 1 Y 0 39 8
+def LEAST(t1.c0, t2.c12) 253 30 1 Y 0 39 8
LEAST(t1.c0, t2.c12)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -2408,7 +2408,7 @@ def LEAST(t1.c6, t2.c12) 5 17 1 Y 32896 0 63
LEAST(t1.c6, t2.c12)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(t1.c7, t2.c0) 254 30 1 Y 0 39 8
+def LEAST(t1.c7, t2.c0) 253 30 1 Y 0 39 8
LEAST(t1.c7, t2.c0)
1
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -2456,7 +2456,7 @@ def LEAST(t1.c7, t2.c11) 12 19 19 Y 128 0 63
LEAST(t1.c7, t2.c11)
0000-00-00 00:00:00
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LEAST(t1.c7, t2.c12) 254 1 1 Y 0 39 8
+def LEAST(t1.c7, t2.c12) 253 1 1 Y 0 39 8
LEAST(t1.c7, t2.c12)
1
CALL p2('t1.colt1+t2.colt2');
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded,lz4.rdiff b/mysql-test/suite/mariabackup/compression_providers_loaded,lz4.rdiff
new file mode 100644
index 00000000000..2202a51119e
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded,lz4.rdiff
@@ -0,0 +1,13 @@
+--- suite/mariabackup/compression_providers_loaded.result
++++ suite/mariabackup/compression_providers_loaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lz4 compression
+ #
+ # Creating table
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lz4;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded,lzma.rdiff b/mysql-test/suite/mariabackup/compression_providers_loaded,lzma.rdiff
new file mode 100644
index 00000000000..e6b52d3ac07
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded,lzma.rdiff
@@ -0,0 +1,13 @@
+--- suite/mariabackup/compression_providers_loaded.result
++++ suite/mariabackup/compression_providers_loaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lzma compression
+ #
+ # Creating table
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lzma;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded,lzo.rdiff b/mysql-test/suite/mariabackup/compression_providers_loaded,lzo.rdiff
new file mode 100644
index 00000000000..75e9519d680
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded,lzo.rdiff
@@ -0,0 +1,13 @@
+--- suite/mariabackup/compression_providers_loaded.result
++++ suite/mariabackup/compression_providers_loaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lzo compression
+ #
+ # Creating table
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lzo;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded,snappy.rdiff b/mysql-test/suite/mariabackup/compression_providers_loaded,snappy.rdiff
new file mode 100644
index 00000000000..da281efffc4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded,snappy.rdiff
@@ -0,0 +1,13 @@
+--- suite/mariabackup/compression_providers_loaded.result
++++ suite/mariabackup/compression_providers_loaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with snappy compression
+ #
+ # Creating table
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = snappy;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded.combinations b/mysql-test/suite/mariabackup/compression_providers_loaded.combinations
new file mode 100644
index 00000000000..3287917fd5e
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded.combinations
@@ -0,0 +1,14 @@
+[bzip2]
+plugin-load-add=$PROVIDER_BZIP2_SO
+
+[lz4]
+plugin-load-add=$PROVIDER_LZ4_SO
+
+[lzma]
+plugin-load-add=$PROVIDER_LZMA_SO
+
+[lzo]
+plugin-load-add=$PROVIDER_LZO_SO
+
+[snappy]
+plugin-load-add=$PROVIDER_SNAPPY_SO
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded.result b/mysql-test/suite/mariabackup/compression_providers_loaded.result
new file mode 100644
index 00000000000..6cd928b02f7
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded.result
@@ -0,0 +1,27 @@
+#
+# Testing mariabackup with bzip2 compression
+#
+# Creating table
+set global innodb_compression_algorithm = bzip2;
+create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+# restart
+# xtrabackup backup
+# xtrabackup prepare;
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_loaded.test b/mysql-test/suite/mariabackup/compression_providers_loaded.test
new file mode 100644
index 00000000000..aad21ff01a4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_loaded.test
@@ -0,0 +1,38 @@
+let $alg = $MTR_COMBINATIONS;
+
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'provider_$alg' and plugin_status='active'`)
+{
+ skip "Needs provider_$alg plugin";
+}
+
+--echo #
+--echo # Testing mariabackup with $alg compression
+--echo #
+
+--echo # Creating table
+eval set global innodb_compression_algorithm = $alg;
+eval create table t1 (a int, b text $column_params) engine = innodb page_compressed = 1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+
+--source include/restart_mysqld.inc
+
+--echo # xtrabackup backup
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+
+disable_result_log;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+enable_result_log;
+
+--echo # xtrabackup prepare;
+disable_result_log;
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+source include/restart_and_restore.inc;
+enable_result_log;
+
+select a, left(b, 9), length(b) from t1;
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded,lz4.rdiff b/mysql-test/suite/mariabackup/compression_providers_unloaded,lz4.rdiff
new file mode 100644
index 00000000000..4b874403830
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded,lz4.rdiff
@@ -0,0 +1,22 @@
+--- suite/mariabackup/compression_providers_unloaded.result
++++ suite/mariabackup/compression_providers_unloaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lz4 compression
+ #
+-# Create table with bzip2 compression
+-set global innodb_compression_algorithm = bzip2;
++# Create table with lz4 compression
++set global innodb_compression_algorithm = lz4;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
+@@ -14,6 +14,6 @@
+ 2 ghighighi 30000
+ # Restart server without plugin
+ call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lz4
+ # xtrabackup backup
+ drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded,lzma.rdiff b/mysql-test/suite/mariabackup/compression_providers_unloaded,lzma.rdiff
new file mode 100644
index 00000000000..ff57834f624
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded,lzma.rdiff
@@ -0,0 +1,22 @@
+--- suite/mariabackup/compression_providers_unloaded.result
++++ suite/mariabackup/compression_providers_unloaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lzma compression
+ #
+-# Create table with bzip2 compression
+-set global innodb_compression_algorithm = bzip2;
++# Create table with lzma compression
++set global innodb_compression_algorithm = lzma;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
+@@ -14,6 +14,6 @@
+ 2 ghighighi 30000
+ # Restart server without plugin
+ call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lzma
+ # xtrabackup backup
+ drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded,lzo.rdiff b/mysql-test/suite/mariabackup/compression_providers_unloaded,lzo.rdiff
new file mode 100644
index 00000000000..5308fc4333e
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded,lzo.rdiff
@@ -0,0 +1,22 @@
+--- suite/mariabackup/compression_providers_unloaded.result
++++ suite/mariabackup/compression_providers_unloaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with lzo compression
+ #
+-# Create table with bzip2 compression
+-set global innodb_compression_algorithm = bzip2;
++# Create table with lzo compression
++set global innodb_compression_algorithm = lzo;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
+@@ -14,6 +14,6 @@
+ 2 ghighighi 30000
+ # Restart server without plugin
+ call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lzo
+ # xtrabackup backup
+ drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded,snappy.rdiff b/mysql-test/suite/mariabackup/compression_providers_unloaded,snappy.rdiff
new file mode 100644
index 00000000000..b7b5e2b51c2
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded,snappy.rdiff
@@ -0,0 +1,22 @@
+--- suite/mariabackup/compression_providers_unloaded.result
++++ suite/mariabackup/compression_providers_unloaded.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing mariabackup with bzip2 compression
++# Testing mariabackup with snappy compression
+ #
+-# Create table with bzip2 compression
+-set global innodb_compression_algorithm = bzip2;
++# Create table with snappy compression
++set global innodb_compression_algorithm = snappy;
+ create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
+@@ -14,6 +14,6 @@
+ 2 ghighighi 30000
+ # Restart server without plugin
+ call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-snappy
+ # xtrabackup backup
+ drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded.combinations b/mysql-test/suite/mariabackup/compression_providers_unloaded.combinations
new file mode 100644
index 00000000000..3287917fd5e
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded.combinations
@@ -0,0 +1,14 @@
+[bzip2]
+plugin-load-add=$PROVIDER_BZIP2_SO
+
+[lz4]
+plugin-load-add=$PROVIDER_LZ4_SO
+
+[lzma]
+plugin-load-add=$PROVIDER_LZMA_SO
+
+[lzo]
+plugin-load-add=$PROVIDER_LZO_SO
+
+[snappy]
+plugin-load-add=$PROVIDER_SNAPPY_SO
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded.result b/mysql-test/suite/mariabackup/compression_providers_unloaded.result
new file mode 100644
index 00000000000..ccf3e0355a4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded.result
@@ -0,0 +1,22 @@
+call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+call mtr.add_suppression("Refusing to load corrupted table");
+#
+# Testing mariabackup with bzip2 compression
+#
+# Create table with bzip2 compression
+set global innodb_compression_algorithm = bzip2;
+create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+# Restart server without plugin
+call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+# restart: --disable-provider-bzip2
+# xtrabackup backup
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/compression_providers_unloaded.test b/mysql-test/suite/mariabackup/compression_providers_unloaded.test
new file mode 100644
index 00000000000..673c16d03cf
--- /dev/null
+++ b/mysql-test/suite/mariabackup/compression_providers_unloaded.test
@@ -0,0 +1,35 @@
+let $alg = $MTR_COMBINATIONS;
+call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+call mtr.add_suppression("Refusing to load corrupted table");
+
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'provider_$alg' and plugin_status='active'`)
+{
+ skip "Needs provider_$alg plugin";
+}
+
+--echo #
+--echo # Testing mariabackup with $alg compression
+--echo #
+
+--echo # Create table with $alg compression
+eval set global innodb_compression_algorithm = $alg;
+eval create table t1 (a int, b text $column_params) engine = innodb page_compressed = 1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+
+--echo # Restart server without plugin
+call mtr.add_suppression("mariadbd: MariaDB tried to use the \\w+ compression, but its provider plugin is not loaded");
+let $restart_parameters = --disable-provider-$alg;
+source include/restart_mysqld.inc;
+
+--echo # xtrabackup backup
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+
+error 1;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/incremental_page_compressed.result b/mysql-test/suite/mariabackup/incremental_page_compressed.result
new file mode 100644
index 00000000000..eb059cdc769
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_page_compressed.result
@@ -0,0 +1,13 @@
+#
+# MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup
+#
+CREATE TABLE t (a INT) ENGINE=InnoDB;
+INSERT INTO t VALUES (1),(2);
+INSTALL SONAME 'provider_snappy';
+SET GLOBAL innodb_compression_algorithm= snappy;
+CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1;
+INSERT INTO t_snappy VALUES (3),(4);
+# restart: --innodb_buffer_pool_load_at_startup=0
+# Prepare initial backup
+# Prepare incremental backup
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/incremental_page_compressed.test b/mysql-test/suite/mariabackup/incremental_page_compressed.test
new file mode 100644
index 00000000000..f6ec26cfb46
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_page_compressed.test
@@ -0,0 +1,38 @@
+--echo #
+--echo # MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup
+--echo #
+
+if (!$PROVIDER_SNAPPY_SO) {
+ skip "Needs provider_snappy plugin";
+}
+
+--source include/have_innodb.inc
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--let $incdir=$MYSQLTEST_VARDIR/tmp/inc
+
+CREATE TABLE t (a INT) ENGINE=InnoDB;
+INSERT INTO t VALUES (1),(2);
+
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir
+
+INSTALL SONAME 'provider_snappy';
+
+SET GLOBAL innodb_compression_algorithm= snappy;
+
+CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1;
+INSERT INTO t_snappy VALUES (3),(4);
+
+# disable buffer pool load to avoid MDEV-26794 warnings
+--let $restart_parameters= --innodb_buffer_pool_load_at_startup=0
+--source include/restart_mysqld.inc
+
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --incremental-basedir=$targetdir --target-dir=$incdir
+
+--echo # Prepare initial backup
+--exec $XTRABACKUP --prepare --target-dir=$targetdir
+
+--echo # Prepare incremental backup
+--exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $MYSQLTEST_VARDIR/prepare.log 2>&1
+
+DROP TABLE t;
diff --git a/mysql-test/suite/multi_source/change_master.result b/mysql-test/suite/multi_source/change_master.result
new file mode 100644
index 00000000000..9fd84e51364
--- /dev/null
+++ b/mysql-test/suite/multi_source/change_master.result
@@ -0,0 +1,8 @@
+RESET MASTER;
+connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
+change master 'abc1' to relay_log_file='';
+ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization
+change master 'abc1' to relay_log_file='';
+ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization
+disconnect slave;
+connection default;
diff --git a/mysql-test/suite/multi_source/change_master.test b/mysql-test/suite/multi_source/change_master.test
new file mode 100644
index 00000000000..08e6909694f
--- /dev/null
+++ b/mysql-test/suite/multi_source/change_master.test
@@ -0,0 +1,13 @@
+--source include/not_embedded.inc
+
+RESET MASTER;
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+--error ER_RELAY_LOG_INIT
+change master 'abc1' to relay_log_file='';
+--error ER_RELAY_LOG_INIT
+change master 'abc1' to relay_log_file='';
+--disconnect slave
+--connection default
+
diff --git a/mysql-test/suite/multi_source/multisource_for_channel.result b/mysql-test/suite/multi_source/multisource_for_channel.result
new file mode 100644
index 00000000000..cb1224b416f
--- /dev/null
+++ b/mysql-test/suite/multi_source/multisource_for_channel.result
@@ -0,0 +1,370 @@
+RESET MASTER;
+connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
+change master to relay_log_file='' for channel 'abc1';
+ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization
+change master to master_host='' for channel 'abc2';
+ERROR HY000: Incorrect arguments to MASTER_HOST
+change master to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root'
+for channel 'master1';
+start slave for channel 'master1';
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1;
+connection slave;
+#
+# Checking SHOW SLAVE 'master1' STATUS
+#
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+#
+# Checking SHOW SLAVE STATUS
+#
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+#
+connection master1;
+drop database if exists db1;
+create database db1;
+use db1;
+create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
+insert into t1 (f1) values ('one'),('two');
+connection slave;
+select * from db1.t1;
+i f1
+1 one
+2 two
+# List of relay log files in the datadir
+mysqld-relay-bin-master1.000001
+mysqld-relay-bin-master1.000002
+mysqld-relay-bin-master1.index
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000001 # Rotate # # mysqld-relay-bin-master1.000002;pos=4
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Rotate # # master-bin.000001;pos=POS
+mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin-master1.000002 # Gtid_list # # []
+mysqld-relay-bin-master1.000002 # Binlog_checkpoint # # master-bin.000001
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # drop database if exists db1
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # create database db1
+mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin-master1.000002 # Query # # use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
+mysqld-relay-bin-master1.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-relay-bin-master1.000002 # Intvar # # INSERT_ID=1
+mysqld-relay-bin-master1.000002 # Query # # use `db1`; insert into t1 (f1) values ('one'),('two')
+mysqld-relay-bin-master1.000002 # Query # # COMMIT
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root'
+for channel 'master1';
+ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
+change master to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root' for channel 'master2';
+ERROR HY000: Connection 'master2' conflicts with existing connection 'master1'
+set default_master_connection = '';
+change master to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+start slave;
+include/wait_for_slave_to_start.inc
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = ''
+Connection_name = 'master1'
+Master_Port = 'MYPORT_2'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin.000002'
+Relay_Log_File = 'mysqld-relay-bin-master1.000002'
+Slave_IO_Running = 'Yes'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+Slave_heartbeat_period = '60.000'
+#
+connection master1;
+insert into t1 (f1) values ('three');
+connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2;
+drop database if exists db2;
+create database db2;
+use db2;
+create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
+begin;
+insert into t1 (f1) values (1),(2);
+connection slave;
+connection master2;
+connection slave;
+select * from db1.t1;
+i f1
+1 one
+2 two
+3 three
+select * from db2.t1;
+pk f1
+connection master2;
+commit;
+connection slave;
+select * from db2.t1;
+pk f1
+1 1
+2 2
+connection master1;
+flush logs;
+connection slave;
+connection master1;
+purge binary logs to 'master-bin.000002';
+show binary logs;
+Log_name File_size
+master-bin.000002 filesize
+insert into t1 (f1) values ('four');
+create table db1.t3 (f1 int) engine=InnoDB;
+connection slave;
+#
+# Checking SHOW ALL SLAVES STATUS
+#
+Connection_name = ''
+Connection_name = 'master1'
+Master_Port = 'MYPORT_2'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin.000002'
+Relay_Log_File = 'mysqld-relay-bin-master1.000004'
+Slave_IO_Running = 'Yes'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+Last_SQL_Errno = '0'
+Slave_heartbeat_period = '60.000'
+Slave_heartbeat_period = '60.000'
+#
+#
+# MDEV:16437: merge 5.7 P_S replication instrumentation and tables
+#
+SELECT * FROM performance_schema.replication_applier_status_by_coordinator;
+CHANNEL_NAME master1
+THREAD_ID #
+SERVICE_STATE ON
+LAST_ERROR_NUMBER 0
+LAST_ERROR_MESSAGE
+LAST_ERROR_TIMESTAMP 0000-00-00 00:00:00
+LAST_SEEN_TRANSACTION 0-1-7
+LAST_TRANS_RETRY_COUNT 0
+CHANNEL_NAME
+THREAD_ID #
+SERVICE_STATE ON
+LAST_ERROR_NUMBER 0
+LAST_ERROR_MESSAGE
+LAST_ERROR_TIMESTAMP 0000-00-00 00:00:00
+LAST_SEEN_TRANSACTION 0-2-4
+LAST_TRANS_RETRY_COUNT 0
+select * from db1.t1;
+i f1
+1 one
+2 two
+3 three
+4 four
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000001 # Rotate # # mysqld-relay-bin.000002;pos=4
+include/show_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
+mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+mysqld-relay-bin.000002 # Gtid_list # # []
+mysqld-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # drop database if exists db2
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # create database db2
+mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
+mysqld-relay-bin.000002 # Query # # use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
+mysqld-relay-bin.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-relay-bin.000002 # Intvar # # INSERT_ID=1
+mysqld-relay-bin.000002 # Query # # use `db2`; insert into t1 (f1) values (1),(2)
+mysqld-relay-bin.000002 # Xid # # COMMIT /* XID */
+disconnect slave;
+connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
+stop slave io_thread;
+show status like 'Slave_running';
+Variable_name Value
+Slave_running OFF
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+Variable_name Value
+Slave_running ON
+
+#
+# syntax compatible test
+#
+
+#
+# show relaylog events
+#
+SHOW RELAYLOG EVENTS for channel 'master1';
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-relay-bin-master1.000003 4 Format_desc 3 256 Server ver: Version
+mysqld-relay-bin-master1.000003 256 Rotate 1 1358 master-bin.000002;pos=4
+mysqld-relay-bin-master1.000003 304 Rotate 3 366 mysqld-relay-bin-master1.000004;pos=4
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000004'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# stop slave
+#
+STOP SLAVE for channel 'master1';
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000004'
+Slave_IO_Running = 'No'
+Slave_SQL_Running = 'No'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# start slave
+#
+START SLAVE for channel 'master1';
+include/wait_for_slave_to_start.inc
+connection master1;
+create table foo (a int);
+drop table foo;
+connection slave;
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000005'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# flush relay logs
+#
+FLUSH RELAY LOGS for channel 'master1';
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000006'
+Slave_IO_Running = 'Yes'
+Slave_SQL_Running = 'Yes'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# stop slave
+#
+STOP SLAVE for channel 'master1';
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = 'mysqld-relay-bin-master1.000006'
+Slave_IO_Running = 'No'
+Slave_SQL_Running = 'No'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# reset slave
+#
+RESET SLAVE for channel 'master1';
+
+show slave status for channel 'master1'
+Master_Port = 'MYPORT_1'
+Relay_Log_File = ''
+Slave_IO_Running = 'No'
+Slave_SQL_Running = 'No'
+Last_Errno = '0'
+Last_SQL_Errno = '0'
+
+#
+# show relaylog events after reset slave
+#
+SHOW RELAYLOG EVENTS for channel 'master1';
+Log_name Pos Event_type Server_id End_log_pos Info
+
+#
+# check error syntax
+#
+RESET SLAVE 'master1' for channel 'mmaster2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+STOP SLAVE 'master1' for channel 'master2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+FLUSH RELAY LOGS 'master1' for channel 'master2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+START SLAVE 'master1' for channel 'master2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+SHOW RELAYLOG 'master1' EVENTS for channel 'master2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+SHOW SLAVE 'master1' STATUS for channel 'master2';
+ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
+
+drop database db1;
+drop database db2;
+include/reset_master_slave.inc
+disconnect slave;
+connection master1;
+drop database db1;
+include/reset_master_slave.inc
+disconnect master1;
+connection master2;
+drop database db2;
+include/reset_master_slave.inc
+disconnect master2;
+connection default;
+CREATE TABLE channel (channel int);
+DROP TABLE channel;
diff --git a/mysql-test/suite/multi_source/multisource_for_channel.test b/mysql-test/suite/multi_source/multisource_for_channel.test
new file mode 100644
index 00000000000..a95b272d5b1
--- /dev/null
+++ b/mysql-test/suite/multi_source/multisource_for_channel.test
@@ -0,0 +1,438 @@
+#
+# This is the basic test of support mysql syntax "for channel" used for
+# multi-source replication
+#
+# Test basic replication functionality in multi-source setup
+#
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/binlog_start_pos.inc
+--let $rpl_server_count= 0
+
+RESET MASTER;
+
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+# MDEV-3984: crash/read of freed memory when changing master with named connection
+# This fails after adding the new master 'abc1', check we do not free twice.
+--error ER_RELAY_LOG_INIT
+change master to relay_log_file='' for channel 'abc1';
+# This fails before adding the new master, check that we do free it.
+--error ER_WRONG_ARGUMENTS
+change master to master_host='' for channel 'abc2';
+
+# Start replication from the first master
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root'
+for channel 'master1';
+
+start slave for channel 'master1';
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+# Here and further: add an extra check on SQL thread status
+# as the normal sync is not always enough
+--source include/wait_for_sql_thread_read_all.inc
+
+# each of the 3 commands should produce
+# 'master1' status
+
+let $wait_for_all= 1;
+let $show_statement= SHOW ALL SLAVES STATUS;
+let $field= Slave_IO_State;
+let $condition= = 'Waiting for master to send event';
+--source include/wait_show_condition.inc
+
+--echo #
+--echo # Checking SHOW SLAVE 'master1' STATUS
+--echo #
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let for_channel= 1
+--source include/show_slave_status.inc
+--let $slave_name=
+--let for_channel=
+
+--echo #
+--echo # Checking SHOW SLAVE STATUS
+--echo #
+--source include/show_slave_status.inc
+
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
+
+
+# Check that replication actually works
+
+--connection master1
+
+--disable_warnings
+drop database if exists db1;
+--enable_warnings
+create database db1;
+use db1;
+create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+insert into t1 (f1) values ('one'),('two');
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--sorted_result
+select * from db1.t1;
+
+--let $datadir = `SELECT @@datadir`
+
+--echo # List of relay log files in the datadir
+--list_files $datadir mysqld-relay-bin-master1.*
+
+# Check that relay logs are recognizable
+
+let binlog_start=4;
+let binlog_file=;
+source include/show_relaylog_events.inc;
+let binlog_file= mysqld-relay-bin-master1.000002;
+source include/show_relaylog_events.inc;
+
+# Try to configure connection with the same name again,
+# should get an error because the slave is running
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+--error ER_SLAVE_MUST_STOP
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root'
+for channel 'master1';
+
+# Try to configure using the default connection name
+# (which is 'master1' at the moment),
+# again, should get an error
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+--error ER_SLAVE_MUST_STOP
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+# Try to configure a connection with the same master
+# using a different name, should get a conflict
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+--error ER_CONNECTION_ALREADY_EXISTS
+eval change master to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root' for channel 'master2';
+
+
+# Set up a proper 'default' connection to master2
+
+set default_master_connection = '';
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+start slave;
+--source include/wait_for_slave_to_start.inc
+
+--source include/wait_for_sql_thread_read_all.inc
+
+# See both connections in the same status output
+
+let $wait_for_all= 1;
+let $show_statement= SHOW ALL SLAVES STATUS;
+let $field= Slave_IO_State;
+let $condition= = 'Waiting for master to send event';
+--source include/wait_show_condition.inc
+
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
+
+# Check that replication from two servers actually works
+
+--connection master1
+
+insert into t1 (f1) values ('three');
+--save_master_pos
+
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+
+--disable_warnings
+drop database if exists db2;
+--enable_warnings
+create database db2;
+use db2;
+create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
+begin;
+insert into t1 (f1) values (1),(2);
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--connection master2
+--save_master_pos
+
+--connection slave
+--sync_with_master 0
+--sorted_result
+select * from db1.t1;
+select * from db2.t1;
+
+--connection master2
+commit;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0
+--sorted_result
+select * from db2.t1;
+
+# Flush and purge logs on one master,
+# make sure slaves don't get confused
+
+--connection master1
+flush logs;
+--source include/wait_for_binlog_checkpoint.inc
+--save_master_pos
+--connection slave
+--sync_with_master 0, 'master1'
+
+--connection master1
+purge binary logs to 'master-bin.000002';
+# Additional events: 43 (Gtid_list) + 2 x 44 (Binlog_checkpoint) = 131
+let filesize=`select $binlog_start_pos+131`;
+--replace_result $filesize filesize
+show binary logs;
+insert into t1 (f1) values ('four');
+create table db1.t3 (f1 int) engine=InnoDB;
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master1'
+
+--source include/wait_for_sql_thread_read_all.inc
+
+let $wait_for_all= 1;
+let $show_statement= SHOW ALL SLAVES STATUS;
+let $field= Slave_IO_State;
+let $condition= = 'Waiting for master to send event';
+--source include/wait_show_condition.inc
+
+--echo #
+--echo # Checking SHOW ALL SLAVES STATUS
+--echo #
+--let $all_slaves_status= 1
+--let $status_items= Connection_name, Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno, Slave_heartbeat_period
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /$SERVER_MYPORT_2/MYPORT_2/
+--source include/show_slave_status.inc
+--let $all_slaves_status=
+--echo #
+
+--echo #
+--echo # MDEV:16437: merge 5.7 P_S replication instrumentation and tables
+--echo #
+--replace_column 2 #
+query_vertical SELECT * FROM performance_schema.replication_applier_status_by_coordinator;
+
+--sorted_result
+select * from db1.t1;
+
+# This should show relay log events for the default master
+# (the one with the empty name)
+let binlog_file=;
+source include/show_relaylog_events.inc;
+let binlog_file= mysqld-relay-bin.000002;
+source include/show_relaylog_events.inc;
+
+# Make sure we don't lose control over replication connections
+# after reconnecting to the slave
+
+--disconnect slave
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+stop slave io_thread;
+show status like 'Slave_running';
+set default_master_connection = 'master1';
+show status like 'Slave_running';
+
+--echo
+--echo #
+--echo # syntax compatible test
+--echo #
+--echo
+--echo #
+--echo # show relaylog events
+--echo #
+--replace_regex /Server ver:.*/Server ver: Version/
+SHOW RELAYLOG EVENTS for channel 'master1';
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # stop slave
+--echo #
+STOP SLAVE for channel 'master1';
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # start slave
+--echo #
+START SLAVE for channel 'master1';
+--source include/wait_for_slave_to_start.inc
+
+# Force some data into the relay log to ensure that we get a new relay log
+--connection master1
+create table foo (a int);
+drop table foo;
+--save_master_pos
+--connection slave
+--sync_with_master 0,'master1'
+--source include/wait_for_sql_thread_read_all.inc
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/ /Preparing/Yes/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # flush relay logs
+--echo #
+FLUSH RELAY LOGS for channel 'master1';
+--source include/wait_for_sql_thread_read_all.inc
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # stop slave
+--echo #
+STOP SLAVE for channel 'master1';
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # reset slave
+--echo #
+RESET SLAVE for channel 'master1';
+
+--echo
+--echo show slave status for channel 'master1'
+--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
+--let $slave_field_result_replace= /$SERVER_MYPORT_1/MYPORT_1/
+--let $slave_name= 'master1'
+--let $for_channel= 1
+--source include/show_slave_status.inc
+
+--echo
+--echo #
+--echo # show relaylog events after reset slave
+--echo #
+SHOW RELAYLOG EVENTS for channel 'master1';
+
+--let $slave_name=
+--let for_channel=
+
+--echo
+--echo #
+--echo # check error syntax
+--echo #
+--error ER_WRONG_ARGUMENTS
+RESET SLAVE 'master1' for channel 'mmaster2';
+--error ER_WRONG_ARGUMENTS
+STOP SLAVE 'master1' for channel 'master2';
+--error ER_WRONG_ARGUMENTS
+FLUSH RELAY LOGS 'master1' for channel 'master2';
+--error ER_WRONG_ARGUMENTS
+START SLAVE 'master1' for channel 'master2';
+--error ER_WRONG_ARGUMENTS
+SHOW RELAYLOG 'master1' EVENTS for channel 'master2';
+--error ER_WRONG_ARGUMENTS
+SHOW SLAVE 'master1' STATUS for channel 'master2';
+
+--echo
+# Cleanup
+drop database db1;
+drop database db2;
+
+--source include/reset_master_slave.inc
+--disconnect slave
+
+--connection master1
+drop database db1;
+--source include/reset_master_slave.inc
+--disconnect master1
+
+--connection master2
+drop database db2;
+--source include/reset_master_slave.inc
+--disconnect master2
+
+#
+# Check channel as a keyword
+#
+--connection default
+CREATE TABLE channel (channel int);
+DROP TABLE channel;
diff --git a/mysql-test/suite/parts/inc/engines.combinations b/mysql-test/suite/parts/inc/engines.combinations
new file mode 100644
index 00000000000..17e01265006
--- /dev/null
+++ b/mysql-test/suite/parts/inc/engines.combinations
@@ -0,0 +1,8 @@
+[innodb]
+default-storage-engine=innodb
+
+[myisam]
+default-storage-engine=myisam
+
+[aria]
+default-storage-engine=aria
diff --git a/mysql-test/suite/parts/inc/engines.inc b/mysql-test/suite/parts/inc/engines.inc
new file mode 100644
index 00000000000..b8995ef08ec
--- /dev/null
+++ b/mysql-test/suite/parts/inc/engines.inc
@@ -0,0 +1,4 @@
+--source include/have_innodb.inc
+
+let $engine= `select @@default_storage_engine`;
+
diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre
index fba909687a0..3c9bbe9a6a6 100644
--- a/mysql-test/suite/parts/inc/partition.pre
+++ b/mysql-test/suite/parts/inc/partition.pre
@@ -51,7 +51,7 @@ let $ER_PARSE_ERROR= 1064;
let $ER_TOO_MANY_PARTITIONS_ERROR= 1499;
let $ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF= 1503;
let $ER_NO_PARTS_ERROR= 1504;
-let $ER_DROP_PARTITION_NON_EXISTENT= 1507;
+let $ER_PARTITION_DOES_NOT_EXIST= 1507;
let $ER_SAME_NAME_PARTITION= 1517;
let $ER_NO_PARTITION_FOR_GIVEN_VALUE= 1526;
diff --git a/mysql-test/suite/parts/inc/partition_alter_1.inc b/mysql-test/suite/parts/inc/partition_alter_1.inc
index b62efd24072..a348407ac60 100644
--- a/mysql-test/suite/parts/inc/partition_alter_1.inc
+++ b/mysql-test/suite/parts/inc/partition_alter_1.inc
@@ -40,7 +40,7 @@ eval $insert_first_half;
# 0
# 1030: ER_GET_ERRNO
# 1502: ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
-# 1506: ER_DROP_PARTITION_NON_EXISTENT
+# 1506: ER_PARTITION_DOES_NOT_EXIST
--disable_abort_on_error
eval $alter;
--enable_abort_on_error
@@ -52,10 +52,10 @@ eval SET @my_errno = $mysql_errno;
let $run_test= `SELECT @my_errno = 0`;
if (`SELECT @my_errno NOT IN (0,$ER_GET_ERRNO,
$ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF,
- $ER_DROP_PARTITION_NON_EXISTENT)`);
+ $ER_PARTITION_DOES_NOT_EXIST)`);
{
--echo # The last command got an unexepected error response.
- --echo # Expected/handled SQL codes are 0,$ER_GET_ERRNO,$ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF,$ER_DROP_PARTITION_NON_EXISTENT
+ --echo # Expected/handled SQL codes are 0,$ER_GET_ERRNO,$ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF,$ER_PARTITION_DOES_NOT_EXIST
SELECT '# SQL code we got was: ' AS "", @my_errno AS "";
--echo # Sorry, have to abort.
--echo # Please check the error name to number mapping in inc/partition.pre.
diff --git a/mysql-test/suite/parts/inc/partition_fail.inc b/mysql-test/suite/parts/inc/partition_fail.inc
index dd79cdf1dc8..bbe5924e358 100644
--- a/mysql-test/suite/parts/inc/partition_fail.inc
+++ b/mysql-test/suite/parts/inc/partition_fail.inc
@@ -2,8 +2,10 @@
--eval $create_statement
--eval $insert_statement
---echo # State before failure
+--let $dbug_flag= `select @@session.debug_dbug`
+--echo # $dbug_flag: BEFORE failure
--replace_result #p# #P# #sp# #SP#
+--let $DATADIR= `select @@datadir`
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
@@ -11,7 +13,7 @@ SELECT * FROM t1;
--disable_abort_on_error
--eval $fail_statement
--enable_abort_on_error
---echo # State after failure
+--echo # $dbug_flag: AFTER failure
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
@@ -19,10 +21,9 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
---echo # Same test under LOCK TABLE
--eval $create_statement
--eval $insert_statement
---echo # State before failure
+--echo # $dbug_flag: BEFORE failure (under LOCK TABLE)
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
@@ -32,7 +33,7 @@ LOCK TABLE t1 WRITE;
--disable_abort_on_error
--eval $fail_statement
--enable_abort_on_error
---echo # State after failure
+--echo # $dbug_flag: AFTER failure (under LOCK TABLE)
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/parts/inc/partition_fail_t2.inc b/mysql-test/suite/parts/inc/partition_fail_t2.inc
index 492e6d5a71b..301fb005255 100644
--- a/mysql-test/suite/parts/inc/partition_fail_t2.inc
+++ b/mysql-test/suite/parts/inc/partition_fail_t2.inc
@@ -2,30 +2,40 @@
# To be used with WL#4445: EXCHANGE PARTITION WITH TABLE.
--eval $create_statement2
--eval $insert_statement2
-SHOW CREATE TABLE t2;
---sorted_result
-SELECT * FROM t2;
--eval $create_statement
--eval $insert_statement
---echo # State before failure
+--let $dbug_flag= `select @@session.debug_dbug`
+--echo # $dbug_flag: BEFORE failure
--replace_result #p# #P#
+if (!$DATADIR)
+{
+ --let $DATADIR= `SELECT @@datadir;`
+}
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
+SHOW CREATE TABLE t2;
+--sorted_result
+SELECT * FROM t2;
# accept all errors
--disable_abort_on_error
--replace_regex /#sql-exchange-[0-9a-f_\-]*/#sql-exchange/i
--eval $fail_statement
--enable_abort_on_error
---echo # State after failure
+--echo # $dbug_flag: AFTER failure
--replace_result #p# #P#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
+--error 0, ER_NO_SUCH_TABLE
SHOW CREATE TABLE t2;
--sorted_result
+--error 0, ER_NO_SUCH_TABLE
SELECT * FROM t2;
+# TODO: everything fails with ER_NO_SUCH_TABLE
+# but DROP TABLE fails with ER_BAD_TABLE_ERROR! Why?
+--error 0, ER_BAD_TABLE_ERROR
DROP TABLE t2;
diff --git a/mysql-test/suite/parts/r/alter_table,list.rdiff b/mysql-test/suite/parts/r/alter_table,list.rdiff
new file mode 100644
index 00000000000..391216bc47c
--- /dev/null
+++ b/mysql-test/suite/parts/r/alter_table,list.rdiff
@@ -0,0 +1,85 @@
+@@ -142,13 +142,13 @@
+ partition pn values less than maxvalue);
+ ERROR HY000: Partitioned tables do not support CREATE TEMPORARY TABLE
+ create or replace table t1 (x int)
+-partition by range(x) (
+-partition p1 values less than (10),
+-partition p2 values less than (20),
+-partition p3 values less than (30),
+-partition p4 values less than (40),
+-partition p5 values less than (50),
+-partition pn values less than maxvalue);
++partition by list(x) (
++partition p1 values in (2, 3, 4),
++partition p2 values in (12, 13, 14),
++partition p3 values in (22, 23, 24),
++partition p4 values in (32, 33, 34),
++partition p5 values in (42, 43, 44),
++partition pn values in (52, 53, 54));
+ insert into t1 values (2), (12), (22), (32), (42), (52);
+ create or replace table tp2 (y int);
+ insert tp2 values (88);
+@@ -188,12 +188,12 @@
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+ ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+- PARTITION BY RANGE (`x`)
+-(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+- PARTITION `p3` VALUES LESS THAN (30) ENGINE = X,
+- PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+- PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
++ PARTITION BY LIST (`x`)
++(PARTITION `p1` VALUES IN (2,3,4) ENGINE = X,
++ PARTITION `p3` VALUES IN (22,23,24) ENGINE = X,
++ PARTITION `p4` VALUES IN (32,33,34) ENGINE = X,
++ PARTITION `p5` VALUES IN (42,43,44) ENGINE = X,
++ PARTITION `pn` VALUES IN (52,53,54) ENGINE = X)
+ select * from t1 order by x;
+ x
+ 2
+@@ -218,11 +218,11 @@
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+ ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+- PARTITION BY RANGE (`x`)
+-(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+- PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+- PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
++ PARTITION BY LIST (`x`)
++(PARTITION `p1` VALUES IN (2,3,4) ENGINE = X,
++ PARTITION `p4` VALUES IN (32,33,34) ENGINE = X,
++ PARTITION `p5` VALUES IN (42,43,44) ENGINE = X,
++ PARTITION `pn` VALUES IN (52,53,54) ENGINE = X)
+ select * from t1 order by x;
+ x
+ 2
+@@ -248,10 +248,10 @@
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+ ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+- PARTITION BY RANGE (`x`)
+-(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+- PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
++ PARTITION BY LIST (`x`)
++(PARTITION `p1` VALUES IN (2,3,4) ENGINE = X,
++ PARTITION `p5` VALUES IN (42,43,44) ENGINE = X,
++ PARTITION `pn` VALUES IN (52,53,54) ENGINE = X)
+ select * from t1 order by x;
+ x
+ 2
+@@ -273,9 +273,9 @@
+ t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+ ) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+- PARTITION BY RANGE (`x`)
+-(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
++ PARTITION BY LIST (`x`)
++(PARTITION `p1` VALUES IN (2,3,4) ENGINE = X,
++ PARTITION `pn` VALUES IN (52,53,54) ENGINE = X)
+ select * from t1 order by x;
+ x
+ 2
diff --git a/mysql-test/suite/parts/r/alter_table.result b/mysql-test/suite/parts/r/alter_table.result
index 0901584c6f8..b887cea36f0 100644
--- a/mysql-test/suite/parts/r/alter_table.result
+++ b/mysql-test/suite/parts/r/alter_table.result
@@ -28,3 +28,319 @@ ALTER TABLE v1 EXCHANGE PARTITION p2 WITH TABLE t2 ;
ERROR 42000: Can't open table
DROP VIEW v1;
DROP TABLE t1, t2;
+#
+# MDEV-22165 CONVERT PARTITION: move in partition from existing table
+#
+create or replace table tp1 (a int);
+create or replace table t1 (a int)
+partition by hash (a) partitions 2;
+alter table t1 convert table tp1 to partition p2;
+ERROR HY000: CONVERT TABLE TO PARTITION can only be used on RANGE/LIST partitions
+create or replace table t1 (a int)
+partition by range (a)
+(partition p0 values less than (0));
+alter table t1 convert table non_existent to partition p1 values less than (10);
+ERROR 42S02: Table 'test.non_existent' doesn't exist
+alter table t1 convert table tp1 to partition p1 values less than (10);
+show create table tp1;
+ERROR 42S02: Table 'test.tp1' doesn't exist
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = X,
+ PARTITION `p1` VALUES LESS THAN (10) ENGINE = X)
+create table tp2 (x int);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+ERROR HY000: Tables have different definitions
+show create table tp2;
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = X,
+ PARTITION `p1` VALUES LESS THAN (10) ENGINE = X)
+create or replace table tp2 (a int);
+insert tp2 values (1), (15), (17);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+ERROR HY000: Found a row that does not match the partition
+delete from tp2;
+insert tp2 values (15), (1), (17);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+ERROR HY000: Found a row that does not match the partition
+delete from tp2;
+insert tp2 values (15), (17), (1);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+ERROR HY000: Found a row that does not match the partition
+delete from tp2;
+insert tp2 values (15), (17);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+show create table tp2;
+ERROR 42S02: Table 'test.tp2' doesn't exist
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = X,
+ PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = X)
+select * from t1 partition (p2);
+a
+15
+17
+create or replace table t1 (a int)
+partition by range (a) (
+p0 values less than (0),
+pn values less than (30));
+insert into t1 values (1);
+create or replace table tp1 (a int);
+insert into tp1 values (2);
+alter table t1 convert table tp1 to partition p1 values less than (10);
+ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
+drop tables t1, tp1;
+#
+# MDEV-22166 CONVERT PARTITION: move out partition into a table
+#
+create or replace table t1 (x int);
+alter table t1 convert partition p1 to table tp1;
+ERROR HY000: Partition management on a not partitioned table is not possible
+create or replace table t1 (x int)
+partition by hash(x) partitions 2;
+alter table t1 convert partition p1 to table tp1;
+ERROR HY000: CONVERT PARTITION can only be used on RANGE/LIST partitions
+create or replace table t1 (x int)
+partition by key(x) partitions 2;
+alter table t1 convert partition p1 to table tp1;
+ERROR HY000: CONVERT PARTITION can only be used on RANGE/LIST partitions
+create or replace table t1 (x int)
+partition by range(x)
+subpartition by hash(x) subpartitions 3 (
+partition p1 values less than (10),
+partition pn values less than maxvalue);
+alter table t1 convert partition p1 to table p1;
+ERROR HY000: Convert partition is not supported for subpartitioned table.
+alter table t1 convert partition p1sp0 to table p1;
+ERROR HY000: Wrong partition name or partition list
+create or replace table t1 (x int)
+partition by range(x) (
+partition p1 values less than (10));
+alter table t1 convert partition p1 to table tp1;
+ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
+create or replace temporary table t1 (x int)
+partition by range(x) (
+partition p0 values less than (10),
+partition pn values less than maxvalue);
+ERROR HY000: Partitioned tables do not support CREATE TEMPORARY TABLE
+create or replace table t1 (x int)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+create or replace table tp2 (y int);
+insert tp2 values (88);
+alter table t1 convert partition p2 to table tp2, drop partition p3;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' drop partition p3' at line 1
+alter table t1 convert partition p00 to table tp00;
+ERROR HY000: Wrong partition name or partition list
+alter table t1 convert partition p00 to table tp2;
+ERROR 42S01: Table 'tp2' already exists
+alter table t1 convert partition p2 to table tp2;
+ERROR 42S01: Table 'tp2' already exists
+create trigger tr1 before update on t1 for each row
+begin
+alter table t1 convert partition p2 to table tp2;
+end$
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
+create function f1() returns int
+begin
+alter table t1 convert partition p2 to table tp2;
+end$
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
+select * from tp2;
+y
+88
+drop table tp2;
+alter table t1 convert partition p2 to table tp2;
+show create table tp2;
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select * from tp2;
+x
+12
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = X,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+2
+22
+32
+42
+52
+alter table t1 convert partition p3 to table inexistent.tp3;
+ERROR 42000: Unknown database 'inexistent'
+create database EXISTENT;
+alter table t1 convert partition p3 to table EXISTENT.TP3;
+show create table EXISTENT.TP3;
+Table Create Table
+TP3 CREATE TABLE `TP3`-ok (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select * from EXISTENT.TP3 order by x;
+x
+22
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+2
+32
+42
+52
+# LOCK TABLES
+lock tables t1 write;
+alter table t1 convert partition p4 to table tp4;
+show create table tp4;
+ERROR HY000: Table 'tp4' was not locked with LOCK TABLES
+unlock tables;
+show create table tp4;
+Table Create Table
+tp4 CREATE TABLE `tp4` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select * from tp4;
+x
+32
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+2
+42
+52
+# PS
+prepare stmt from 'alter table t1 convert partition p5 to table tp5';
+execute stmt;
+show create table tp5;
+Table Create Table
+tp5 CREATE TABLE `tp5` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select * from tp5;
+x
+42
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+2
+52
+drop table tp5;
+execute stmt;
+ERROR HY000: Wrong partition name or partition list
+execute stmt;
+ERROR HY000: Wrong partition name or partition list
+drop prepare stmt;
+# Privileges
+create user alan;
+grant usage on *.* to alan;
+grant create, insert, drop on test.* to alan;
+connect alan,localhost,alan,,test;
+show grants for current_user;
+Grants for alan@%
+GRANT USAGE ON *.* TO `alan`@`%`
+GRANT INSERT, CREATE, DROP ON `test`.* TO `alan`@`%`
+alter table t1 convert partition p1 to table tp1;
+ERROR 42000: ALTER command denied to user 'alan'@'localhost' for table `test`.`t1`
+connection default;
+revoke all on test.* from alan;
+grant create, insert, alter on test.* to alan;
+connection alan;
+use test;
+show grants for current_user;
+Grants for alan@%
+GRANT USAGE ON *.* TO `alan`@`%`
+GRANT INSERT, CREATE, ALTER ON `test`.* TO `alan`@`%`
+alter table t1 convert partition p1 to table tp1;
+ERROR 42000: DROP command denied to user 'alan'@'localhost' for table `test`.`t1`
+connection default;
+revoke all on test.* from alan;
+grant create, drop, alter on test.* to alan;
+connection alan;
+use test;
+show grants for current_user;
+Grants for alan@%
+GRANT USAGE ON *.* TO `alan`@`%`
+GRANT CREATE, DROP, ALTER ON `test`.* TO `alan`@`%`
+alter table t1 convert partition p1 to table tp1;
+ERROR 42000: INSERT command denied to user 'alan'@'localhost' for table `test`.`tp1`
+connection default;
+revoke all on test.* from alan;
+grant insert, drop, alter on test.* to alan;
+connection alan;
+use test;
+show grants for current_user;
+Grants for alan@%
+GRANT USAGE ON *.* TO `alan`@`%`
+GRANT INSERT, DROP, ALTER ON `test`.* TO `alan`@`%`
+alter table t1 convert partition p1 to table tp1;
+ERROR 42000: CREATE command denied to user 'alan'@'localhost' for table `test`.`tp1`
+connection default;
+grant create, insert, drop, alter on test.* to alan;
+connection alan;
+use test;
+show grants for current_user;
+Grants for alan@%
+GRANT USAGE ON *.* TO `alan`@`%`
+GRANT INSERT, CREATE, DROP, ALTER ON `test`.* TO `alan`@`%`
+alter table t1 convert partition p1 to table tp1;
+disconnect alan;
+connection default;
+drop database EXISTENT;
+drop user alan;
+drop tables t1, tp1, tp2, tp4;
diff --git a/mysql-test/suite/parts/r/debug_innodb_fail.result b/mysql-test/suite/parts/r/debug_innodb_fail.result
index 3d7b19a7f32..b57925eb073 100644
--- a/mysql-test/suite/parts/r/debug_innodb_fail.result
+++ b/mysql-test/suite/parts/r/debug_innodb_fail.result
@@ -19,7 +19,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_1: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -47,7 +47,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_1: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -73,14 +73,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -109,7 +108,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -144,7 +143,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_2: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -172,7 +171,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_2: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -198,14 +197,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -234,7 +232,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -269,7 +267,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_3: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -297,7 +295,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_3: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -323,14 +321,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -359,7 +356,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -394,7 +391,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_4: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -422,7 +419,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_4: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -448,14 +445,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -484,7 +480,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -519,7 +515,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_5: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -547,7 +543,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_5: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -573,14 +569,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -609,7 +604,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -644,7 +639,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_6: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -672,7 +667,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_6: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -698,14 +693,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -734,7 +728,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -769,7 +763,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_7: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -797,7 +791,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_7: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -823,14 +817,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -859,7 +852,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -894,7 +887,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_8: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -922,7 +915,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_8: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -950,14 +943,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -986,7 +978,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1023,7 +1015,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_9: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1051,7 +1043,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_9: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1079,14 +1071,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1115,7 +1106,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1152,7 +1143,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_10: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1180,7 +1171,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_10: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1208,14 +1199,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_10: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1244,7 +1234,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_10: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1283,7 +1273,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_1: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1310,7 +1300,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_1: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1336,14 +1326,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1371,7 +1360,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1406,7 +1395,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_2: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1433,7 +1422,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_2: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1459,14 +1448,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1494,7 +1482,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1529,7 +1517,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_3: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1556,7 +1544,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_3: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1582,14 +1570,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1617,7 +1604,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1652,7 +1639,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_4: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1679,7 +1666,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_4: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -1699,14 +1686,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1734,7 +1720,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -1763,7 +1749,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_5: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1790,7 +1776,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_5: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -1810,14 +1796,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1845,7 +1830,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -1874,7 +1859,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_6: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1901,7 +1886,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_6: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -1921,14 +1906,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -1956,7 +1940,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -1985,7 +1969,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_7: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2012,7 +1996,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_7: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -2032,14 +2016,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2067,7 +2050,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -2096,7 +2079,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_8: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2123,7 +2106,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_8: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -2143,14 +2126,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2178,7 +2160,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -2207,7 +2189,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_9: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2234,7 +2216,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_9: AFTER failure
db.opt
t1#P#p0.ibd
t1.frm
@@ -2254,14 +2236,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2289,7 +2270,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1.frm
@@ -2321,7 +2302,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_1: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2350,7 +2331,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_1: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2376,14 +2357,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2413,7 +2393,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2448,7 +2428,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_2: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2477,7 +2457,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_2: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2503,14 +2483,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2540,7 +2519,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2575,7 +2554,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_3: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2604,7 +2583,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_3: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2630,14 +2609,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2667,7 +2645,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2702,7 +2680,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_4: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2731,7 +2709,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_4: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2757,14 +2735,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2794,7 +2771,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2829,7 +2806,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_5: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2858,7 +2835,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_5: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2884,14 +2861,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2921,7 +2897,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2956,7 +2932,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_6: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -2985,7 +2961,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_6: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3011,14 +2987,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3048,7 +3023,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3083,7 +3058,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_7: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3112,7 +3087,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_7: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3140,14 +3115,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3177,7 +3151,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3214,7 +3188,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_8: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3243,7 +3217,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_8: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3271,14 +3245,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3308,7 +3281,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3345,7 +3318,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_9: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3374,7 +3347,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_9: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3402,14 +3375,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3439,7 +3411,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3476,7 +3448,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_10: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3505,7 +3477,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_10: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3533,14 +3505,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_10: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3570,7 +3541,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_10: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3607,7 +3578,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_11: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3636,7 +3607,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_11: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3664,14 +3635,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_11: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3701,7 +3671,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_11: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3738,7 +3708,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_12: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3767,7 +3737,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_12: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3795,14 +3765,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'InnoDB'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_12: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
@@ -3832,7 +3801,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_12: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.ibd
t1#P#p10.ibd
diff --git a/mysql-test/suite/parts/r/debug_myisam_fail.result b/mysql-test/suite/parts/r/debug_myisam_fail.result
index 117f6ffbdac..708ce222826 100644
--- a/mysql-test/suite/parts/r/debug_myisam_fail.result
+++ b/mysql-test/suite/parts/r/debug_myisam_fail.result
@@ -16,7 +16,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_1: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -46,7 +46,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_1: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -74,14 +74,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -112,7 +111,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -149,7 +148,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_2: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -179,7 +178,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_2: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -207,14 +206,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -245,7 +243,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -282,7 +280,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_3: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -312,7 +310,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_3: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -340,14 +338,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -378,7 +375,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -415,7 +412,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_4: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -445,7 +442,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_4: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -473,14 +470,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -511,7 +507,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -548,7 +544,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_5: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -578,7 +574,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_5: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -606,14 +602,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -644,7 +639,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -681,7 +676,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_6: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -711,7 +706,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_6: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -739,14 +734,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -777,7 +771,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -814,7 +808,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_7: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -844,7 +838,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_7: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -872,14 +866,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -910,7 +903,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -947,7 +940,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_8: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -977,7 +970,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_8: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1008,14 +1001,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1046,7 +1038,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1086,7 +1078,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_9: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1116,7 +1108,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_9: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1147,14 +1139,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1185,7 +1176,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1225,7 +1216,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_10: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1255,7 +1246,7 @@ a b
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_10: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1286,14 +1277,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_add_partition_10: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1324,7 +1314,7 @@ LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_add_partition_10: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1366,7 +1356,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_1: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1395,7 +1385,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_1: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1423,14 +1413,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1460,7 +1449,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1497,7 +1486,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_2: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1526,7 +1515,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_2: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1554,14 +1543,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1591,7 +1579,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1628,7 +1616,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_3: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1657,7 +1645,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_3: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1685,14 +1673,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1722,7 +1709,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1759,7 +1746,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_4: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1788,7 +1775,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_4: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1809,14 +1796,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1846,7 +1832,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1876,7 +1862,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_5: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1905,7 +1891,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_5: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1926,14 +1912,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1963,7 +1948,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1993,7 +1978,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_6: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2022,7 +2007,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_6: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2043,14 +2028,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2080,7 +2064,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2110,7 +2094,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_7: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2139,7 +2123,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_7: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2160,14 +2144,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2197,7 +2180,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2227,7 +2210,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_8: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2256,7 +2239,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_8: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2277,14 +2260,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2314,7 +2296,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2344,7 +2326,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_9: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2373,7 +2355,7 @@ a b
4 Original from partition p0
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_9: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2394,14 +2376,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_drop_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2431,7 +2412,7 @@ a b
LOCK TABLE t1 WRITE;
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
-# State after failure
+# d,fail_drop_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2464,7 +2445,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_1: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2495,7 +2476,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_1: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2523,14 +2504,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_1: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2562,7 +2542,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_1: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2599,7 +2579,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_2: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2630,7 +2610,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_2: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2658,14 +2638,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_2: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2697,7 +2676,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_2: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2734,7 +2713,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_3: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2765,7 +2744,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_3: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2793,14 +2772,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_3: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2832,7 +2810,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_3: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2869,7 +2847,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_4: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2900,7 +2878,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_4: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2928,14 +2906,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_4: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -2967,7 +2944,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_4: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3004,7 +2981,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_5: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3035,7 +3012,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_5: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3063,14 +3040,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_5: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3102,7 +3078,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_5: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3139,7 +3115,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_6: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3170,7 +3146,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_6: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3198,14 +3174,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_6: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3237,7 +3212,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_6: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3274,7 +3249,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_7: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3305,7 +3280,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_7: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3336,14 +3311,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_7: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3375,7 +3349,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_7: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3415,7 +3389,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_8: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3446,7 +3420,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_8: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3477,14 +3451,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_8: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3516,7 +3489,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_8: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3556,7 +3529,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_9: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3587,7 +3560,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_9: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3618,14 +3591,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_9: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3657,7 +3629,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_9: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3697,7 +3669,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_10: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3728,7 +3700,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_10: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3759,14 +3731,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_10: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3798,7 +3769,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_10: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3838,7 +3809,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_11: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3869,7 +3840,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_11: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3900,14 +3871,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_11: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3939,7 +3909,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_11: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -3979,7 +3949,7 @@ PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_12: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -4010,7 +3980,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_12: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -4041,14 +4011,13 @@ a b
3 Original from partition p0
4 Original from partition p0
DROP TABLE t1;
-# Same test under LOCK TABLE
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = 'MyISAM'
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
-# State before failure
+# d,fail_change_partition_12: BEFORE failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -4080,7 +4049,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
ERROR HY000: Unknown error
-# State after failure
+# d,fail_change_partition_12: AFTER failure (under LOCK TABLE)
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result
index c9a80c6035b..aab121f2b23 100644
--- a/mysql-test/suite/parts/r/partition_alter4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result
@@ -7592,7 +7592,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -8052,7 +8052,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -8523,7 +8523,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -8995,7 +8995,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -9461,7 +9461,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -9933,7 +9933,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -10410,7 +10410,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -10885,7 +10885,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -11350,7 +11350,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -11810,7 +11810,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -12281,7 +12281,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -12753,7 +12753,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -13219,7 +13219,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -13691,7 +13691,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -14168,7 +14168,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -14643,7 +14643,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -26393,7 +26393,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -26853,7 +26853,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -27324,7 +27324,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -27796,7 +27796,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -28262,7 +28262,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -28734,7 +28734,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -29211,7 +29211,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -29686,7 +29686,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -30151,7 +30151,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -30611,7 +30611,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -31082,7 +31082,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -31554,7 +31554,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -32020,7 +32020,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -32492,7 +32492,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -32969,7 +32969,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -33444,7 +33444,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -45202,7 +45202,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -45662,7 +45662,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -46133,7 +46133,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -46605,7 +46605,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -47071,7 +47071,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -47543,7 +47543,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -48020,7 +48020,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -48495,7 +48495,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -48960,7 +48960,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -49420,7 +49420,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -49891,7 +49891,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -50363,7 +50363,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -50829,7 +50829,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -51301,7 +51301,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -51778,7 +51778,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -52253,7 +52253,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -63970,7 +63970,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -63985,7 +63985,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64008,7 +64008,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64029,7 +64029,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64048,7 +64048,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64071,7 +64071,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64094,7 +64094,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64113,7 +64113,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
# 4.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
@@ -64130,7 +64130,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64145,7 +64145,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64168,7 +64168,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64189,7 +64189,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64208,7 +64208,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64231,7 +64231,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64254,7 +64254,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -64273,7 +64273,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
# 4.5 ALTER ... REBUILD PARTITION ALL;
DROP TABLE IF EXISTS t1;
@@ -75552,7 +75552,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -76012,7 +76012,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -76483,7 +76483,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -76955,7 +76955,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -77421,7 +77421,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -77893,7 +77893,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -78370,7 +78370,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -78845,7 +78845,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -79310,7 +79310,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -79770,7 +79770,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -80241,7 +80241,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -80713,7 +80713,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -81179,7 +81179,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -81651,7 +81651,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -82128,7 +82128,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -82603,7 +82603,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
diff --git a/mysql-test/suite/parts/r/partition_alter4_myisam.result b/mysql-test/suite/parts/r/partition_alter4_myisam.result
index 4e9e5c83248..c863d479fbb 100644
--- a/mysql-test/suite/parts/r/partition_alter4_myisam.result
+++ b/mysql-test/suite/parts/r/partition_alter4_myisam.result
@@ -7888,7 +7888,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -8357,7 +8357,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -8843,7 +8843,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -9336,7 +9336,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -9819,7 +9819,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -10312,7 +10312,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -10810,7 +10810,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -11306,7 +11306,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -11794,7 +11794,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -12263,7 +12263,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -12749,7 +12749,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -13242,7 +13242,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -13725,7 +13725,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -14218,7 +14218,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -14716,7 +14716,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -15212,7 +15212,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 analyze error Error in list of partitions to test.t1
+test.t1 analyze error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -27429,7 +27429,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -27898,7 +27898,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -28384,7 +28384,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -28877,7 +28877,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -29360,7 +29360,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -29853,7 +29853,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -30351,7 +30351,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -30847,7 +30847,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -31335,7 +31335,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -31804,7 +31804,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -32290,7 +32290,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -32783,7 +32783,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -33266,7 +33266,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -33759,7 +33759,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -34257,7 +34257,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -34753,7 +34753,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 check error Error in list of partitions to test.t1
+test.t1 check error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -46962,7 +46962,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -47431,7 +47431,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -47917,7 +47917,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -48410,7 +48410,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -48893,7 +48893,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -49386,7 +49386,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -49884,7 +49884,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -50380,7 +50380,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -50868,7 +50868,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -51337,7 +51337,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -51823,7 +51823,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -52316,7 +52316,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -52799,7 +52799,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -53292,7 +53292,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -53790,7 +53790,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -54286,7 +54286,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 optimize error Error in list of partitions to test.t1
+test.t1 optimize error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -66462,7 +66462,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66477,7 +66477,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66500,7 +66500,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66521,7 +66521,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66540,7 +66540,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66563,7 +66563,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66586,7 +66586,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66605,7 +66605,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
# 4.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
DROP TABLE IF EXISTS t1;
@@ -66622,7 +66622,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66637,7 +66637,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66660,7 +66660,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66681,7 +66681,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66700,7 +66700,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66723,7 +66723,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66746,7 +66746,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -66765,7 +66765,7 @@ INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
-ERROR HY000: Error in list of partitions to REBUILD
+ERROR HY000: Wrong partition name or partition list
DROP TABLE t1;
# 4.5 ALTER ... REBUILD PARTITION ALL;
DROP TABLE IF EXISTS t1;
@@ -78488,7 +78488,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -78957,7 +78957,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -79443,7 +79443,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -79936,7 +79936,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -80419,7 +80419,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -80912,7 +80912,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -81410,7 +81410,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -81906,7 +81906,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -82394,7 +82394,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -82863,7 +82863,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -83349,7 +83349,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -83842,7 +83842,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -84325,7 +84325,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -84818,7 +84818,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -85316,7 +85316,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -85812,7 +85812,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
Table Op Msg_type Msg_text
-test.t1 repair error Error in list of partitions to test.t1
+test.t1 repair error Wrong partition name or partition list
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result
index b24ce29d028..5aae648dd1c 100644
--- a/mysql-test/suite/parts/r/partition_debug.result
+++ b/mysql-test/suite/parts/r/partition_debug.result
@@ -1025,23 +1025,11 @@ SET @save_dbug=@@debug_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_1";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_1: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1075,9 +1063,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_1: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1129,23 +1129,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_2";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_2: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1179,9 +1167,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_2: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1233,23 +1233,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_3";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_3: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1283,9 +1271,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t2' to './test/#sql-exchange' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_3: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1337,23 +1337,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_4";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_4: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1387,9 +1375,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_4: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1441,23 +1441,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_5";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_5: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1491,9 +1479,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_5: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1545,23 +1545,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_6";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_6: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1595,9 +1583,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_6: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1649,23 +1649,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_7";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_7: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1699,9 +1687,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/#sql-exchange' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_7: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1753,23 +1753,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_8";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_8: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1803,9 +1791,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_8: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1857,23 +1857,11 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_9";
CREATE TABLE t2 (a INT, b VARCHAR(64));
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64)) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_9: BEFORE failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1907,9 +1895,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_9: AFTER failure
db.opt
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1958,3 +1958,3229 @@ a b
4 Original from partition p0
DROP TABLE t2;
SET SESSION debug_dbug=@save_dbug;
+#
+# MDEV-22165 CONVERT PARTITION: move in partition from existing table
+#
+set @save_dbug=@@debug_dbug;
+set session debug_dbug="+d,fail_convert_partition_1";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_1: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_1: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_2";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_2: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_2: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_3";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_3: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_3: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_4";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_4: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_4: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_5";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_5: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_5: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_6";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_6: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_6: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_7";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_7: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_7: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_8";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_8: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_8: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_9";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_9: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_9: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_11";
+create or replace table t2 (x int primary key);
+insert into t2 values (32), (42), (52);
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30));
+insert into t1 values (2), (12), (22);
+# d,fail_convert_partition_11: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1.frm
+t1.par
+t2.MYD
+t2.MYI
+t2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+x
+32
+42
+52
+alter table t1 convert table t2 to partition pn values less than maxvalue;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_11: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+set session debug_dbug=@save_dbug;
+#
+# MDEV-22166 CONVERT PARTITION: move out partition into a table
+#
+set @save_dbug=@@debug_dbug;
+set session debug_dbug="+d,fail_create_before_create_frm";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_create_before_create_frm: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_create_before_create_frm: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_create_before_create_frm: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_create_before_create_frm: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_alter_partition_after_write_frm";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_alter_partition_after_write_frm: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_alter_partition_after_write_frm: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_alter_partition_after_write_frm: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_alter_partition_after_write_frm: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,error_convert_partition_00";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,error_convert_partition_00: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)")
+# d,error_convert_partition_00: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,error_convert_partition_00: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)")
+# d,error_convert_partition_00: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_1";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_1: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_1: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_1: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_1: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_2";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_2: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_2: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_2: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_2: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_3";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_3: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_3: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_3: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_3: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_4";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_4: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_4: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_4: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_4: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_5";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_5: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_5: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_5: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_5: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_6";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_6: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_6: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_6: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_6: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_7";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_7: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_7: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_7: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_7: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_8";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_8: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_8: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_8: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_8: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_9";
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_9: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_9: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_9: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_9: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_11";
+# Already finished DDL logging, so tp2 now exists:
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_11: BEFORE failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Unknown error
+# d,fail_convert_partition_11: AFTER failure
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+2
+22
+32
+42
+52
+DROP TABLE t1;
+create or replace table t1 (x int primary key)
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+# d,fail_convert_partition_11: BEFORE failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+LOCK TABLE t1 WRITE;
+alter table t1 convert partition p2 to table tp2;
+ERROR 42S01: Table 'tp2' already exists
+# d,fail_convert_partition_11: AFTER failure (under LOCK TABLE)
+db.opt
+t1#P#p1.MYD
+t1#P#p1.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1#P#p3.MYD
+t1#P#p3.MYI
+t1#P#p4.MYD
+t1#P#p4.MYI
+t1#P#p5.MYD
+t1#P#p5.MYI
+t1#P#pn.MYD
+t1#P#pn.MYI
+t1.frm
+t1.par
+tp2.MYD
+tp2.MYI
+tp2.frm
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = MyISAM,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = MyISAM,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
+SELECT * FROM t1;
+x
+12
+2
+22
+32
+42
+52
+UNLOCK TABLES;
+DROP TABLE t1;
+set session debug_dbug=@save_dbug;
+show create table tp2;
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+select * from tp2;
+x
+12
+drop table tp2;
diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result
index d4ced5e6d6a..4d4538c168e 100644
--- a/mysql-test/suite/parts/r/partition_debug_innodb.result
+++ b/mysql-test/suite/parts/r/partition_debug_innodb.result
@@ -961,25 +961,13 @@ SET @save_dbug=@@debug_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_1";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_1: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1010,9 +998,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_1: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1061,25 +1061,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_2";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_2: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1110,9 +1098,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_2: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1161,25 +1161,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_3";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_3: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1210,9 +1198,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t2' to './test/#sql-exchange' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_3: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1261,25 +1261,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_4";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_4: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1310,9 +1298,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_4: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1361,25 +1361,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_5";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_5: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1410,9 +1398,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_5: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1461,25 +1461,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_6";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_6: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1510,9 +1498,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_6: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1561,25 +1561,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_7";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_7: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1610,9 +1598,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/#sql-exchange' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)")
-# State after failure
+# d,exchange_partition_fail_7: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1661,25 +1661,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_8";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_8: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1710,9 +1698,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_8: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1761,25 +1761,13 @@ SET SESSION debug_dbug=@save_dbug;
SET SESSION debug_dbug="+d,exchange_partition_fail_9";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- `b` varchar(64) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT * FROM t2;
-a b
-5 Original from table t2
-6 Original from table t2
-7 Original from table t2
-8 Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
-# State before failure
+# d,exchange_partition_fail_9: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
@@ -1810,9 +1798,21 @@ a b
24 Original from partition p1
3 Original from partition p0
4 Original from partition p0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+a b
+5 Original from table t2
+6 Original from table t2
+7 Original from table t2
+8 Original from table t2
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
-# State after failure
+# d,exchange_partition_fail_9: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
diff --git a/mysql-test/suite/parts/t/alter_table.combinations b/mysql-test/suite/parts/t/alter_table.combinations
new file mode 100644
index 00000000000..d4feae10f19
--- /dev/null
+++ b/mysql-test/suite/parts/t/alter_table.combinations
@@ -0,0 +1,2 @@
+[range]
+[list]
diff --git a/mysql-test/suite/parts/t/alter_table.test b/mysql-test/suite/parts/t/alter_table.test
index 53b61806acb..741a9450c8e 100644
--- a/mysql-test/suite/parts/t/alter_table.test
+++ b/mysql-test/suite/parts/t/alter_table.test
@@ -1,9 +1,8 @@
-#
-# General errors with ALTER TABLE and partitions that doesn't have to be run
-# on all engines
-#
-
+# Permissions don't work with embedded
+--source include/not_embedded.inc
--source include/have_partition.inc
+--source include/lcase_names.inc
+--source suite/parts/inc/engines.inc
#
# MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER
@@ -38,3 +37,267 @@ CREATE TABLE t2 (i INT);
ALTER TABLE v1 EXCHANGE PARTITION p2 WITH TABLE t2 ;
DROP VIEW v1;
DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-22165 CONVERT PARTITION: move in partition from existing table
+--echo #
+create or replace table tp1 (a int);
+create or replace table t1 (a int)
+partition by hash (a) partitions 2;
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+alter table t1 convert table tp1 to partition p2;
+
+create or replace table t1 (a int)
+partition by range (a)
+(partition p0 values less than (0));
+
+--error ER_NO_SUCH_TABLE
+alter table t1 convert table non_existent to partition p1 values less than (10);
+alter table t1 convert table tp1 to partition p1 values less than (10);
+--error ER_NO_SUCH_TABLE
+show create table tp1;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+
+create table tp2 (x int);
+--error ER_TABLES_DIFFERENT_METADATA
+alter table t1 convert table tp2 to partition p2 values less than (20);
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table tp2;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+
+create or replace table tp2 (a int);
+insert tp2 values (1), (15), (17);
+--error ER_ROW_DOES_NOT_MATCH_PARTITION
+alter table t1 convert table tp2 to partition p2 values less than (20);
+delete from tp2;
+insert tp2 values (15), (1), (17);
+--error ER_ROW_DOES_NOT_MATCH_PARTITION
+alter table t1 convert table tp2 to partition p2 values less than (20);
+delete from tp2;
+insert tp2 values (15), (17), (1);
+--error ER_ROW_DOES_NOT_MATCH_PARTITION
+alter table t1 convert table tp2 to partition p2 values less than (20);
+delete from tp2;
+insert tp2 values (15), (17);
+alter table t1 convert table tp2 to partition p2 values less than (20);
+--error ER_NO_SUCH_TABLE
+show create table tp2;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 partition (p2);
+
+create or replace table t1 (a int)
+partition by range (a) (
+p0 values less than (0),
+pn values less than (30));
+insert into t1 values (1);
+create or replace table tp1 (a int);
+insert into tp1 values (2);
+# TODO: would be good to automatically detect order of partitions,
+# as well as move the data from succeeding partitions (ADD PARTITION FR).
+--error ER_RANGE_NOT_INCREASING_ERROR
+alter table t1 convert table tp1 to partition p1 values less than (10);
+
+drop tables t1, tp1;
+
+
+--echo #
+--echo # MDEV-22166 CONVERT PARTITION: move out partition into a table
+--echo #
+
+create or replace table t1 (x int);
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+alter table t1 convert partition p1 to table tp1;
+
+create or replace table t1 (x int)
+partition by hash(x) partitions 2;
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+alter table t1 convert partition p1 to table tp1;
+
+create or replace table t1 (x int)
+partition by key(x) partitions 2;
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+alter table t1 convert partition p1 to table tp1;
+
+create or replace table t1 (x int)
+partition by range(x)
+subpartition by hash(x) subpartitions 3 (
+ partition p1 values less than (10),
+ partition pn values less than maxvalue);
+--error ER_PARTITION_CONVERT_SUBPARTITIONED
+alter table t1 convert partition p1 to table p1;
+--error ER_PARTITION_DOES_NOT_EXIST
+alter table t1 convert partition p1sp0 to table p1;
+
+create or replace table t1 (x int)
+partition by range(x) (
+ partition p1 values less than (10));
+--error ER_DROP_LAST_PARTITION
+alter table t1 convert partition p1 to table tp1;
+
+--error ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
+create or replace temporary table t1 (x int)
+partition by range(x) (
+ partition p0 values less than (10),
+ partition pn values less than maxvalue);
+
+if ($MTR_COMBINATION_RANGE)
+{
+ create or replace table t1 (x int)
+ partition by range(x) (
+ partition p1 values less than (10),
+ partition p2 values less than (20),
+ partition p3 values less than (30),
+ partition p4 values less than (40),
+ partition p5 values less than (50),
+ partition pn values less than maxvalue);
+}
+
+if ($MTR_COMBINATION_LIST)
+{
+ create or replace table t1 (x int)
+ partition by list(x) (
+ partition p1 values in (2, 3, 4),
+ partition p2 values in (12, 13, 14),
+ partition p3 values in (22, 23, 24),
+ partition p4 values in (32, 33, 34),
+ partition p5 values in (42, 43, 44),
+ partition pn values in (52, 53, 54));
+}
+
+insert into t1 values (2), (12), (22), (32), (42), (52);
+
+create or replace table tp2 (y int);
+insert tp2 values (88);
+# Multiple ALTER PARTITION statements are not possible
+--error ER_PARSE_ERROR
+alter table t1 convert partition p2 to table tp2, drop partition p3;
+# TODO: probably no need in such specific codes, should be ER_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
+alter table t1 convert partition p00 to table tp00;
+# Better error here is ER_PARTITION_DOES_NOT_EXIST,
+# but mysql_alter_table() works checks new table before anything else.
+# So, looks like no big reason to change anything here.
+--error ER_TABLE_EXISTS_ERROR
+alter table t1 convert partition p00 to table tp2;
+--error ER_TABLE_EXISTS_ERROR
+alter table t1 convert partition p2 to table tp2;
+--delimiter $
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create trigger tr1 before update on t1 for each row
+begin
+ alter table t1 convert partition p2 to table tp2;
+end$
+--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
+create function f1() returns int
+begin
+ alter table t1 convert partition p2 to table tp2;
+end$
+--delimiter ;
+select * from tp2;
+drop table tp2;
+alter table t1 convert partition p2 to table tp2;
+
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table tp2;
+select * from tp2;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+
+--error ER_BAD_DB_ERROR
+alter table t1 convert partition p3 to table inexistent.tp3;
+create database EXISTENT;
+alter table t1 convert partition p3 to table EXISTENT.TP3;
+
+# The only way to put `` into var...
+--let $tp3=`select '`TP3`'`
+if ($MTR_COMBINATION_LCASE1)
+{
+ --let $tp3= `select '`tp3`'`
+}
+--replace_result $engine X ' PAGE_CHECKSUM=1' '' $tp3 `TP3`-ok
+show create table EXISTENT.TP3;
+select * from EXISTENT.TP3 order by x;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+
+--echo # LOCK TABLES
+lock tables t1 write;
+alter table t1 convert partition p4 to table tp4;
+# TODO: lock table tp4 in ALTER TABLE, otherwise there is no
+# guarantee in data consistency between t1 and tp4
+--error ER_TABLE_NOT_LOCKED
+show create table tp4;
+
+unlock tables;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table tp4;
+select * from tp4;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+
+--echo # PS
+prepare stmt from 'alter table t1 convert partition p5 to table tp5';
+execute stmt;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table tp5;
+select * from tp5;
+--replace_result $engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+drop table tp5;
+--error ER_PARTITION_DOES_NOT_EXIST
+execute stmt;
+--error ER_PARTITION_DOES_NOT_EXIST
+execute stmt;
+drop prepare stmt;
+
+--echo # Privileges
+create user alan;
+grant usage on *.* to alan;
+grant create, insert, drop on test.* to alan;
+--connect alan,localhost,alan,,test
+show grants for current_user;
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 convert partition p1 to table tp1;
+--connection default
+revoke all on test.* from alan;
+grant create, insert, alter on test.* to alan;
+--connection alan
+use test;
+show grants for current_user;
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 convert partition p1 to table tp1;
+--connection default
+revoke all on test.* from alan;
+grant create, drop, alter on test.* to alan;
+--connection alan
+use test;
+show grants for current_user;
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 convert partition p1 to table tp1;
+--connection default
+revoke all on test.* from alan;
+grant insert, drop, alter on test.* to alan;
+--connection alan
+use test;
+show grants for current_user;
+--error ER_TABLEACCESS_DENIED_ERROR
+alter table t1 convert partition p1 to table tp1;
+--connection default
+grant create, insert, drop, alter on test.* to alan;
+--connection alan
+use test;
+show grants for current_user;
+alter table t1 convert partition p1 to table tp1;
+--disconnect alan
+--connection default
+
+drop database EXISTENT;
+drop user alan;
+drop tables t1, tp1, tp2, tp4;
diff --git a/mysql-test/suite/parts/t/partition_debug.test b/mysql-test/suite/parts/t/partition_debug.test
index 6d7cf3ae8b3..2f8994705f3 100644
--- a/mysql-test/suite/parts/t/partition_debug.test
+++ b/mysql-test/suite/parts/t/partition_debug.test
@@ -50,3 +50,114 @@ let $crash_statement= ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
--source suite/parts/inc/partition_crash_exchange.inc
let $fail_statement= $crash_statement;
--source suite/parts/inc/partition_fail_exchange.inc
+
+--echo #
+--echo # MDEV-22165 CONVERT PARTITION: move in partition from existing table
+--echo #
+let $create_statement= create or replace table t1 (x int primary key)
+ partition by range(x) (
+ partition p1 values less than (10),
+ partition p2 values less than (20),
+ partition p3 values less than (30));
+
+let $create_statement2= create or replace table t2 (x int primary key);
+let $insert_statement= insert into t1 values (2), (12), (22);
+let $insert_statement2= insert into t2 values (32), (42), (52);
+
+let $fail_statement= alter table t1 convert table t2 to partition pn values less than maxvalue;
+
+set @save_dbug=@@debug_dbug;
+set session debug_dbug="+d,fail_convert_partition_1";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_2";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_3";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_4";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_5";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_6";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_7";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_8";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_9";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_11";
+--source suite/parts/inc/partition_fail_t2.inc
+set session debug_dbug=@save_dbug;
+
+
+--echo #
+--echo # MDEV-22166 CONVERT PARTITION: move out partition into a table
+--echo #
+let $create_statement= create or replace table t1 (x int primary key)
+ partition by range(x) (
+ partition p1 values less than (10),
+ partition p2 values less than (20),
+ partition p3 values less than (30),
+ partition p4 values less than (40),
+ partition p5 values less than (50),
+ partition pn values less than maxvalue);
+
+let $insert_statement= insert into t1 values (2), (12), (22), (32), (42), (52);
+let $fail_statement= alter table t1 convert partition p2 to table tp2;
+
+set @save_dbug=@@debug_dbug;
+set session debug_dbug="+d,fail_create_before_create_frm";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_alter_partition_after_write_frm";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,error_convert_partition_00";
+--source suite/parts/inc/partition_fail.inc
+#set session debug_dbug=@save_dbug;
+#set session debug_dbug="+d,fail_convert_partition_01";
+#--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_1";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_2";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_3";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_4";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_5";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_6";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_7";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_8";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_9";
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+set session debug_dbug="+d,fail_convert_partition_11";
+--echo # Already finished DDL logging, so tp2 now exists:
+--source suite/parts/inc/partition_fail.inc
+set session debug_dbug=@save_dbug;
+show create table tp2;
+select * from tp2;
+drop table tp2;
diff --git a/mysql-test/suite/perfschema/r/digest_view.result b/mysql-test/suite/perfschema/r/digest_view.result
index d3988f99727..a5996cc0083 100644
--- a/mysql-test/suite/perfschema/r/digest_view.result
+++ b/mysql-test/suite/perfschema/r/digest_view.result
@@ -191,17 +191,17 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
-test 3bcc75e0f4658692e16837ead0c455ca EXPLAIN SELECT * FROM `test` . `v1` 1
-test cc55af8221ef0bc8873e75cc704489ba EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test bc0498551a492bd7c0ca92906bf86fb4 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test 76923336b6f4ffffd0d5854761ae1aec EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
-test a65d479062ffbfe374b4cd823016a260 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
-test d44b1e50ebfd05accacef4167534ad65 SELECT * FROM `test` . `v1` 1
-test 0608cde507ef8fe35d1f68730e78f1e4 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test 5e241fdb866faef138cc81b26203ddff SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test 74fa770ce44994b3fe7b534d504f2d6d SELECT `a` , `b` FROM `test` . `v1` 1
-test 45ca2a985d179d98395b238cf253bbe2 SELECT `b` , `a` FROM `test` . `v1` 1
-test 1cfa171590aa40ba23e14c92d6940ffc TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test 27a9ab161a63050c84a63c6f77ebeb33 EXPLAIN SELECT * FROM `test` . `v1` 1
+test ab0ab27c04f3a294feb86bede4331f86 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test 2e722346a5c2ef820946bcd04ccac208 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test 07baf2264db30b6b25302603436ebe82 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
+test 3a7dbc963635ab0de6e160e0a4212bce EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
+test 6b845c2e3a7421997e3b610d14b5c842 SELECT * FROM `test` . `v1` 1
+test cb2ee099edbf6e0e5ee6ae14f3b1498a SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test e2dc5a300d2ba54ebb987a2ca6b90d93 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test c68e0f99323f7bb7732c7b5cf32c0ec2 SELECT `a` , `b` FROM `test` . `v1` 1
+test 43c5de955c9a72d2bb6f49db5c0ad3e7 SELECT `b` , `a` FROM `test` . `v1` 1
+test 1678258ba15f7ccc63fd7b833763914a TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN SELECT * from test.v1;
@@ -248,19 +248,19 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
-test 630a0b16be33fcf549f4f467de557940 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
-test efa438aa8b4ddbf4c19f9e4b345781b5 DROP TABLE `test` . `v1` 1
-test 3bcc75e0f4658692e16837ead0c455ca EXPLAIN SELECT * FROM `test` . `v1` 2
-test cc55af8221ef0bc8873e75cc704489ba EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test bc0498551a492bd7c0ca92906bf86fb4 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test 76923336b6f4ffffd0d5854761ae1aec EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
-test a65d479062ffbfe374b4cd823016a260 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
-test d44b1e50ebfd05accacef4167534ad65 SELECT * FROM `test` . `v1` 2
-test 0608cde507ef8fe35d1f68730e78f1e4 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test 5e241fdb866faef138cc81b26203ddff SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test a3788cc4bc96d260cfb5c3ebdfc65c6d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
-test 74fa770ce44994b3fe7b534d504f2d6d SELECT `a` , `b` FROM `test` . `v1` 2
-test 45ca2a985d179d98395b238cf253bbe2 SELECT `b` , `a` FROM `test` . `v1` 2
-test 1cfa171590aa40ba23e14c92d6940ffc TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test 342cd5e41944d5f857f92b1e374857de CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
+test 2653f30030efcb6125121daa8eadf418 DROP TABLE `test` . `v1` 1
+test 27a9ab161a63050c84a63c6f77ebeb33 EXPLAIN SELECT * FROM `test` . `v1` 2
+test ab0ab27c04f3a294feb86bede4331f86 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test 2e722346a5c2ef820946bcd04ccac208 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test 07baf2264db30b6b25302603436ebe82 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
+test 3a7dbc963635ab0de6e160e0a4212bce EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
+test 6b845c2e3a7421997e3b610d14b5c842 SELECT * FROM `test` . `v1` 2
+test cb2ee099edbf6e0e5ee6ae14f3b1498a SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test e2dc5a300d2ba54ebb987a2ca6b90d93 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test a13cfeda6d474d29546719d76dcfa831 SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
+test c68e0f99323f7bb7732c7b5cf32c0ec2 SELECT `a` , `b` FROM `test` . `v1` 2
+test 43c5de955c9a72d2bb6f49db5c0ad3e7 SELECT `b` , `a` FROM `test` . `v1` 2
+test 1678258ba15f7ccc63fd7b833763914a TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
diff --git a/mysql-test/suite/perfschema/r/max_program_zero.result b/mysql-test/suite/perfschema/r/max_program_zero.result
index 5435efb34ae..f236f149a77 100644
--- a/mysql-test/suite/perfschema/r/max_program_zero.result
+++ b/mysql-test/suite/perfschema/r/max_program_zero.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 1
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index df9942a170f..2258cbceea4 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -174,3 +174,16 @@ select object_type, object_schema, object_name
from performance_schema.objects_summary_global_by_type
where object_schema="test";
object_type object_schema object_name
+#
+# MDEV-28344: sys.ps_setup_save and dependent procedures fail
+# with ER_ILLEGAL_HA_CREATE_OPTION
+#
+CREATE TEMPORARY TABLE t1 (t int) ENGINE = PERFORMANCE_SCHEMA;
+ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
+CREATE TEMPORARY TABLE t1 LIKE performance_schema.setup_actors;
+ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
+SET @default_storage_engine_old = @@default_storage_engine;
+SET default_storage_engine = performance_schema;
+CREATE TEMPORARY TABLE t1 (t int);
+ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
+SET @@default_storage_engine = @default_storage_engine_old;
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index 9489c1049e5..4224c3e520d 100644
--- a/mysql-test/suite/perfschema/r/ortho_iter.result
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result
@@ -255,7 +255,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result
index 94cc2b33b49..ab0d18e3227 100644
--- a/mysql-test/suite/perfschema/r/privilege_table_io.result
+++ b/mysql-test/suite/perfschema/r/privilege_table_io.result
@@ -57,7 +57,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
index bfc49fd3480..fda05bf6df5 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
index e9f20398467..7db242f237f 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
index ffb45f4f55f..31ddb4eb3cd 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result
index e271d5a10e6..2a2d42f4d51 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
index 833da22583e..2115c747755 100644
--- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result
+++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result
index e3ff0f514a7..25b8a7b9c1f 100644
--- a/mysql-test/suite/perfschema/r/start_server_innodb.result
+++ b/mysql-test/suite/perfschema/r/start_server_innodb.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
index a2d84753331..13b51569b60 100644
--- a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
+++ b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
event_name digest digest_text sql_text
-statement/sql/select 70a97f8223477a66e716cfcc317193e2 SELECT ? + ? + SELECT ...
-statement/sql/truncate ac4c7fc23914b333e9f40ce317816b8e TRUNCATE TABLE truncat...
+statement/sql/select 1fd0cdb6b5aa22bd0809a39b2dc2ac70 SELECT ? + ? + SELECT ...
+statement/sql/truncate 0a9c405cebde6df4be315dae86ff398a TRUNCATE TABLE truncat...
diff --git a/mysql-test/suite/perfschema/r/start_server_low_index.result b/mysql-test/suite/perfschema/r/start_server_low_index.result
index ffdf9d65b87..b34f86da89f 100644
--- a/mysql-test/suite/perfschema/r/start_server_low_index.result
+++ b/mysql-test/suite/perfschema/r/start_server_low_index.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result
index dbb404f6129..e8bf9f48da8 100644
--- a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result
+++ b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result
index f92b0e6bec6..021ff9f9e3d 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_account.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_account.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
index fefad55c209..0a7f1c601ef 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
index 0c2f65f6ac9..de4ff2f5a72 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
index c3f06b53425..997220d3169 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
index fd39807d567..de81943afe8 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result
index 43111c5ec40..ce156302b22 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_host.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_host.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_index.result b/mysql-test/suite/perfschema/r/start_server_no_index.result
index 15d1184bcbe..d46095841c2 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_index.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_index.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mdl.result b/mysql-test/suite/perfschema/r/start_server_no_mdl.result
index b8de90453ce..c1f7e656dc6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mdl.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result
index 60066264c90..94c8a7da85a 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
index 3353b46bbcb..e44307fdbe6 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
index d41da361733..6647def50c1 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result
index 4919de6bb6c..9b5ad931858 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
index 02a119bdc68..fdd3fe48bf3 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
index ead01ce2d0e..09faadaa4ce 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
index a99f1c0f9be..2d93be52186 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
index 7c148889412..e9eff67712f 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
index dec0680c511..f5b00a114dd 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 0
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
index 20adf1a9f64..d1b3e14d349 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 0
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
index 044f9475041..136c54885bf 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 0
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
index 350f2c6637d..3e2d7acf4ec 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
index d2d7063c32f..5db6987834b 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
index 8bcb3c56a00..69a69986a72 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
index 2a2bf5d3f7c..2f68483cfae 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
index ec6e40acc00..3d131f1a2e0 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 0
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
index b3f1e4cbcf2..95f8f226c41 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 0
diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result
index baf9f761358..b54d6c762e1 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
index cd204f3d811..9182677d8b8 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
index d083484cd7c..ff90c471599 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result
index f5a12e5473d..4535bcd02ed 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result
index 76ae9d5fa4e..f3eefb98a43 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result
index 4bd472a22a9..9ca79837845 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_user.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_user.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
index f59b156ce1e..ee22d5b5bed 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
index cc70572c7ef..adbad8d166f 100644
--- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
+++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result
index a53d591938c..022f7d1096e 100644
--- a/mysql-test/suite/perfschema/r/start_server_off.result
+++ b/mysql-test/suite/perfschema/r/start_server_off.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result
index e3ff0f514a7..25b8a7b9c1f 100644
--- a/mysql-test/suite/perfschema/r/start_server_on.result
+++ b/mysql-test/suite/perfschema/r/start_server_on.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/start_server_variables.result b/mysql-test/suite/perfschema/r/start_server_variables.result
index 7d1d1e05375..65d3a7b55b5 100644
--- a/mysql-test/suite/perfschema/r/start_server_variables.result
+++ b/mysql-test/suite/perfschema/r/start_server_variables.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 10
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result
index 05ec7b0b2b5..264778c06e4 100644
--- a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result
+++ b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result
@@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10
performance_schema_max_socket_instances 1000
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 160
-performance_schema_max_statement_classes 222
+performance_schema_max_statement_classes 221
performance_schema_max_statement_stack 2
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index 848be3beea1..79c23c65616 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -298,3 +298,23 @@ drop tables t1;
select object_type, object_schema, object_name
from performance_schema.objects_summary_global_by_type
where object_schema="test";
+
+--echo #
+--echo # MDEV-28344: sys.ps_setup_save and dependent procedures fail
+--echo # with ER_ILLEGAL_HA_CREATE_OPTION
+--echo #
+
+# It is not allowed to create temporary tables with performance schema
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t1 (t int) ENGINE = PERFORMANCE_SCHEMA;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t1 LIKE performance_schema.setup_actors;
+
+SET @default_storage_engine_old = @@default_storage_engine;
+SET default_storage_engine = performance_schema;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t1 (t int);
+
+SET @@default_storage_engine = @default_storage_engine_old; \ No newline at end of file
diff --git a/mysql-test/suite/plugins/r/auth_ed25519.result b/mysql-test/suite/plugins/r/auth_ed25519.result
index 6769d867167..f5d1ce2497d 100644
--- a/mysql-test/suite/plugins/r/auth_ed25519.result
+++ b/mysql-test/suite/plugins/r/auth_ed25519.result
@@ -27,7 +27,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE AUTHENTICATION
PLUGIN_TYPE_VERSION 2.2
PLUGIN_LIBRARY auth_ed25519.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Elliptic curve ED25519 based authentication
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff
new file mode 100644
index 00000000000..06fdb0bd4f0
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff
@@ -0,0 +1,24 @@
+--- suite/plugins/r/compression.result
++++ suite/plugins/r/compression.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing bzip2 compression provider with innodb
++# Testing lz4 compression provider with innodb
+ #
+ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lz4;
+ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+ call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+@@ -15,8 +15,8 @@
+ 0 abcabcabc 300
+ 1 defdefdef 3000
+ 2 ghighighi 30000
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lz4
+ select a, left(b, 9), length(b) from t1;
+-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
++ERROR HY000: Table test/t1 is compressed with lz4, which is not currently loaded. Please load the lz4 provider plugin to open the table
+ drop table t1;
+ # restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff
new file mode 100644
index 00000000000..ee348934a54
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff
@@ -0,0 +1,24 @@
+--- suite/plugins/r/compression.result
++++ suite/plugins/r/compression.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing bzip2 compression provider with innodb
++# Testing lzma compression provider with innodb
+ #
+ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lzma;
+ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+ call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+@@ -15,8 +15,8 @@
+ 0 abcabcabc 300
+ 1 defdefdef 3000
+ 2 ghighighi 30000
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lzma
+ select a, left(b, 9), length(b) from t1;
+-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
++ERROR HY000: Table test/t1 is compressed with lzma, which is not currently loaded. Please load the lzma provider plugin to open the table
+ drop table t1;
+ # restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff
new file mode 100644
index 00000000000..d7cdc41092a
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff
@@ -0,0 +1,24 @@
+--- suite/plugins/r/compression.result
++++ suite/plugins/r/compression.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing bzip2 compression provider with innodb
++# Testing lzo compression provider with innodb
+ #
+ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = lzo;
+ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+ call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+@@ -15,8 +15,8 @@
+ 0 abcabcabc 300
+ 1 defdefdef 3000
+ 2 ghighighi 30000
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lzo
+ select a, left(b, 9), length(b) from t1;
+-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
++ERROR HY000: Table test/t1 is compressed with lzo, which is not currently loaded. Please load the lzo provider plugin to open the table
+ drop table t1;
+ # restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff
new file mode 100644
index 00000000000..e9c7485d118
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff
@@ -0,0 +1,24 @@
+--- suite/plugins/r/compression.result
++++ suite/plugins/r/compression.reject
+@@ -1,8 +1,8 @@
+ #
+-# Testing bzip2 compression provider with innodb
++# Testing snappy compression provider with innodb
+ #
+ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+-set global innodb_compression_algorithm = bzip2;
++set global innodb_compression_algorithm = snappy;
+ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+ call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+@@ -15,8 +15,8 @@
+ 0 abcabcabc 300
+ 1 defdefdef 3000
+ 2 ghighighi 30000
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-snappy
+ select a, left(b, 9), length(b) from t1;
+-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
++ERROR HY000: Table test/t1 is compressed with snappy, which is not currently loaded. Please load the snappy provider plugin to open the table
+ drop table t1;
+ # restart
diff --git a/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff
new file mode 100644
index 00000000000..9b155ff3a1d
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff
@@ -0,0 +1,40 @@
+--- suite/plugins/r/compression.result
++++ suite/plugins/r/compression.reject
+@@ -1,12 +1,8 @@
+ #
+-# Testing bzip2 compression provider with innodb
++# Testing lz4 compression provider with mroonga
+ #
+ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+-set global innodb_compression_algorithm = bzip2;
+-call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+-call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+-call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+-create table t1 (a int, b text ) engine = innodb page_compressed = 1;
++create table t1 (a int, b text COMMENT 'FLAGS "COLUMN_SCALAR|COMPRESS_LZ4"') engine = mroonga charset = utf8;
+ insert t1 (a, b) values (0, repeat("abc", 100));
+ insert t1 (a, b) values (1, repeat("def", 1000));
+ insert t1 (a, b) values (2, repeat("ghi", 10000));
+@@ -14,8 +11,20 @@
+ 0 abcabcabc 300
+ 1 defdefdef 3000
+ 2 ghighighi 30000
+-# restart: --disable-provider-bzip2
++# restart: --disable-provider-lz4
+ select a, left(b, 9), length(b) from t1;
+-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
++a left(b, 9) length(b)
++0 0
++1 0
++2 0
++Warnings:
++Warning 4185 MariaDB tried to use the LZ4 compression, but its provider plugin is not loaded
++select a, left(b, 9), length(b) from t1;
++a left(b, 9) length(b)
++0 0
++1 0
++2 0
++Warnings:
++Warning 4185 MariaDB tried to use the LZ4 compression, but its provider plugin is not loaded
+ drop table t1;
+ # restart
diff --git a/mysql-test/suite/plugins/r/compression.result b/mysql-test/suite/plugins/r/compression.result
new file mode 100644
index 00000000000..dd267f282c5
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression.result
@@ -0,0 +1,22 @@
+#
+# Testing bzip2 compression provider with innodb
+#
+call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+set global innodb_compression_algorithm = bzip2;
+call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+# restart: --disable-provider-bzip2
+select a, left(b, 9), length(b) from t1;
+ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
+drop table t1;
+# restart
diff --git a/mysql-test/suite/plugins/r/compression_load.result b/mysql-test/suite/plugins/r/compression_load.result
new file mode 100644
index 00000000000..a23037edc17
--- /dev/null
+++ b/mysql-test/suite/plugins/r/compression_load.result
@@ -0,0 +1,33 @@
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+plugin_name plugin_status
+set global innodb_compression_algorithm = lz4;
+ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value of 'lz4'
+install plugin provider_lz4 soname 'provider_lz4';
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+plugin_name plugin_status
+provider_lz4 ACTIVE
+set global innodb_compression_algorithm = lz4;
+create table t1 (a int, b text) engine=innodb page_compressed=1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+uninstall plugin provider_lz4;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+plugin_name plugin_status
+provider_lz4 INACTIVE
+set global innodb_compression_algorithm = default;
+set global innodb_compression_algorithm = lz4;
+set global innodb_compression_algorithm = default;
+select a, left(b, 9), length(b) from t1;
+a left(b, 9) length(b)
+0 abcabcabc 300
+1 defdefdef 3000
+2 ghighighi 30000
+drop table t1;
diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result
index 218d12fb884..192d41d2ccf 100644
--- a/mysql-test/suite/plugins/r/cracklib_password_check.result
+++ b/mysql-test/suite/plugins/r/cracklib_password_check.result
@@ -4,9 +4,9 @@ PLUGIN_NAME cracklib_password_check
PLUGIN_VERSION 1.0
PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
-PLUGIN_TYPE_VERSION 1.0
+PLUGIN_TYPE_VERSION 1.1
PLUGIN_LIBRARY cracklib_password_check.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Password validation via CrackLib
PLUGIN_LICENSE GPL
@@ -37,6 +37,18 @@ show warnings;
Level Code Message
Warning 1819 cracklib: it is based on a dictionary word
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
+grant select on *.* to foocar@localhost identified by 'localhost';
+ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
+show warnings;
+Level Code Message
+Warning 1819 cracklib: it is based upon your password entry
+Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
+grant select on *.* to foocar@localhost identified by 'foocar@localhost';
+ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
+show warnings;
+Level Code Message
+Warning 1819 cracklib: it is derived from your password entry
+Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
grant select on *.* to foobar identified by 'q$%^&*rty';
drop user foobar;
#
diff --git a/mysql-test/suite/plugins/r/password_reuse_check.result b/mysql-test/suite/plugins/r/password_reuse_check.result
new file mode 100644
index 00000000000..72f3dd5364b
--- /dev/null
+++ b/mysql-test/suite/plugins/r/password_reuse_check.result
@@ -0,0 +1,94 @@
+install soname "password_reuse_check";
+set global password_reuse_check_interval= 0;
+# Default value (sould be unlimited i.e. 0)
+SHOW GLOBAL VARIABLES like "password_reuse_check%";
+Variable_name Value
+password_reuse_check_interval 0
+# insert user
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check)
+show warnings;
+Level Code Message
+Warning 1819 password_reuse_check: The password was already used
+Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check)
+alter user user_name@localhost identified by 'test_pwd';
+ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
+show warnings;
+Level Code Message
+Warning 1819 password_reuse_check: The password was already used
+Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check)
+Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
+# check exparation
+set global password_reuse_check_interval= 10;
+alter user user_name@localhost identified by 'test_pwd';
+ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
+show warnings;
+Level Code Message
+Warning 1819 password_reuse_check: The password was already used
+Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check)
+Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
+select hex(hash) from mysql.password_reuse_check_history;
+hex(hash)
+B9F970DE4DA0145F842526C1BC9DBBBDB3EF80FDD7BE98061DAE3D18F492AA37668C07322DD21650C66B48FC78F0EAF6CB08245CC895BFDC43BE6921B07E5240
+# emulate old password
+update mysql.password_reuse_check_history set time= date_sub(now(), interval
+11 day);
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+Level Code Message
+drop user user_name@localhost;
+show create table mysql.password_reuse_check_history;
+Table Create Table
+password_reuse_check_history CREATE TABLE `password_reuse_check_history` (
+ `hash` binary(64) NOT NULL,
+ `time` timestamp NOT NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`hash`),
+ KEY `tm` (`time`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+select count(*) from mysql.password_reuse_check_history;
+count(*)
+1
+drop table mysql.password_reuse_check_history;
+# test error messages
+set global password_reuse_check_interval= 0;
+drop table if exists mysql.password_reuse_check_history;
+Warnings:
+Note 1051 Unknown table 'mysql.password_reuse_check_history'
+# test error messages
+create table mysql.password_reuse_check_history (wrong_structure int);
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check)
+show warnings;
+Level Code Message
+Warning 1105 password_reuse_check:[1054] Unknown column 'hash' in 'field list'
+Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check)
+set global password_reuse_check_interval= 10;
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check)
+show warnings;
+Level Code Message
+Warning 1105 password_reuse_check:[1054] Unknown column 'time' in 'where clause'
+Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check)
+drop table mysql.password_reuse_check_history;
+#
+# MDEV-28838: password_reuse_check plugin mixes username and password
+#
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+grant select on *.* to user_nam@localhost identified by 'etest_pwd';
+show warnings;
+Level Code Message
+drop user user_name@localhost;
+drop user user_nam@localhost;
+drop table mysql.password_reuse_check_history;
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+grant select on *.* to tuser_name@localhos identified by 'test_pwd';
+show warnings;
+Level Code Message
+drop user user_name@localhost;
+drop user tuser_name@localhos;
+#
+# End of 10.7 tests
+#
+drop table mysql.password_reuse_check_history;
+uninstall plugin password_reuse_check;
diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result
index 3bdaf39d0d0..ebd5b6cc198 100644
--- a/mysql-test/suite/plugins/r/show_all_plugins.result
+++ b/mysql-test/suite/plugins/r/show_all_plugins.result
@@ -4,8 +4,8 @@ Variable_name Value
Opened_plugin_libraries 0
select * from information_schema.all_plugins where plugin_library='ha_example.so';
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION
-EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.14 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
-UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.14 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
+EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.15 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
+UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.15 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
show status like '%libraries%';
Variable_name Value
Opened_plugin_libraries 1
diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result
index ab6988ed002..30f68ba8193 100644
--- a/mysql-test/suite/plugins/r/simple_password_check.result
+++ b/mysql-test/suite/plugins/r/simple_password_check.result
@@ -4,9 +4,9 @@ PLUGIN_NAME simple_password_check
PLUGIN_VERSION 1.0
PLUGIN_STATUS ACTIVE
PLUGIN_TYPE PASSWORD VALIDATION
-PLUGIN_TYPE_VERSION 1.0
+PLUGIN_TYPE_VERSION 1.1
PLUGIN_LIBRARY simple_password_check.so
-PLUGIN_LIBRARY_VERSION 1.14
+PLUGIN_LIBRARY_VERSION 1.15
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Simple password strength checks
PLUGIN_LICENSE GPL
diff --git a/mysql-test/suite/plugins/r/test_sql_service.result b/mysql-test/suite/plugins/r/test_sql_service.result
index af414d6c6e7..e5f09b67b6b 100644
--- a/mysql-test/suite/plugins/r/test_sql_service.result
+++ b/mysql-test/suite/plugins/r/test_sql_service.result
@@ -1,8 +1,100 @@
+reset master;
install plugin test_sql_service soname 'test_sql_service';
+show status like 'test_sql_service_passed';
+Variable_name Value
+Test_sql_service_passed 1
+set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null';
+set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null';
+select * from t1 order by a;
+a @@SQL_LOG_BIN
+1 0
+2 0
+3 1
+4 0
+5 1
+6 0
+drop table t1;
+SET SQL_LOG_BIN=0;
set global test_sql_service_run_test= 1;
-show status like 'test_sql_service%';
+show status like 'test_sql_service_passed';
+Variable_name Value
+Test_sql_service_passed 1
+set global test_sql_service_execute_sql_local= 'create table test.t1(id int)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 0 rows.
+set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 2 rows.
+set global test_sql_service_execute_sql_local= 'select * from test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query returned 2 rows.
+set global test_sql_service_execute_sql_local= 'drop table test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 0 rows.
+set global test_sql_service_execute_sql_local= 'drop table test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Error 1051 returned. Unknown table 'test.t1'
+set global test_sql_service_execute_sql_global= 'create table test.t1(id int)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 0 rows.
+set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 2 rows.
+set global test_sql_service_execute_sql_global= 'select * from test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query returned 2 rows.
+set global test_sql_service_execute_sql_global= 'drop table test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query affected 0 rows.
+set global test_sql_service_execute_sql_global= 'drop table test.t1';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Error 1051 returned. Unknown table 'test.t1'
+create table t1 (id int, time timestamp);
+insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL);
+set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query returned 0 rows.
+set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query returned 5 rows.
+set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
+show status like 'test_sql_query_result';
+Variable_name Value
+Test_sql_query_result Query returned 0 rows.
+set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()';
+show status like 'test_sql_query_result';
Variable_name Value
-Test_sql_service_passed 0
+Test_sql_query_result Query returned 5 rows.
+drop table t1;
uninstall plugin test_sql_service;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # insert into test.t1 select 3 as a, @@SQL_LOG_BIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/suite/plugins/t/compression.combinations b/mysql-test/suite/plugins/t/compression.combinations
new file mode 100644
index 00000000000..645ca60e5f0
--- /dev/null
+++ b/mysql-test/suite/plugins/t/compression.combinations
@@ -0,0 +1,29 @@
+[innodb-bzip2]
+innodb
+plugin-load-add=$PROVIDER_BZIP2_SO
+loose-provider-bzip2
+
+[innodb-lz4]
+innodb
+plugin-load-add=$PROVIDER_LZ4_SO
+loose-provider-lz4
+
+[innodb-lzma]
+innodb
+plugin-load-add=$PROVIDER_LZMA_SO
+loose-provider-lzma
+
+[innodb-lzo]
+innodb
+plugin-load-add=$PROVIDER_LZO_SO
+loose-provider-lzo
+
+[innodb-snappy]
+innodb
+plugin-load-add=$PROVIDER_SNAPPY_SO
+loose-provider-snappy
+
+[mroonga-lz4]
+plugin-load-add=$HA_MROONGA_SO
+plugin-load-add=$PROVIDER_LZ4_SO
+loose-provider-lz4
diff --git a/mysql-test/suite/plugins/t/compression.test b/mysql-test/suite/plugins/t/compression.test
new file mode 100644
index 00000000000..c97c5725e1d
--- /dev/null
+++ b/mysql-test/suite/plugins/t/compression.test
@@ -0,0 +1,52 @@
+let $engine=`select regexp_replace('$MTR_COMBINATIONS', '-.*', '')`;
+let $alg=`select regexp_replace('$MTR_COMBINATIONS', '.*-', '')`;
+
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = '$engine' and plugin_status='active'`)
+{
+ skip Needs $engine engine;
+}
+
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'provider_$alg' and plugin_status='active'`)
+{
+ skip Needs provider_$alg plugin;
+}
+
+--echo #
+--echo # Testing $alg compression provider with $engine
+--echo #
+
+call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provider plugin is not loaded");
+if ($engine == "innodb") {
+ eval set global innodb_compression_algorithm = $alg;
+ let $table_params = page_compressed = 1;
+ call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
+ call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
+}
+if ($engine == "mroonga") {
+ let $column_params = `select upper('COMMENT \'flags "COLUMN_SCALAR|COMPRESS_$alg"\'')`;
+ let $table_params = charset = utf8;
+}
+
+eval create table t1 (a int, b text $column_params) engine = $engine $table_params;
+
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+
+let $restart_parameters = --disable-provider-$alg;
+source include/restart_mysqld.inc;
+
+if ($engine == "innodb") {
+ error ER_PROVIDER_NOT_LOADED;
+ select a, left(b, 9), length(b) from t1;
+}
+if ($engine == "mroonga"){
+ select a, left(b, 9), length(b) from t1;
+ select a, left(b, 9), length(b) from t1; # a warning once per statement
+}
+drop table t1;
+
+let $restart_parameters =;
+source include/restart_mysqld.inc;
diff --git a/mysql-test/suite/plugins/t/compression_load.test b/mysql-test/suite/plugins/t/compression_load.test
new file mode 100644
index 00000000000..d67c204e75f
--- /dev/null
+++ b/mysql-test/suite/plugins/t/compression_load.test
@@ -0,0 +1,24 @@
+source include/have_innodb.inc;
+
+if (!$PROVIDER_LZ4_SO) {
+ skip Requires provider_lz4 plugin;
+}
+
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_compression_algorithm = lz4;
+install plugin provider_lz4 soname 'provider_lz4';
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+set global innodb_compression_algorithm = lz4;
+create table t1 (a int, b text) engine=innodb page_compressed=1;
+insert t1 (a, b) values (0, repeat("abc", 100));
+insert t1 (a, b) values (1, repeat("def", 1000));
+insert t1 (a, b) values (2, repeat("ghi", 10000));
+select a, left(b, 9), length(b) from t1;
+uninstall plugin provider_lz4;
+select plugin_name, plugin_status from information_schema.plugins where plugin_name='provider_lz4';
+set global innodb_compression_algorithm = default;
+set global innodb_compression_algorithm = lz4;
+set global innodb_compression_algorithm = default;
+select a, left(b, 9), length(b) from t1;
+drop table t1;
diff --git a/mysql-test/suite/plugins/t/cracklib_password_check.test b/mysql-test/suite/plugins/t/cracklib_password_check.test
index 89b53b656d6..0fbef757e30 100644
--- a/mysql-test/suite/plugins/t/cracklib_password_check.test
+++ b/mysql-test/suite/plugins/t/cracklib_password_check.test
@@ -27,6 +27,14 @@ show warnings;
grant select on *.* to foobar identified by 'qwerty';
show warnings;
+--error ER_NOT_VALID_PASSWORD
+grant select on *.* to foocar@localhost identified by 'localhost';
+show warnings;
+
+--error ER_NOT_VALID_PASSWORD
+grant select on *.* to foocar@localhost identified by 'foocar@localhost';
+show warnings;
+
grant select on *.* to foobar identified by 'q$%^&*rty';
drop user foobar;
diff --git a/mysql-test/suite/plugins/t/password_reuse_check.test b/mysql-test/suite/plugins/t/password_reuse_check.test
new file mode 100644
index 00000000000..16ff21dc454
--- /dev/null
+++ b/mysql-test/suite/plugins/t/password_reuse_check.test
@@ -0,0 +1,100 @@
+--source include/not_embedded.inc
+
+if (!$PASSWORD_REUSE_CHECK_SO) {
+ skip No PASSWORD_REUSE_CHECK plugin;
+}
+
+install soname "password_reuse_check";
+
+set global password_reuse_check_interval= 0;
+
+--echo # Default value (sould be unlimited i.e. 0)
+SHOW GLOBAL VARIABLES like "password_reuse_check%";
+
+--echo # insert user
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+
+--error ER_NOT_VALID_PASSWORD
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+show warnings;
+
+--error ER_CANNOT_USER
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+
+# Plugin does not work for it
+#--error ER_NOT_VALID_PASSWORD
+#SET PASSWORD FOR user_name@localhost = PASSWORD('test_pwd');
+
+--echo # check exparation
+
+set global password_reuse_check_interval= 10;
+
+--error ER_CANNOT_USER
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+select hex(hash) from mysql.password_reuse_check_history;
+
+--echo # emulate old password
+update mysql.password_reuse_check_history set time= date_sub(now(), interval
+11 day);
+
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+
+drop user user_name@localhost;
+
+show create table mysql.password_reuse_check_history;
+select count(*) from mysql.password_reuse_check_history;
+
+drop table mysql.password_reuse_check_history;
+
+--echo # test error messages
+
+set global password_reuse_check_interval= 0;
+
+drop table if exists mysql.password_reuse_check_history;
+
+--echo # test error messages
+
+create table mysql.password_reuse_check_history (wrong_structure int);
+
+--error ER_NOT_VALID_PASSWORD
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+show warnings;
+
+set global password_reuse_check_interval= 10;
+
+--error ER_NOT_VALID_PASSWORD
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+show warnings;
+
+drop table mysql.password_reuse_check_history;
+
+--echo #
+--echo # MDEV-28838: password_reuse_check plugin mixes username and password
+--echo #
+
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+
+grant select on *.* to user_nam@localhost identified by 'etest_pwd';
+show warnings;
+
+drop user user_name@localhost;
+drop user user_nam@localhost;
+drop table mysql.password_reuse_check_history;
+
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+
+grant select on *.* to tuser_name@localhos identified by 'test_pwd';
+show warnings;
+
+drop user user_name@localhost;
+drop user tuser_name@localhos;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
+
+drop table mysql.password_reuse_check_history;
+uninstall plugin password_reuse_check;
diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test
index 9b9e29c6913..0a45cb663f4 100644
--- a/mysql-test/suite/plugins/t/test_sql_service.test
+++ b/mysql-test/suite/plugins/t/test_sql_service.test
@@ -1,4 +1,7 @@
--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+reset master; # clear binlogs
if (!$TEST_SQL_SERVICE_SO) {
skip No TEST_SQL_SERVICE plugin;
@@ -9,9 +12,72 @@ let count_sessions= 1;
source include/wait_until_count_sessions.inc;
install plugin test_sql_service soname 'test_sql_service';
+show status like 'test_sql_service_passed';
+
+set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 3 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=0';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 4 as a, @@SQL_LOG_BIN';
+set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=1';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 5 as a, @@sql_auto_is_null';
+set global test_sql_service_execute_sql_global= 'SET sql_auto_is_null=0';
+set global test_sql_service_execute_sql_global= 'insert into test.t1 select 6 as a, @@sql_auto_is_null';
+select * from t1 order by a;
+drop table t1;
+SET SQL_LOG_BIN=0;
set global test_sql_service_run_test= 1;
-show status like 'test_sql_service%';
+show status like 'test_sql_service_passed';
+
+set global test_sql_service_execute_sql_local= 'create table test.t1(id int)';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_local= 'insert into test.t1 values (1), (2)';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_local= 'select * from test.t1';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_local= 'drop table test.t1';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_local= 'drop table test.t1';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_global= 'create table test.t1(id int)';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_global= 'insert into test.t1 values (1), (2)';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_global= 'select * from test.t1';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_global= 'drop table test.t1';
+show status like 'test_sql_query_result';
+
+set global test_sql_service_execute_sql_global= 'drop table test.t1';
+show status like 'test_sql_query_result';
+
+create table t1 (id int, time timestamp);
+insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL);
+set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
+show status like 'test_sql_query_result';
+set global test_sql_service_execute_sql_global= 'select * FROM test.t1 WHERE time <= NOW()';
+show status like 'test_sql_query_result';
+set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time < DATE_SUB(NOW(), interval 5 minute)';
+show status like 'test_sql_query_result';
+set global test_sql_service_execute_sql_local= 'select * FROM test.t1 WHERE time <= NOW()';
+show status like 'test_sql_query_result';
+drop table t1;
uninstall plugin test_sql_service;
+# Check that statements were executed/binlogged in correct order.
+source include/show_binlog_events.inc;
+# --replace_column 2 # 5 #
+# --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
+# SHOW BINLOG EVENTS LIMIT 3,100;
+
diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result
index 249fb8198a7..8b5e36d8b3c 100644
--- a/mysql-test/suite/roles/definer.result
+++ b/mysql-test/suite/roles/definer.result
@@ -321,7 +321,9 @@ CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1,10,100),(2,20,200);
+INSERT INTO `t1` VALUES
+(1,10,100),
+(2,20,200);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
@@ -330,7 +332,8 @@ CREATE TABLE `t2` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t2` VALUES (2,20,200);
+INSERT INTO `t2` VALUES
+(2,20,200);
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
diff --git a/mysql-test/suite/rpl/include/rpl_extra_col_master.test b/mysql-test/suite/rpl/include/rpl_extra_col_master.test
index 02645a577f5..0d397b7e3ba 100644
--- a/mysql-test/suite/rpl/include/rpl_extra_col_master.test
+++ b/mysql-test/suite/rpl/include/rpl_extra_col_master.test
@@ -825,7 +825,7 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
--echo *****************
--echo
connection slave;
-# 1072 = ER_KEY_COLUMN_DOES_NOT_EXITS
+# 1072 = ER_KEY_COLUMN_DOES_NOT_EXIST
--let $slave_sql_errno= 1072
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
index bb1a2c173de..e9e1fd512b4 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
@@ -29,7 +29,7 @@ INSERT INTO t2 VALUES(1, 't2, text 1');
--echo
--echo ******************** DELETE ********************
DELETE FROM t1 WHERE a = 1;
-DELETE FROM t2 WHERE b <> UUID();
+DELETE FROM t2 WHERE b <> SYS_GUID();
--source suite/rpl/include/rpl_mixed_check_select.inc
--source suite/rpl/include/rpl_mixed_clear_tables.inc
@@ -37,7 +37,7 @@ DELETE FROM t2 WHERE b <> UUID();
--echo
--echo ******************** INSERT ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
-INSERT INTO t1 VALUES(2, UUID());
+INSERT INTO t1 VALUES(2, SYS_GUID());
INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1';
DELETE FROM t1 WHERE a = 2;
@@ -60,7 +60,7 @@ INSERT INTO t1 VALUES(1, 't1, text 1');
INSERT INTO t1 VALUES(2, 't1, text 2');
INSERT INTO t1 VALUES(3, 't1, text 3');
REPLACE INTO t1 VALUES(1, 't1, text 11');
-REPLACE INTO t1 VALUES(2, UUID());
+REPLACE INTO t1 VALUES(2, SYS_GUID());
REPLACE INTO t1 SET a=3, b='t1, text 33';
DELETE FROM t1 WHERE a = 2;
--source suite/rpl/include/rpl_mixed_check_select.inc
@@ -70,7 +70,7 @@ DELETE FROM t1 WHERE a = 2;
--echo
--echo ******************** SELECT ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
-SELECT * FROM t1 WHERE b <> UUID() ORDER BY a;
+SELECT * FROM t1 WHERE b <> SYS_GUID() ORDER BY a;
--source suite/rpl/include/rpl_mixed_clear_tables.inc
# JOIN
@@ -89,7 +89,7 @@ SELECT * FROM t1 INNER JOIN t2 ON t1.b = t2.b ORDER BY t1.a,t2.a;
--echo ******************** UNION ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
INSERT INTO t2 VALUES(1, 't2, text 1');
-SELECT * FROM t1 UNION SELECT * FROM t2 WHERE t2.b <> UUID();
+SELECT * FROM t1 UNION SELECT * FROM t2 WHERE t2.b <> SYS_GUID();
--source suite/rpl/include/rpl_mixed_clear_tables.inc
# TRUNCATE
@@ -144,7 +144,7 @@ START TRANSACTION;
INSERT INTO t1 VALUES (5, 'before savepoint s2');
SAVEPOINT s2;
INSERT INTO t1 VALUES (6, 'after savepoint s2');
-INSERT INTO t1 VALUES (7, CONCAT('with UUID() ',UUID()));
+INSERT INTO t1 VALUES (7, CONCAT('with SYS_GUID() ',SYS_GUID()));
RELEASE SAVEPOINT s2;
COMMIT;
DELETE FROM t1 WHERE a = 7;
@@ -257,7 +257,7 @@ BEGIN
END|
CREATE PROCEDURE p2 ()
BEGIN
- UPDATE t1 SET b = UUID() WHERE a = 202;
+ UPDATE t1 SET b = SYS_GUID() WHERE a = 202;
END|
DELIMITER ;|
INSERT INTO t1 VALUES(201, 'test 201');
@@ -309,7 +309,7 @@ DROP EVENT e2;
INSERT INTO t1 VALUES(1, 'test1');
INSERT INTO t1 VALUES(2, 'test2');
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1;
-CREATE VIEW v2 AS SELECT * FROM t1 WHERE b <> UUID();
+CREATE VIEW v2 AS SELECT * FROM t1 WHERE b <> SYS_GUID();
--source suite/rpl/include/rpl_mixed_check_view.inc
ALTER VIEW v1 AS SELECT * FROM t1 WHERE a = 2;
--source suite/rpl/include/rpl_mixed_check_view.inc
@@ -323,7 +323,7 @@ DROP VIEW v2;
--echo ******************** SHOW BINLOG EVENTS ********************
--source include/show_binlog_events.inc
sync_slave_with_master;
-# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
+# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_SYS_GUID
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
diff --git a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc b/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc
index 31b80732c60..d814a257711 100644
--- a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc
+++ b/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc
@@ -10,7 +10,7 @@
# - Master is switching explicitly between STATEMENT, ROW, and MIXED
# binlog format showing when it is possible and when not.
# - Master switching from MIXED to RBR implicitly listing all use
-# cases, e.g a query invokes UUID(), thereafter to serve as the
+# cases, e.g a query invokes SYS_GUID(), thereafter to serve as the
# definition of MIXED binlog format
# - correctness of execution
@@ -56,18 +56,18 @@ select @@global.binlog_format, @@session.binlog_format;
CREATE TABLE t1 (a varchar(100));
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_1_";
insert into t1 values("work_2_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
+insert into t1 values(concat(SYS_GUID(),"work_3_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_4_",UUID()));
+insert into t1 values(concat("for_4_",SYS_GUID()));
insert into t1 select "yesterday_5_";
# verify that temp tables prevent a switch to SBR
@@ -129,41 +129,41 @@ select @@global.binlog_format, @@session.binlog_format;
set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_17_";
insert into t1 values("work_18_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
+insert into t1 values(concat(SYS_GUID(),"work_19_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_20_",UUID()));
+insert into t1 values(concat("for_20_",SYS_GUID()));
insert into t1 select "yesterday_21_";
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
+insert into t1 values(concat(SYS_GUID(),"work_22_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_23_",UUID()));
+insert into t1 values(concat("for_23_",SYS_GUID()));
insert into t1 select "yesterday_24_";
# Test of CREATE TABLE SELECT
-create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
+create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
+create table t3 select 1 union select SYS_GUID();
--disable_warnings
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
--enable_warnings
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-# what if UUID() is first:
+# what if SYS_GUID() is first:
--disable_warnings
-insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
--enable_warnings
# inside a stored procedure
@@ -172,14 +172,14 @@ delimiter |;
create procedure foo()
begin
insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
+insert into t1 values(concat("for_26_",SYS_GUID()));
insert into t1 select "yesterday_27_";
end|
create procedure foo2()
begin
-insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values(concat("emergency_28_",SYS_GUID()));
insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
+insert into t1 values(concat("for_30_",SYS_GUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work_31_");
set session binlog_format=mixed;
@@ -199,7 +199,7 @@ delimiter ;|
call foo();
call foo2();
call foo4("hello");
-call foo4(UUID());
+call foo4(SYS_GUID());
call foo4("world");
# test that can't SET in a stored function
@@ -249,7 +249,7 @@ deallocate prepare stmt1;
delimiter |;
create function foo5() returns bigint unsigned
begin
- insert into t2 select UUID();
+ insert into t2 select SYS_GUID();
return 100;
end|
delimiter ;|
@@ -260,7 +260,7 @@ execute stmt1;
execute stmt1;
deallocate prepare stmt1;
-# A simple stored function where UUID() is in the argument
+# A simple stored function where SYS_GUID() is in the argument
delimiter |;
create function foo6(x varchar(100)) returns bigint unsigned
begin
@@ -269,17 +269,17 @@ begin
end|
delimiter ;|
select foo6("foo6_1_");
-select foo6(concat("foo6_2_",UUID()));
+select foo6(concat("foo6_2_",SYS_GUID()));
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
-# Test of views using UUID()
+# Test of views using SYS_GUID()
-create view v1 as select uuid();
+create view v1 as select SYS_GUID();
create table t11 (data varchar(255));
insert into t11 select * from v1;
# Test of querying INFORMATION_SCHEMA which parses the view's body,
@@ -291,18 +291,18 @@ execute stmt1;
execute stmt1;
deallocate prepare stmt1;
-# Test of triggers with UUID()
+# Test of triggers with SYS_GUID()
delimiter |;
create trigger t11_bi before insert on t11 for each row
begin
- set NEW.data = concat(NEW.data,UUID());
+ set NEW.data = concat(NEW.data,SYS_GUID());
end|
delimiter ;|
insert into t11 values("try_560_");
# Test that INSERT DELAYED works in mixed mode (BUG#20649)
insert delayed into t2 values("delay_1_");
-insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
insert delayed into t2 values("delay_6_");
# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
@@ -482,7 +482,7 @@ sync_slave_with_master;
# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
# Slave used to have only 2 rows instead of 3.
connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
+CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
# we'll verify that this one is done RBB
@@ -546,7 +546,7 @@ DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
+INSERT INTO t12 VALUES(SYS_GUID());
UNLOCK TABLES;
sync_slave_with_master;
@@ -587,7 +587,7 @@ INSERT INTO t13 VALUES (my_current_user());
sync_slave_with_master;
-# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
+# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_UUID
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 7dd3907f102..513bc26a1cc 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -33,7 +33,7 @@ INSERT INTO t2 VALUES(1, 't2, text 1');
******************** DELETE ********************
DELETE FROM t1 WHERE a = 1;
-DELETE FROM t2 WHERE b <> UUID();
+DELETE FROM t2 WHERE b <> SYS_GUID();
SELECT COUNT(*) FROM t1;
COUNT(*)
1
@@ -64,7 +64,7 @@ DELETE FROM t2;
******************** INSERT ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
-INSERT INTO t1 VALUES(2, UUID());
+INSERT INTO t1 VALUES(2, SYS_GUID());
INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1';
DELETE FROM t1 WHERE a = 2;
@@ -143,7 +143,7 @@ INSERT INTO t1 VALUES(1, 't1, text 1');
INSERT INTO t1 VALUES(2, 't1, text 2');
INSERT INTO t1 VALUES(3, 't1, text 3');
REPLACE INTO t1 VALUES(1, 't1, text 11');
-REPLACE INTO t1 VALUES(2, UUID());
+REPLACE INTO t1 VALUES(2, SYS_GUID());
REPLACE INTO t1 SET a=3, b='t1, text 33';
DELETE FROM t1 WHERE a = 2;
SELECT COUNT(*) FROM t1;
@@ -178,7 +178,7 @@ DELETE FROM t2;
******************** SELECT ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
-SELECT * FROM t1 WHERE b <> UUID() ORDER BY a;
+SELECT * FROM t1 WHERE b <> SYS_GUID() ORDER BY a;
a b
1 t1, text 1
DELETE FROM t1;
@@ -203,7 +203,7 @@ DELETE FROM t2;
******************** UNION ********************
INSERT INTO t1 VALUES(1, 't1, text 1');
INSERT INTO t2 VALUES(1, 't2, text 1');
-SELECT * FROM t1 UNION SELECT * FROM t2 WHERE t2.b <> UUID();
+SELECT * FROM t1 UNION SELECT * FROM t2 WHERE t2.b <> SYS_GUID();
a b
1 t1, text 1
1 t2, text 1
@@ -430,7 +430,7 @@ START TRANSACTION;
INSERT INTO t1 VALUES (5, 'before savepoint s2');
SAVEPOINT s2;
INSERT INTO t1 VALUES (6, 'after savepoint s2');
-INSERT INTO t1 VALUES (7, CONCAT('with UUID() ',UUID()));
+INSERT INTO t1 VALUES (7, CONCAT('with SYS_GUID() ',SYS_GUID()));
RELEASE SAVEPOINT s2;
COMMIT;
DELETE FROM t1 WHERE a = 7;
@@ -598,7 +598,7 @@ UPDATE t1 SET b = 'test' WHERE a = 201;
END|
CREATE PROCEDURE p2 ()
BEGIN
-UPDATE t1 SET b = UUID() WHERE a = 202;
+UPDATE t1 SET b = SYS_GUID() WHERE a = 202;
END|
INSERT INTO t1 VALUES(201, 'test 201');
CALL p1();
@@ -790,7 +790,7 @@ DELETE FROM t2;
INSERT INTO t1 VALUES(1, 'test1');
INSERT INTO t1 VALUES(2, 'test2');
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1;
-CREATE VIEW v2 AS SELECT * FROM t1 WHERE b <> UUID();
+CREATE VIEW v2 AS SELECT * FROM t1 WHERE b <> SYS_GUID();
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`,`t1`.`b` AS `b` from `t1` where `t1`.`a` = 1 latin1 latin1_swedish_ci
@@ -850,7 +850,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # DELETE FROM t2 WHERE b <> UUID()
+master-bin.000001 # Annotate_rows # # DELETE FROM t2 WHERE b <> SYS_GUID()
master-bin.000001 # Table_map # # table_id: # (test_rpl.t2)
master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -864,7 +864,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES(2, UUID())
+master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES(2, SYS_GUID())
master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -912,7 +912,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; REPLACE INTO t1 VALUES(1, 't1, text 11')
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # REPLACE INTO t1 VALUES(2, UUID())
+master-bin.000001 # Annotate_rows # # REPLACE INTO t1 VALUES(2, SYS_GUID())
master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -1007,7 +1007,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2')
master-bin.000001 # Query # # SAVEPOINT `s2`
master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2')
-master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (7, CONCAT('with UUID() ',UUID()))
+master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (7, CONCAT('with SYS_GUID() ',SYS_GUID()))
master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -1049,7 +1049,7 @@ END
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
BEGIN
-UPDATE t1 SET b = UUID() WHERE a = 202;
+UPDATE t1 SET b = SYS_GUID() WHERE a = 202;
END
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(201, 'test 201')
@@ -1061,7 +1061,7 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(202, 'test 202')
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # UPDATE t1 SET b = UUID() WHERE a = 202
+master-bin.000001 # Annotate_rows # # UPDATE t1 SET b = SYS_GUID() WHERE a = 202
master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -1124,7 +1124,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 1
master-bin.000001 # Gtid # # GTID #-#-#
-master-bin.000001 # Query # # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> UUID()
+master-bin.000001 # Query # # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> SYS_GUID()
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test_rpl`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 2
master-bin.000001 # Gtid # # GTID #-#-#
diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
index 936f604be2e..71332034b15 100644
--- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
@@ -41,16 +41,16 @@ select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
ROW ROW
CREATE TABLE t1 (a varchar(100));
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_1_";
insert into t1 values("work_2_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
+insert into t1 values(concat(SYS_GUID(),"work_3_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_4_",UUID()));
+insert into t1 values(concat("for_4_",SYS_GUID()));
insert into t1 select "yesterday_5_";
create temporary table tmp(a char(100));
insert into tmp values("see_6_");
@@ -116,43 +116,43 @@ set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
set @string="emergency_17_";
insert into t1 values("work_18_");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
+insert into t1 values(concat(SYS_GUID(),"work_19_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_20_",UUID()));
+insert into t1 values(concat("for_20_",SYS_GUID()));
insert into t1 select "yesterday_21_";
prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
+insert into t1 values(concat(SYS_GUID(),"work_22_"));
execute stmt1 using @string;
deallocate prepare stmt1;
-insert into t1 values(concat("for_23_",UUID()));
+insert into t1 values(concat("for_23_",SYS_GUID()));
insert into t1 select "yesterday_24_";
-create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
+create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
+create table t3 select 1 union select SYS_GUID();
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
Warnings:
Warning 1292 Truncated incorrect datetime value: '3'
-insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
create procedure foo()
begin
insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
+insert into t1 values(concat("for_26_",SYS_GUID()));
insert into t1 select "yesterday_27_";
end|
create procedure foo2()
begin
-insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values(concat("emergency_28_",SYS_GUID()));
insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
+insert into t1 values(concat("for_30_",SYS_GUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work_31_");
set session binlog_format=mixed;
@@ -171,7 +171,7 @@ end|
call foo();
call foo2();
call foo4("hello");
-call foo4(UUID());
+call foo4(SYS_GUID());
call foo4("world");
select foo3();
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
@@ -207,7 +207,7 @@ foo4()
deallocate prepare stmt1;
create function foo5() returns bigint unsigned
begin
-insert into t2 select UUID();
+insert into t2 select SYS_GUID();
return 100;
end|
select foo5();
@@ -229,18 +229,18 @@ end|
select foo6("foo6_1_");
foo6("foo6_1_")
100
-select foo6(concat("foo6_2_",UUID()));
-foo6(concat("foo6_2_",UUID()))
+select foo6(concat("foo6_2_",SYS_GUID()));
+foo6(concat("foo6_2_",SYS_GUID()))
100
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
execute stmt1;
-foo6(concat("foo6_3_",UUID()))
+foo6(concat("foo6_3_",SYS_GUID()))
100
deallocate prepare stmt1;
-create view v1 as select uuid();
+create view v1 as select SYS_GUID();
create table t11 (data varchar(255));
insert into t11 select * from v1;
insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
@@ -250,11 +250,11 @@ execute stmt1;
deallocate prepare stmt1;
create trigger t11_bi before insert on t11 for each row
begin
-set NEW.data = concat(NEW.data,UUID());
+set NEW.data = concat(NEW.data,SYS_GUID());
end|
insert into t11 values("try_560_");
insert delayed into t2 values("delay_1_");
-insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
insert delayed into t2 values("delay_6_");
insert delayed into t2 values(rand());
set @a=2.345;
@@ -356,7 +356,7 @@ alter table t1 modify a int, drop primary key;
insert into t1 values(null,"try_57_");
connection slave;
connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
+CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
insert into t16 values("try_65_");
@@ -427,7 +427,7 @@ DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
+INSERT INTO t12 VALUES(SYS_GUID());
UNLOCK TABLES;
connection slave;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
index b9c636fa582..639b107abd6 100644
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
@@ -4,7 +4,7 @@ include/master-slave.inc
connection master;
CREATE TABLE t1 (a CHAR(48));
CREATE TEMPORARY TABLE t1_tmp1(a INT);
-INSERT INTO t1 VALUES (UUID());
+INSERT INTO t1 VALUES (SYS_GUID());
connection slave;
==== Verify results on slave ====
SHOW STATUS LIKE "Slave_open_temp_tables";
@@ -121,12 +121,12 @@ master-bin.000001 # Query # # COMMIT
BEGIN;
DROP TEMPORARY TABLE t1;
# The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
-INSERT IGNORE INTO t1 VALUES(uuid()+0);
+INSERT IGNORE INTO t1 VALUES(SYS_GUID()+0);
COMMIT;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # INSERT IGNORE INTO t1 VALUES(uuid()+0)
+master-bin.000001 # Annotate_rows # # INSERT IGNORE INTO t1 VALUES(SYS_GUID()+0)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
index d864e615f7a..766acb14c3d 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
@@ -4,7 +4,7 @@
# This test case will test the condition of the bug#40013.
# The test step is:
# 1: create temp table on connection 'master';
-# 2: switch to ROW format using 'INSERT INTO t1 VALUES (UUID());'
+# 2: switch to ROW format using 'INSERT INTO t1 VALUES (SYS_GUID());'
# 3: disconnect 'master' and connect to a new connection 'master1';
# 4: sync to slave and check the number of temp tables on slave.
#
@@ -19,7 +19,7 @@ source include/master-slave.inc;
CREATE TABLE t1 (a CHAR(48));
CREATE TEMPORARY TABLE t1_tmp1(a INT);
-INSERT INTO t1 VALUES (UUID());
+INSERT INTO t1 VALUES (SYS_GUID());
sync_slave_with_master;
@@ -188,7 +188,7 @@ DROP TEMPORARY TABLE t1;
--echo # The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
--disable_warnings
-INSERT IGNORE INTO t1 VALUES(uuid()+0);
+INSERT IGNORE INTO t1 VALUES(SYS_GUID()+0);
--enable_warnings
COMMIT;
diff --git a/mysql-test/suite/s3/mysqldump.result b/mysql-test/suite/s3/mysqldump.result
index 5efde8415fb..3f4c2081388 100644
--- a/mysql-test/suite/s3/mysqldump.result
+++ b/mysql-test/suite/s3/mysqldump.result
@@ -23,7 +23,11 @@ CREATE TABLE `t1` (
PRIMARY KEY (`pk`)
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1,1),(2,2),(3,3),(4,4);
+INSERT INTO `t1` VALUES
+(1,1),
+(2,2),
+(3,3),
+(4,4);
ALTER TABLE `t1` ENGINE=S3;
#####
# mysqldump with --copy-s3-tables=1 XML
diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result
index 47b93eff7d1..0199bb7162f 100644
--- a/mysql-test/suite/sql_sequence/mysqldump.result
+++ b/mysql-test/suite/sql_sequence/mysqldump.result
@@ -14,7 +14,9 @@ CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
# dump by tables order 1
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
SELECT SETVAL(`a1`, 1, 0);
@@ -27,7 +29,9 @@ CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
# dump by tables order 2
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
SELECT SETVAL(`a1`, 1, 0);
@@ -40,7 +44,9 @@ CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
# dump by tables only tables
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
@@ -49,7 +55,9 @@ CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO `t1` VALUES (1),(2);
+INSERT INTO `t1` VALUES
+(1),
+(2);
# dump by tables only sequences
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
SELECT SETVAL(`a1`, 1, 0);
diff --git a/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result
new file mode 100644
index 00000000000..19fae14579d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/default_tmp_storage_engine_rocksdb.result
@@ -0,0 +1,102 @@
+#
+# MDEV-12914: Engine for temporary tables which are implicitly
+# created as RocksDB is substitued siliently with MyIsam
+SET default_tmp_storage_engine = engine_doesnt_exist;
+ERROR 42000: Unknown storage engine 'engine_doesnt_exist'
+SET default_tmp_storage_engine = rocksdb;
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+SET default_tmp_storage_engine = CONCAT('rocks','db');
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+CREATE TABLE t1 (i int) ENGINE = RocksDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TEMPORARY TABLE t2 LIKE t1;
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+DROP TABLE t1;
+SET default_storage_engine = DEFAULT;
+SET default_tmp_storage_engine = DEFAULT;
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TEMPORARY TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TEMPORARY TABLE `t2` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1, t2;
+SET default_storage_engine = rocksdb;
+SET default_tmp_storage_engine = default;
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TEMPORARY TABLE t2 LIKE t1;
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+CREATE TEMPORARY TABLE t2 (t int);
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+SET default_tmp_storage_engine = aria;
+CREATE TEMPORARY TABLE t2 (t int);
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 LIKE t1;
+ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'TEMPORARY'
+DROP TABLE t1;
+#
+# MDEV-26242: Assertion `i >= 0' failed on setting
+# default_tmp_storage_engine to 'DEFAULT' in 10.7
+#
+SHOW VARIABLES like '%storage_engine';
+Variable_name Value
+default_storage_engine ROCKSDB
+default_tmp_storage_engine Aria
+enforce_storage_engine
+storage_engine ROCKSDB
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+@@GLOBAL.default_tmp_storage_engine @@GLOBAL.default_storage_engine @@GLOBAL.storage_engine @@SESSION.default_tmp_storage_engine @@SESSION.default_storage_engine @@SESSION.storage_engine
+NULL MyISAM MyISAM Aria ROCKSDB ROCKSDB
+SELECT @@GLOBAL.table_type;
+ERROR HY000: Unknown system variable 'table_type'
+SET default_storage_engine=DEFAULT;
+SET default_tmp_storage_engine=innodb;
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+@@GLOBAL.default_tmp_storage_engine @@GLOBAL.default_storage_engine @@GLOBAL.storage_engine @@SESSION.default_tmp_storage_engine @@SESSION.default_storage_engine @@SESSION.storage_engine
+NULL MyISAM MyISAM InnoDB MyISAM MyISAM
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1, t;
+SET GLOBAL default_tmp_storage_engine='default';
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+@@GLOBAL.default_tmp_storage_engine @@GLOBAL.default_storage_engine @@GLOBAL.storage_engine @@SESSION.default_tmp_storage_engine @@SESSION.default_storage_engine @@SESSION.storage_engine
+MyISAM MyISAM MyISAM InnoDB MyISAM MyISAM
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `t` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1, t;
+SET GLOBAL default_tmp_storage_engine=NULL;
diff --git a/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result
index 2cb697acb6d..68d3d40091a 100644
--- a/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result
@@ -6,9 +6,27 @@ SELECT COUNT(@@innodb_purge_threads);
COUNT(@@innodb_purge_threads)
1
1 Expected
+SET @save_threads = @@GLOBAL.innodb_purge_threads;
+SET @@GLOBAL.innodb_purge_threads=-1;
+Warnings:
+Warning 1292 Truncated incorrect innodb_purge_threads value: '-1'
+SELECT @@GLOBAL.innodb_purge_threads;
+@@GLOBAL.innodb_purge_threads
+1
+SET @@GLOBAL.innodb_purge_threads=0;
+Warnings:
+Warning 1292 Truncated incorrect innodb_purge_threads value: '0'
+SELECT @@GLOBAL.innodb_purge_threads;
+@@GLOBAL.innodb_purge_threads
+1
+SET @@GLOBAL.innodb_purge_threads=33;
+Warnings:
+Warning 1292 Truncated incorrect innodb_purge_threads value: '33'
+SELECT @@GLOBAL.innodb_purge_threads;
+@@GLOBAL.innodb_purge_threads
+32
SET @@GLOBAL.innodb_purge_threads=1;
-ERROR HY000: Variable 'innodb_purge_threads' is a read only variable
-Expected error 'Read-only variable'
+SET @@GLOBAL.innodb_purge_threads=32;
SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads;
ERROR 42S22: Unknown column 'innodb_purge_threads' in 'field list'
Expected error 'Read-only variable'
@@ -38,4 +56,5 @@ SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME = 'innodb_purge_threads';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_PURGE_THREADS 4
+INNODB_PURGE_THREADS 32
+SET GLOBAL innodb_purge_threads = @save_threads;
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 7a524ba2c16..2a7bd72a700 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -354,12 +354,3 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1729,7 +1729,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
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 8727d66f59b..5a52b2e4251 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1325,7 +1325,7 @@ NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
-READ_ONLY YES
+READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_RANDOM_READ_AHEAD
SESSION_VALUE NULL
@@ -1679,7 +1679,7 @@ VARIABLE_NAME INNODB_UNDO_TABLESPACES
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
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 6bea1a88caa..bc1f49195b5 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -526,21 +526,6 @@ ENUM_VALUE_LIST NONE,ALL,ALL_KILL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL
-VARIABLE_NAME WSREP_REPLICATE_MYISAM
-SESSION_VALUE NULL
-GLOBAL_VALUE OFF
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE OFF
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT To enable myisam replication
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT OPTIONAL
-GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_RESTART_SLAVE
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -721,21 +706,6 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
-VARIABLE_NAME WSREP_STRICT_DDL
-SESSION_VALUE NULL
-GLOBAL_VALUE OFF
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE OFF
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT If set, reject DDL on affected tables not supporting Galera replication
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT OPTIONAL
-GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SYNC_WAIT
SESSION_VALUE 0
GLOBAL_VALUE 0
diff --git a/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test
new file mode 100644
index 00000000000..3454e5d6fc4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test
@@ -0,0 +1,86 @@
+--echo #
+--echo # MDEV-12914: Engine for temporary tables which are implicitly
+--echo # created as RocksDB is substitued siliently with MyIsam
+
+--source include/have_rocksdb.inc
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--error ER_UNKNOWN_STORAGE_ENGINE
+SET default_tmp_storage_engine = engine_doesnt_exist;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+SET default_tmp_storage_engine = rocksdb;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+SET default_tmp_storage_engine = CONCAT('rocks','db');
+
+CREATE TABLE t1 (i int) ENGINE = RocksDB;
+SHOW CREATE TABLE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+DROP TABLE t1;
+
+SET default_storage_engine = DEFAULT;
+SET default_tmp_storage_engine = DEFAULT;
+
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+CREATE TEMPORARY TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+
+DROP TABLE t1, t2;
+
+SET default_storage_engine = rocksdb;
+# setting default or null for tmp SE should use default SE
+SET default_tmp_storage_engine = default;
+
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 (t int);
+
+SET default_tmp_storage_engine = aria;
+CREATE TEMPORARY TABLE t2 (t int);
+DROP TABLE t2;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26242: Assertion `i >= 0' failed on setting
+--echo # default_tmp_storage_engine to 'DEFAULT' in 10.7
+--echo #
+
+
+SHOW VARIABLES like '%storage_engine';
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.table_type;
+
+SET default_storage_engine=DEFAULT;
+SET default_tmp_storage_engine=innodb;
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+SHOW CREATE TABLE t1;
+DROP TABLE t1, t;
+
+SET GLOBAL default_tmp_storage_engine='default';
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+SHOW CREATE TABLE t1;
+DROP TABLE t1, t;
+
+SET GLOBAL default_tmp_storage_engine=NULL; \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test
index 4d039601e40..1156fa40a4a 100644
--- a/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test
@@ -11,9 +11,17 @@ SELECT COUNT(@@GLOBAL.innodb_purge_threads);
SELECT COUNT(@@innodb_purge_threads);
--echo 1 Expected
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @save_threads = @@GLOBAL.innodb_purge_threads;
+
+SET @@GLOBAL.innodb_purge_threads=-1;
+SELECT @@GLOBAL.innodb_purge_threads;
+SET @@GLOBAL.innodb_purge_threads=0;
+SELECT @@GLOBAL.innodb_purge_threads;
+SET @@GLOBAL.innodb_purge_threads=33;
+SELECT @@GLOBAL.innodb_purge_threads;
+
SET @@GLOBAL.innodb_purge_threads=1;
---echo Expected error 'Read-only variable'
+SET @@GLOBAL.innodb_purge_threads=32;
--Error ER_BAD_FIELD_ERROR
SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads;
@@ -51,3 +59,5 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME = 'innodb_purge_threads';
--enable_warnings
+
+SET GLOBAL innodb_purge_threads = @save_threads;
diff --git a/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result b/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result
index df084f8c1a5..c7bb029da39 100644
--- a/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result
+++ b/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result
@@ -131,7 +131,7 @@ CALL sys.statement_performance_analyzer('do magic', NULL, NULL);
ERROR 45000: Unknown action. Supported actions are: cleanup, create_table, create_tmp, delta, overall, save, snapshot
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
CALL sys.statement_performance_analyzer('do magic', NULL, NULL);
-ERROR 01000: Data truncated for column 'in_action' at row 1
+ERROR 01000: Data truncated for column 'in_action' at row 0
CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests', NULL);
ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests` is reserved table name.
CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests_delta', NULL);
@@ -187,7 +187,7 @@ DROP TEMPORARY TABLE sys.tmp_digests_delta;
ERROR 42S02: Unknown table 'sys.tmp_digests_delta'
SET @identifier := REPEAT('a', 65);
CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL);
-ERROR 22001: Data too long for column 'in_table' at row 1
+ERROR 22001: Data too long for column 'in_table' at row 0
DROP TEMPORARY TABLE test.tmp_digests_ini;
DROP TEMPORARY TABLE test.tmp_digests;
DROP TABLE test.tmp_unsupported;
diff --git a/mysql-test/suite/sysschema/r/pr_table_exists.result b/mysql-test/suite/sysschema/r/pr_table_exists.result
index 88917418f67..76085bd72dd 100644
--- a/mysql-test/suite/sysschema/r/pr_table_exists.result
+++ b/mysql-test/suite/sysschema/r/pr_table_exists.result
@@ -40,7 +40,7 @@ SET @identifier := REPEAT('a', 65);
CALL sys.table_exists(@identifier, 't1', @exists);
ERROR 22001: Data too long for column 'in_db' at row 1
CALL sys.table_exists('test', @identifier, @exists);
-ERROR 22001: Data too long for column 'in_table' at row 1
+ERROR 22001: Data too long for column 'in_table' at row 0
SET @identifier := NULL;
#
# MDEV-28391: table_exists procedure fails with
diff --git a/mysql-test/suite/vcol/r/binlog.result b/mysql-test/suite/vcol/r/binlog.result
index 9fd1f9e5b9d..1f66a632697 100644
--- a/mysql-test/suite/vcol/r/binlog.result
+++ b/mysql-test/suite/vcol/r/binlog.result
@@ -88,7 +88,7 @@ CREATE TEMPORARY TABLE t1 SELECT UUID();
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
- `UUID()` varchar(36) DEFAULT NULL
+ `UUID()` uuid DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE TABLE t2 (a INT PRIMARY KEY, b TEXT, c INT GENERATED ALWAYS AS(b));
INSERT INTO t2 (a,b) VALUES (1,1);
diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result
new file mode 100644
index 00000000000..7fea6c3d06e
--- /dev/null
+++ b/mysql-test/suite/versioning/r/data.result
@@ -0,0 +1,59 @@
+#
+# MDEV-16355 Add option for mysqldump to read data as of specific timestamp from system-versioned tables
+#
+create or replace table t1 (x int) with system versioning;
+set timestamp=unix_timestamp('1990-01-01 00:00');
+insert t1 (x) values (1),(2),(3);
+set timestamp=unix_timestamp('1990-08-03 00:00');
+delete from t1 where x=1;
+set timestamp=unix_timestamp('1991-01-02 00:00');
+delete from t1 where x=2;
+set timestamp=default;
+#MYSQL_DUMP --compact test
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES
+(3);
+#MYSQL_DUMP --compact --as-of="1990-01-02 00:00" test
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES
+(1),
+(2),
+(3);
+#MYSQL_DUMP --compact --as-of="1990-08-02 00:00" --databases test
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;
+
+USE `test`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES
+(1),
+(2),
+(3);
+#MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES
+(2),
+(3);
+#MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
+mariadb-dump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc'
+drop tables t1;
diff --git a/mysql-test/suite/versioning/r/partition,heap.rdiff b/mysql-test/suite/versioning/r/partition,heap.rdiff
new file mode 100644
index 00000000000..361a74a4271
--- /dev/null
+++ b/mysql-test/suite/versioning/r/partition,heap.rdiff
@@ -0,0 +1,86 @@
+@@ -1969,85 +1969,6 @@
+ (PARTITION `p0` HISTORY ENGINE = X,
+ PARTITION `pn` CURRENT ENGINE = X)
+ drop tables t1, tp1;
+-# Complex table
+-create or replace table t1 (
+-x int primary key auto_increment,
+-t timestamp(6) default '2001-11-11 11:11:11',
+-b blob(4096) compressed null,
+-c varchar(1033) character set utf8 not null,
+-u int,
+-unique key (x, u),
+-m enum('a', 'b', 'c') not null default 'a' comment 'absolute',
+-i1 tinyint, i2 smallint, i3 bigint,
+-index three(i1, i2, i3),
+-v1 timestamp(6) generated always as (t + interval 1 day),
+-v2 timestamp(6) generated always as (t + interval 1 month) stored,
+-s timestamp(6) as row start,
+-e timestamp(6) as row end,
+-period for system_time (s, e),
+-ps date, pe date,
+-period for app_time (ps, pe),
+-constraint check_constr check (u > -1))
+-with system versioning default charset=ucs2
+-partition by range(x) (
+-partition p0 values less than (10),
+-partition p1 values less than (20),
+-partition pn values less than maxvalue);
+-alter table t1 convert partition p1 to table tp1;
+-show create table tp1;
+-Table Create Table
+-tp1 CREATE TABLE `tp1` (
+- `x` int(11) NOT NULL AUTO_INCREMENT,
+- `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000',
+- `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL,
+- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+- `u` int(11) DEFAULT NULL,
+- `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute',
+- `i1` tinyint(4) DEFAULT NULL,
+- `i2` smallint(6) DEFAULT NULL,
+- `i3` bigint(20) DEFAULT NULL,
+- `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL,
+- `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED,
+- `s` timestamp(6) GENERATED ALWAYS AS ROW START,
+- `e` timestamp(6) GENERATED ALWAYS AS ROW END,
+- `ps` date NOT NULL,
+- `pe` date NOT NULL,
+- PERIOD FOR `app_time` (`ps`, `pe`),
+- PRIMARY KEY (`x`,`e`),
+- UNIQUE KEY `x` (`x`,`u`,`e`),
+- KEY `three` (`i1`,`i2`,`i3`),
+- PERIOD FOR SYSTEM_TIME (`s`, `e`),
+- CONSTRAINT `check_constr` CHECK (`u` > -1)
+-) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+-show create table t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `x` int(11) NOT NULL AUTO_INCREMENT,
+- `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000',
+- `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL,
+- `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+- `u` int(11) DEFAULT NULL,
+- `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute',
+- `i1` tinyint(4) DEFAULT NULL,
+- `i2` smallint(6) DEFAULT NULL,
+- `i3` bigint(20) DEFAULT NULL,
+- `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL,
+- `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED,
+- `s` timestamp(6) GENERATED ALWAYS AS ROW START,
+- `e` timestamp(6) GENERATED ALWAYS AS ROW END,
+- `ps` date NOT NULL,
+- `pe` date NOT NULL,
+- PERIOD FOR `app_time` (`ps`, `pe`),
+- PRIMARY KEY (`x`,`e`),
+- UNIQUE KEY `x` (`x`,`u`,`e`),
+- KEY `three` (`i1`,`i2`,`i3`),
+- PERIOD FOR SYSTEM_TIME (`s`, `e`),
+- CONSTRAINT `check_constr` CHECK (`u` > -1)
+-) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+- PARTITION BY RANGE (`x`)
+-(PARTITION `p0` VALUES LESS THAN (10) ENGINE = X,
+- PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+-drop tables t1, tp1;
+ #
+ # End of 10.7 tests
+ #
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index b8ad7693f51..6feee27818b 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -96,6 +96,16 @@ with system versioning
partition by system_time (
partition p0 history,
partition pn current);
+create or replace table t1 (a int)
+partition by range (a) (
+partition p0 history,
+partition p1 current);
+ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `RANGE`
+create or replace table t1 (b int)
+partition by range (a) (
+partition p0 current,
+partition p1 history);
+ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `RANGE`
## ALTER TABLE
alter table t1 add partition (
partition p1 current);
@@ -150,7 +160,7 @@ partition by system_time limit 1;
alter table t1 change x big int;
create or replace table t1 (i int) engine myisam partition by hash(i) partitions 2;
alter table t1 add partition (partition px history);
-ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME`
+ERROR HY000: Wrong partition type `SYSTEM_TIME` for partitioning by `HASH`
## INSERT, UPDATE, DELETE
create or replace table t1 (x int)
with system versioning
@@ -253,7 +263,7 @@ t1 CREATE TABLE `t1` (
PARTITION BY SYSTEM_TIME LIMIT 2
PARTITIONS 3
alter table t1 drop partition non_existent;
-ERROR HY000: Error in list of partitions to DROP
+ERROR HY000: Wrong partition name or partition list
insert into t1 values (1), (2), (3), (4), (5), (6);
select * from t1 partition (pn);
x
@@ -1105,7 +1115,7 @@ drop table t1;
create table t1 (a int) with system versioning partition by system_time
(partition p1 history, partition pn current);
alter table t1 add partition (partition p2);
-ERROR HY000: Wrong partitioning type, expected type: `SYSTEM_TIME`
+ERROR HY000: Wrong partition type `HASH` for partitioning by `SYSTEM_TIME`
# MDEV-17891 Assertion failures in select_insert::abort_result_set and
# mysql_load upon attempt to replace into a full table
set @@max_heap_table_size= 1024*1024;
@@ -1741,6 +1751,7 @@ drop tables t1;
#
# MDEV-22155 ALTER add default history partitions name clash on non-default partitions
#
+set timestamp= default;
create or replace table t1 (x int) with system versioning
partition by system_time limit 1
(partition p2 history, partition p8 history, partition pn current);
@@ -1783,4 +1794,382 @@ drop tables t1;
#
# End of 10.5 tests
#
+#
+# MDEV-22166 MIGRATE PARTITION: move out partition into a table
+#
+create or replace table t1 (x int)
+with system versioning
+partition by range(x) (
+partition p1 values less than (10),
+partition p2 values less than (20),
+partition p3 values less than (30),
+partition p4 values less than (40),
+partition p5 values less than (50),
+partition pn values less than maxvalue);
+insert into t1 values (2), (12), (22), (32), (42), (52);
+update t1 set x= x + 1;
+alter table t1 convert partition p2 to table tp2;
+show create table tp2;
+Table Create Table
+tp2 CREATE TABLE `tp2` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+select * from tp2;
+x
+13
+select * from tp2 for system_time all order by x;
+x
+12
+13
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p3` VALUES LESS THAN (30) ENGINE = X,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+3
+23
+33
+43
+53
+select * from t1 for system_time all order by x;
+x
+2
+3
+22
+23
+32
+33
+42
+43
+52
+53
+# SP
+create or replace procedure sp()
+alter table t1 convert partition p3 to table tp3;
+call sp;
+show create table tp3;
+Table Create Table
+tp3 CREATE TABLE `tp3` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+select * from tp3;
+x
+23
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p4` VALUES LESS THAN (40) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+3
+33
+43
+53
+drop table tp3;
+call sp;
+ERROR HY000: Wrong partition name or partition list
+call sp;
+ERROR HY000: Wrong partition name or partition list
+drop procedure sp;
+# LOCK TABLES, PS, SP
+create or replace procedure sp()
+alter table t1 convert partition p4 to table tp4;
+lock tables t1 write;
+prepare stmt from 'call sp';
+execute stmt;
+unlock tables;
+show create table tp4;
+Table Create Table
+tp4 CREATE TABLE `tp4` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+select * from tp4;
+x
+33
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `p5` VALUES LESS THAN (50) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+select * from t1 order by x;
+x
+3
+43
+53
+drop table tp4;
+lock tables t1 write;
+execute stmt;
+ERROR HY000: Wrong partition name or partition list
+call sp;
+ERROR HY000: Wrong partition name or partition list
+drop prepare stmt;
+unlock tables;
+drop procedure sp;
+unlock tables;
+drop tables t1, tp2;
+# System-versioned tables (SYSTEM_TIME LIMIT)
+create or replace table t1 (
+x int,
+row_start timestamp(6) as row start invisible,
+row_end timestamp(6) as row end invisible,
+period for system_time(row_start, row_end)
+) with system versioning
+partition by system_time limit 1 partitions 4;
+insert into t1 values (2), (12), (22);
+update t1 set x= x + 1 where x = 2;
+update t1 set x= x + 1 where x = 12;
+update t1 set x= x + 1 where x = 22;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p2`) is out of LIMIT, need more HISTORY partitions
+select * from t1 partition (p1);
+x
+12
+alter table t1 convert partition pn to table tp1;
+ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
+alter table t1 convert partition p1 to table tp1;
+show create table tp1;
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL,
+ `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
+ `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
+ PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+select * from tp1;
+x
+select * from tp1 for system_time all;
+x
+12
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL,
+ `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
+ `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
+ PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1
+(PARTITION `p0` HISTORY ENGINE = X,
+ PARTITION `p2` HISTORY ENGINE = X,
+ PARTITION `pn` CURRENT ENGINE = X)
+select * from t1 order by x;
+x
+3
+13
+23
+select * from t1 for system_time all order by x;
+x
+2
+3
+13
+22
+23
+drop tables t1, tp1;
+# System-versioned tables (SYSTEM_TIME INTERVAL)
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (
+x int,
+row_start timestamp(6) as row start invisible,
+row_end timestamp(6) as row end invisible,
+period for system_time(row_start, row_end)
+) with system versioning
+partition by system_time interval 1 hour partitions 4;
+insert into t1 values (2), (12), (22);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set x= x + 1 where x = 2;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 1 where x = 12;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1 where x = 22;
+select * from t1 partition (p0);
+x
+2
+select * from t1 partition (p1);
+x
+12
+select * from t1 partition (p2);
+x
+22
+alter table t1 convert partition p1 to table tp1;
+ERROR HY000: Can only drop oldest partitions when rotating by INTERVAL
+alter table t1 convert partition p0 to table tp0;
+alter table t1 convert partition p1 to table tp1;
+alter table t1 convert partition p2 to table tp2;
+ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exactly one last CURRENT
+show create table tp0;
+Table Create Table
+tp0 CREATE TABLE `tp0` (
+ `x` int(11) DEFAULT NULL,
+ `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
+ `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
+ PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+show create table tp1;
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL,
+ `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
+ `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
+ PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+select * from tp0;
+x
+select * from tp1;
+x
+select * from tp0 for system_time all;
+x
+2
+select * from tp1 for system_time all;
+x
+12
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL,
+ `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
+ `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
+ PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 02:00:00'
+(PARTITION `p2` HISTORY ENGINE = X,
+ PARTITION `pn` CURRENT ENGINE = X)
+select * from t1;
+x
+3
+13
+23
+select * from t1 for system_time all order by x;
+x
+3
+13
+22
+23
+drop tables t1, tp0, tp1;
+# System-versioned tables (implicit)
+create or replace table t1(x int) with system versioning
+partition by system_time limit 1 partitions 3;
+alter table t1 convert partition p1 to table tp1;
+show create table tp1;
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=X DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1
+(PARTITION `p0` HISTORY ENGINE = X,
+ PARTITION `pn` CURRENT ENGINE = X)
+drop tables t1, tp1;
+# Complex table
+create or replace table t1 (
+x int primary key auto_increment,
+t timestamp(6) default '2001-11-11 11:11:11',
+b blob(4096) compressed null,
+c varchar(1033) character set utf8 not null,
+u int,
+unique key (x, u),
+m enum('a', 'b', 'c') not null default 'a' comment 'absolute',
+i1 tinyint, i2 smallint, i3 bigint,
+index three(i1, i2, i3),
+v1 timestamp(6) generated always as (t + interval 1 day),
+v2 timestamp(6) generated always as (t + interval 1 month) stored,
+s timestamp(6) as row start,
+e timestamp(6) as row end,
+period for system_time (s, e),
+ps date, pe date,
+period for app_time (ps, pe),
+constraint check_constr check (u > -1))
+with system versioning default charset=ucs2
+partition by range(x) (
+partition p0 values less than (10),
+partition p1 values less than (20),
+partition pn values less than maxvalue);
+alter table t1 convert partition p1 to table tp1;
+show create table tp1;
+Table Create Table
+tp1 CREATE TABLE `tp1` (
+ `x` int(11) NOT NULL AUTO_INCREMENT,
+ `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000',
+ `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL,
+ `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `u` int(11) DEFAULT NULL,
+ `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute',
+ `i1` tinyint(4) DEFAULT NULL,
+ `i2` smallint(6) DEFAULT NULL,
+ `i3` bigint(20) DEFAULT NULL,
+ `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL,
+ `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED,
+ `s` timestamp(6) GENERATED ALWAYS AS ROW START,
+ `e` timestamp(6) GENERATED ALWAYS AS ROW END,
+ `ps` date NOT NULL,
+ `pe` date NOT NULL,
+ PERIOD FOR `app_time` (`ps`, `pe`),
+ PRIMARY KEY (`x`,`e`),
+ UNIQUE KEY `x` (`x`,`u`,`e`),
+ KEY `three` (`i1`,`i2`,`i3`),
+ PERIOD FOR SYSTEM_TIME (`s`, `e`),
+ CONSTRAINT `check_constr` CHECK (`u` > -1)
+) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL AUTO_INCREMENT,
+ `t` timestamp(6) NOT NULL DEFAULT '2001-11-11 11:11:11.000000',
+ `b` blob /*!100301 COMPRESSED*/ DEFAULT NULL,
+ `c` varchar(1033) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `u` int(11) DEFAULT NULL,
+ `m` enum('a','b','c') NOT NULL DEFAULT 'a' COMMENT 'absolute',
+ `i1` tinyint(4) DEFAULT NULL,
+ `i2` smallint(6) DEFAULT NULL,
+ `i3` bigint(20) DEFAULT NULL,
+ `v1` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 day) VIRTUAL,
+ `v2` timestamp(6) GENERATED ALWAYS AS (`t` + interval 1 month) STORED,
+ `s` timestamp(6) GENERATED ALWAYS AS ROW START,
+ `e` timestamp(6) GENERATED ALWAYS AS ROW END,
+ `ps` date NOT NULL,
+ `pe` date NOT NULL,
+ PERIOD FOR `app_time` (`ps`, `pe`),
+ PRIMARY KEY (`x`,`e`),
+ UNIQUE KEY `x` (`x`,`u`,`e`),
+ KEY `three` (`i1`,`i2`,`i3`),
+ PERIOD FOR SYSTEM_TIME (`s`, `e`),
+ CONSTRAINT `check_constr` CHECK (`u` > -1)
+) ENGINE=X DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+ PARTITION BY RANGE (`x`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = X,
+ PARTITION `pn` VALUES LESS THAN MAXVALUE ENGINE = X)
+drop tables t1, tp1;
+#
+# MDEV-29841 Partition by system_time can be converted into table but not back
+#
+create or replace table t (a int) with system versioning
+partition by system_time limit 10 partitions 3;
+alter table t convert partition p0 to table tp;
+alter table t convert table tp to partition p0;
+ERROR HY000: CONVERT TABLE TO PARTITION can only be used on RANGE/LIST partitions
+drop tables t, tp;
+#
+# End of 10.7 tests
+#
set global innodb_stats_persistent= @save_persistent;
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 0ec2f887950..76185afd523 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -609,7 +609,7 @@ create or replace table t1 (
period for system_time(row_start, row_end)
) with system versioning;
show create table t1;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column b;
create or replace table t1 (
@@ -619,7 +619,7 @@ a int, b int primary key,
period for system_time(row_start, row_end)
) with system versioning;
show create table t1;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
alter table t1 drop column b;
# cleanup
diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test
index 87cafdc7d32..6f5153b4ec1 100644
--- a/mysql-test/suite/versioning/t/create.test
+++ b/mysql-test/suite/versioning/t/create.test
@@ -412,11 +412,11 @@ drop tables t0, t1, t2, t3;
--echo #
--echo # MDEV-23968 CREATE TEMPORARY TABLE .. LIKE (system versioned table) returns error if unique index is defined in the table
--echo #
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
create table t1 (id int primary key, index(row_start)) with system versioning;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
create table t1 (id int primary key, index(row_end)) with system versioning;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
create table t1 (id int, primary key(id, row_end, row_end)) with system versioning;
create table t1 (id int primary key) with system versioning;
create temporary table t2 like t1;
diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test
new file mode 100644
index 00000000000..ddae6633337
--- /dev/null
+++ b/mysql-test/suite/versioning/t/data.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source suite/versioning/common.inc
+
+--echo #
+--echo # MDEV-16355 Add option for mysqldump to read data as of specific timestamp from system-versioned tables
+--echo #
+create or replace table t1 (x int) with system versioning;
+set timestamp=unix_timestamp('1990-01-01 00:00');
+insert t1 (x) values (1),(2),(3);
+set timestamp=unix_timestamp('1990-08-03 00:00');
+delete from t1 where x=1;
+set timestamp=unix_timestamp('1991-01-02 00:00');
+delete from t1 where x=2;
+set timestamp=default;
+
+--echo #MYSQL_DUMP --compact test
+--exec $MYSQL_DUMP --compact test
+--echo #MYSQL_DUMP --compact --as-of="1990-01-02 00:00" test
+--exec $MYSQL_DUMP --compact --as-of="1990-01-02 00:00" test
+--echo #MYSQL_DUMP --compact --as-of="1990-08-02 00:00" --databases test
+--exec $MYSQL_DUMP --compact --as-of="1990-08-02 00:00" --databases test
+--echo #MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1
+--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1
+## Forged query protection
+--echo #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
+--replace_result mariadb-dump.exe mariadb-dump
+--error 1
+--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
+
+drop tables t1;
+
+--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 535e791c8c8..29de10e4738 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -106,6 +106,18 @@ partition by system_time (
partition p0 history,
partition pn current);
+--error ER_PARTITION_WRONG_TYPE
+create or replace table t1 (a int)
+partition by range (a) (
+ partition p0 history,
+ partition p1 current);
+
+--error ER_PARTITION_WRONG_TYPE
+create or replace table t1 (b int)
+partition by range (a) (
+ partition p0 current,
+ partition p1 history);
+
--echo ## ALTER TABLE
@@ -232,7 +244,7 @@ partition by system_time limit 2 partitions 3;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
---error ER_DROP_PARTITION_NON_EXISTENT
+--error ER_PARTITION_DOES_NOT_EXIST
alter table t1 drop partition non_existent;
insert into t1 values (1), (2), (3), (4), (5), (6);
@@ -1533,6 +1545,7 @@ drop tables t1;
--echo #
--echo # MDEV-22155 ALTER add default history partitions name clash on non-default partitions
--echo #
+set timestamp= default;
create or replace table t1 (x int) with system versioning
partition by system_time limit 1
(partition p2 history, partition p8 history, partition pn current);
@@ -1552,6 +1565,219 @@ drop tables t1;
--echo # End of 10.5 tests
--echo #
+--echo #
+--echo # MDEV-22166 MIGRATE PARTITION: move out partition into a table
+--echo #
+create or replace table t1 (x int)
+with system versioning
+partition by range(x) (
+ partition p1 values less than (10),
+ partition p2 values less than (20),
+ partition p3 values less than (30),
+ partition p4 values less than (40),
+ partition p5 values less than (50),
+ partition pn values less than maxvalue);
+
+insert into t1 values (2), (12), (22), (32), (42), (52);
+update t1 set x= x + 1;
+
+alter table t1 convert partition p2 to table tp2;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp2;
+select * from tp2;
+select * from tp2 for system_time all order by x;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+select * from t1 for system_time all order by x;
+
+--echo # SP
+create or replace procedure sp()
+alter table t1 convert partition p3 to table tp3;
+call sp;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp3;
+select * from tp3;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+drop table tp3;
+--error ER_PARTITION_DOES_NOT_EXIST
+call sp;
+--error ER_PARTITION_DOES_NOT_EXIST
+call sp;
+drop procedure sp;
+
+--echo # LOCK TABLES, PS, SP
+create or replace procedure sp()
+alter table t1 convert partition p4 to table tp4;
+lock tables t1 write;
+prepare stmt from 'call sp';
+execute stmt;
+
+# TODO: don't unlock here (see above TODO)
+unlock tables;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp4;
+select * from tp4;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+drop table tp4;
+lock tables t1 write;
+--error ER_PARTITION_DOES_NOT_EXIST
+execute stmt;
+--error ER_PARTITION_DOES_NOT_EXIST
+call sp;
+drop prepare stmt;
+unlock tables;
+drop procedure sp;
+unlock tables;
+
+drop tables t1, tp2;
+
+--echo # System-versioned tables (SYSTEM_TIME LIMIT)
+
+create or replace table t1 (
+ x int,
+ row_start timestamp(6) as row start invisible,
+ row_end timestamp(6) as row end invisible,
+ period for system_time(row_start, row_end)
+) with system versioning
+partition by system_time limit 1 partitions 4;
+
+insert into t1 values (2), (12), (22);
+update t1 set x= x + 1 where x = 2;
+update t1 set x= x + 1 where x = 12;
+update t1 set x= x + 1 where x = 22;
+
+select * from t1 partition (p1);
+--error ER_VERS_WRONG_PARTS
+alter table t1 convert partition pn to table tp1;
+alter table t1 convert partition p1 to table tp1;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp1;
+select * from tp1;
+select * from tp1 for system_time all;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1 order by x;
+select * from t1 for system_time all order by x;
+
+drop tables t1, tp1;
+
+--echo # System-versioned tables (SYSTEM_TIME INTERVAL)
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (
+ x int,
+ row_start timestamp(6) as row start invisible,
+ row_end timestamp(6) as row end invisible,
+ period for system_time(row_start, row_end)
+) with system versioning
+partition by system_time interval 1 hour partitions 4;
+
+insert into t1 values (2), (12), (22);
+set timestamp= unix_timestamp('2000-01-01 00:00:01');
+update t1 set x= x + 1 where x = 2;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 1 where x = 12;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1 where x = 22;
+
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (p2);
+--error ER_VERS_DROP_PARTITION_INTERVAL
+alter table t1 convert partition p1 to table tp1;
+alter table t1 convert partition p0 to table tp0;
+alter table t1 convert partition p1 to table tp1;
+--error ER_VERS_WRONG_PARTS
+alter table t1 convert partition p2 to table tp2;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp0;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp1;
+select * from tp0;
+select * from tp1;
+select * from tp0 for system_time all;
+select * from tp1 for system_time all;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+select * from t1;
+select * from t1 for system_time all order by x;
+
+drop tables t1, tp0, tp1;
+
+--echo # System-versioned tables (implicit)
+
+create or replace table t1(x int) with system versioning
+partition by system_time limit 1 partitions 3;
+
+alter table t1 convert partition p1 to table tp1;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp1;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+
+drop tables t1, tp1;
+
+if (!$MTR_COMBINATION_HEAP)
+{
+--echo # Complex table
+create or replace table t1 (
+ x int primary key auto_increment,
+ t timestamp(6) default '2001-11-11 11:11:11',
+ b blob(4096) compressed null,
+ c varchar(1033) character set utf8 not null,
+ u int,
+ unique key (x, u),
+ m enum('a', 'b', 'c') not null default 'a' comment 'absolute',
+ i1 tinyint, i2 smallint, i3 bigint,
+ index three(i1, i2, i3),
+ v1 timestamp(6) generated always as (t + interval 1 day),
+ v2 timestamp(6) generated always as (t + interval 1 month) stored,
+ s timestamp(6) as row start,
+ e timestamp(6) as row end,
+ period for system_time (s, e),
+ ps date, pe date,
+ period for app_time (ps, pe),
+ constraint check_constr check (u > -1))
+with system versioning default charset=ucs2
+partition by range(x) (
+ partition p0 values less than (10),
+ partition p1 values less than (20),
+ partition pn values less than maxvalue);
+
+alter table t1 convert partition p1 to table tp1;
+
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table tp1;
+--replace_result $default_engine X ' PAGE_CHECKSUM=1' ''
+show create table t1;
+
+drop tables t1, tp1;
+}
+
+--echo #
+--echo # MDEV-29841 Partition by system_time can be converted into table but not back
+--echo #
+create or replace table t (a int) with system versioning
+partition by system_time limit 10 partitions 3;
+alter table t convert partition p0 to table tp;
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+alter table t convert table tp to partition p0;
+drop tables t, tp;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
+
set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index 82c480917f1..8e1af35fd62 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -105,8 +105,6 @@ WSREP_FORCED_BINLOG_FORMAT
WSREP_GTID_DOMAIN_ID
WSREP_GTID_MODE
WSREP_GTID_SEQ_NO
-WSREP_MODE
-WSREP_STRICT_DDL
WSREP_IGNORE_APPLY_ERRORS
WSREP_LOAD_DATA_SPLITTING
WSREP_LOG_CONFLICTS
@@ -125,7 +123,6 @@ WSREP_PROVIDER
WSREP_PROVIDER_OPTIONS
WSREP_RECOVER
WSREP_REJECT_QUERIES
-WSREP_REPLICATE_MYISAM
WSREP_RESTART_SLAVE
WSREP_RETRY_AUTOCOMMIT
WSREP_SLAVE_FK_CHECKS
@@ -138,7 +135,6 @@ WSREP_SST_DONOR_REJECTS_QUERIES
WSREP_SST_METHOD
WSREP_SST_RECEIVE_ADDRESS
WSREP_START_POSITION
-WSREP_STRICT_DDL
WSREP_SYNC_WAIT
WSREP_TRX_FRAGMENT_SIZE
WSREP_TRX_FRAGMENT_UNIT
diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result
index fe2bffb3f08..0690f540a37 100644
--- a/mysql-test/suite/wsrep/r/variables_debug.result
+++ b/mysql-test/suite/wsrep/r/variables_debug.result
@@ -105,11 +105,13 @@ WSREP_DRUPAL_282555_WORKAROUND
WSREP_FORCED_BINLOG_FORMAT
WSREP_GTID_DOMAIN_ID
WSREP_GTID_MODE
+WSREP_GTID_SEQ_NO
WSREP_IGNORE_APPLY_ERRORS
WSREP_LOAD_DATA_SPLITTING
WSREP_LOG_CONFLICTS
WSREP_MAX_WS_ROWS
WSREP_MAX_WS_SIZE
+WSREP_MODE
WSREP_MYSQL_REPLICATION_BUNDLE
WSREP_NODE_ADDRESS
WSREP_NODE_INCOMING_ADDRESS
@@ -122,7 +124,6 @@ WSREP_PROVIDER
WSREP_PROVIDER_OPTIONS
WSREP_RECOVER
WSREP_REJECT_QUERIES
-WSREP_REPLICATE_MYISAM
WSREP_RESTART_SLAVE
WSREP_RETRY_AUTOCOMMIT
WSREP_SLAVE_FK_CHECKS
diff --git a/mysys/array.c b/mysys/array.c
index 32606cafb23..c9bf609b6d4 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -41,8 +41,9 @@
*/
my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array,
- uint element_size, void *init_buffer,
- uint init_alloc, uint alloc_increment, myf my_flags)
+ size_t element_size, void *init_buffer,
+ size_t init_alloc, size_t alloc_increment,
+ myf my_flags)
{
DBUG_ENTER("init_dynamic_array2");
if (!alloc_increment)
@@ -198,7 +199,7 @@ void *pop_dynamic(DYNAMIC_ARRAY *array)
FALSE Ok
*/
-my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element, uint idx)
+my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element, size_t idx)
{
if (idx >= array->elements)
{
@@ -209,7 +210,7 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element, uint idx)
array->elements=idx+1;
}
memcpy(array->buffer+(idx * array->size_of_element),element,
- (size_t) array->size_of_element);
+ array->size_of_element);
return FALSE;
}
@@ -230,13 +231,13 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element, uint idx)
TRUE Allocation of new memory failed
*/
-my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
+my_bool allocate_dynamic(DYNAMIC_ARRAY *array, size_t max_elements)
{
DBUG_ENTER("allocate_dynamic");
if (max_elements >= array->max_element)
{
- uint size;
+ size_t size;
uchar *new_ptr;
size= (max_elements + array->alloc_increment)/array->alloc_increment;
size*= array->alloc_increment;
@@ -277,7 +278,7 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
idx Index of element wanted.
*/
-void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint idx)
+void get_dynamic(DYNAMIC_ARRAY *array, void *element, size_t idx)
{
if (idx >= array->elements)
{
@@ -320,7 +321,7 @@ void delete_dynamic(DYNAMIC_ARRAY *array)
idx Index of element to be deleted
*/
-void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
+void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t idx)
{
char *ptr= (char*) array->buffer+array->size_of_element*idx;
array->elements--;
@@ -339,7 +340,7 @@ void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
deleting the array;
*/
void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f) {
- uint i;
+ size_t i;
char *ptr= (char*) array->buffer;
for (i= 0; i < array->elements; i++, ptr+= array->size_of_element) {
f(ptr);
@@ -357,7 +358,7 @@ void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f) {
void freeze_size(DYNAMIC_ARRAY *array)
{
- uint elements;
+ size_t elements;
/*
Do nothing if we are using a static buffer
diff --git a/mysys/hash.c b/mysys/hash.c
index abc11b42500..d9132b28cd7 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -76,8 +76,8 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
@retval 1 failure
*/
my_bool
-my_hash_init2(PSI_memory_key psi_key, HASH *hash, uint growth_size,
- CHARSET_INFO *charset, ulong size, size_t key_offset,
+my_hash_init2(PSI_memory_key psi_key, HASH *hash, size_t growth_size,
+ CHARSET_INFO *charset, size_t size, size_t key_offset,
size_t key_length, my_hash_get_key get_key,
my_hash_function hash_function,
void (*free_element)(void*), uint flags)
@@ -282,6 +282,8 @@ uchar* my_hash_first_from_hash_value(const HASH *hash,
uint flag= 1;
uint idx= my_hash_mask(hash_value,
hash->blength, hash->records);
+ if (!length)
+ length= hash->key_length; // length for fixed length keys or 0
do
{
pos= dynamic_element(&hash->array,idx,HASH_LINK*);
@@ -316,6 +318,8 @@ uchar* my_hash_next(const HASH *hash, const uchar *key, size_t length,
if (*current_record != NO_RECORD)
{
HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*);
+ if (!length)
+ length= hash->key_length; // length for fixed length keys or 0
for (idx=data[*current_record].next; idx != NO_RECORD ; idx=pos->next)
{
pos=data+idx;
@@ -356,8 +360,11 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
length length of key
NOTES:
- If length is 0, comparison is done using the length of the
- record being compared against.
+ length equal 0 can mean 2 things:
+ 1) it is fixed key length hash (HASH::key_length != 0) and
+ default length should be taken in this case
+ 2) it is really 0 length key for variable key length hash
+ (HASH::key_length == 0)
RETURN
= 0 key of record == key
@@ -368,10 +375,11 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
size_t length)
{
size_t rec_keylength;
- uchar *rec_key= (uchar*) my_hash_key(hash, pos->data, &rec_keylength, 1);
- return ((length && length != rec_keylength) ||
+ uchar *rec_key;
+ rec_key= (uchar*) my_hash_key(hash, pos->data, &rec_keylength, 1);
+ return (length != rec_keylength) ||
my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength,
- (uchar*) key, rec_keylength));
+ (uchar*) key, rec_keylength);
}
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 3e0b774b0c7..9f230b6bbcb 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -20,15 +20,101 @@
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
+#include <my_bit.h>
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
#undef EXTRA_DEBUG
#define EXTRA_DEBUG
/* data packed in MEM_ROOT -> min_malloc */
-#define MALLOC_FLAG(A) ((A & 1) ? MY_THREAD_SPECIFIC : 0)
+/* Don't allocate too small blocks */
+#define ROOT_MIN_BLOCK_SIZE 256
+
+/* bits in MEM_ROOT->flags */
+#define ROOT_FLAG_THREAD_SPECIFIC 1
+#define ROOT_FLAG_MPROTECT 2
+
+#define MALLOC_FLAG(R) MYF((R)->flags & ROOT_FLAG_THREAD_SPECIFIC ? THREAD_SPECIFIC : 0)
#define TRASH_MEM(X) TRASH_FREE(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
+
+/*
+ Alloc memory through either my_malloc or mmap()
+*/
+
+static void *root_alloc(MEM_ROOT *root, size_t size, size_t *alloced_size,
+ myf my_flags)
+{
+ *alloced_size= size;
+#if defined(HAVE_MMAP) && defined(HAVE_MPROTECT) && defined(MAP_ANONYMOUS)
+ if (root->flags & ROOT_FLAG_MPROTECT)
+ {
+ void *res;
+ *alloced_size= MY_ALIGN(size, my_system_page_size);
+ res= my_mmap(0, *alloced_size, PROT_READ | PROT_WRITE,
+ MAP_NORESERVE | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (res == MAP_FAILED)
+ res= 0;
+ return res;
+ }
+#endif /* HAVE_MMAP */
+
+ return my_malloc(root->psi_key, size,
+ my_flags | MYF(root->flags & ROOT_FLAG_THREAD_SPECIFIC ?
+ MY_THREAD_SPECIFIC : 0));
+}
+
+static void root_free(MEM_ROOT *root, void *ptr, size_t size)
+{
+#if defined(HAVE_MMAP) && defined(HAVE_MPROTECT) && defined(MAP_ANONYMOUS)
+ if (root->flags & ROOT_FLAG_MPROTECT)
+ my_munmap(ptr, size);
+ else
+#endif
+ my_free(ptr);
+}
+
+
+/*
+ Calculate block sizes to use
+
+ Sizes will be updated to next power of 2, minus operating system
+ memory management size.
+
+ The idea is to reduce memory fragmentation as most system memory
+ allocators are using power of 2 block size internally.
+*/
+
+static void calculate_block_sizes(MEM_ROOT *mem_root, size_t block_size,
+ size_t *pre_alloc_size)
+{
+ size_t pre_alloc= *pre_alloc_size;
+
+ if (mem_root->flags&= ROOT_FLAG_MPROTECT)
+ {
+ mem_root->block_size= MY_ALIGN(block_size, my_system_page_size);
+ if (pre_alloc)
+ pre_alloc= MY_ALIGN(pre_alloc, my_system_page_size);
+ }
+ else
+ {
+ DBUG_ASSERT(block_size <= UINT_MAX32);
+ mem_root->block_size= (my_round_up_to_next_power((uint32) block_size -
+ MALLOC_OVERHEAD)-
+ MALLOC_OVERHEAD);
+ if (pre_alloc)
+ pre_alloc= (my_round_up_to_next_power((uint32) pre_alloc -
+ MALLOC_OVERHEAD)-
+ MALLOC_OVERHEAD);
+ }
+ *pre_alloc_size= pre_alloc;
+}
+
+
/*
Initialize memory root
@@ -36,13 +122,18 @@
init_alloc_root()
mem_root - memory root to initialize
name - name of memroot (for debugging)
- block_size - size of chunks (blocks) used for memory allocation
+ block_size - size of chunks (blocks) used for memory allocation.
+ Will be updated to next power of 2, minus
+ internal and system memory management size. This is
+ will reduce memory fragmentation as most system memory
+ allocators are using power of 2 block size internally.
(It is external size of chunk i.e. it should include
memory required for internal structures, thus it
- should be no less than ALLOC_ROOT_MIN_BLOCK_SIZE)
+ should be no less than ROOT_MIN_BLOCK_SIZE).
pre_alloc_size - if non-0, then size of block that should be
pre-allocated during memory root initialization.
my_flags MY_THREAD_SPECIFIC flag for my_malloc
+ MY_RROOT_USE_MPROTECT for read only protected memory
DESCRIPTION
This function prepares memory root for further use, sets initial size of
@@ -50,9 +141,6 @@
Although error can happen during execution of this function if
pre_alloc_size is non-0 it won't be reported. Instead it will be
reported as error in first alloc_root() on this memory root.
-
- We don't want to change the structure size for MEM_ROOT.
- Because of this, we store in MY_THREAD_SPECIFIC as bit 1 in block_size
*/
void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size,
@@ -63,25 +151,31 @@ void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size,
DBUG_PRINT("enter",("root: %p prealloc: %zu", mem_root, pre_alloc_size));
mem_root->free= mem_root->used= mem_root->pre_alloc= 0;
- mem_root->min_malloc= 32;
- mem_root->block_size= (block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1;
+ mem_root->min_malloc= 32 + REDZONE_SIZE;
+ mem_root->block_size= MY_MAX(block_size, ROOT_MIN_BLOCK_SIZE);
+ mem_root->flags= 0;
if (my_flags & MY_THREAD_SPECIFIC)
- mem_root->block_size|= 1;
+ mem_root->flags|= ROOT_FLAG_THREAD_SPECIFIC;
+ if (my_flags & MY_ROOT_USE_MPROTECT)
+ mem_root->flags|= ROOT_FLAG_MPROTECT;
+
+ calculate_block_sizes(mem_root, block_size, &pre_alloc_size);
mem_root->error_handler= 0;
mem_root->block_num= 4; /* We shift this with >>2 */
mem_root->first_block_usage= 0;
- mem_root->m_psi_key= key;
+ mem_root->psi_key= key;
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
- size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
+ size_t alloced_size;
if ((mem_root->free= mem_root->pre_alloc=
- (USED_MEM*) my_malloc(key, size, MYF(my_flags))))
+ (USED_MEM*) root_alloc(mem_root, pre_alloc_size, &alloced_size,
+ MYF(0))))
{
- mem_root->free->size= size;
- mem_root->free->left= pre_alloc_size;
+ mem_root->free->size= alloced_size;
+ mem_root->free->left= alloced_size - ALIGN_SIZE(sizeof(USED_MEM));
mem_root->free->next= 0;
TRASH_MEM(mem_root->free);
}
@@ -113,13 +207,14 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
DBUG_ENTER("reset_root_defaults");
DBUG_ASSERT(alloc_root_inited(mem_root));
- mem_root->block_size= (((block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1) |
- (mem_root->block_size & 1));
+ calculate_block_sizes(mem_root, block_size, &pre_alloc_size);
+
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
- size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
- if (!mem_root->pre_alloc || mem_root->pre_alloc->size != size)
+ size_t size= mem_root->block_size, alloced_size;
+ if (!mem_root->pre_alloc ||
+ mem_root->pre_alloc->size != mem_root->block_size)
{
USED_MEM *mem, **prev= &mem_root->free;
/*
@@ -139,26 +234,23 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
{
/* remove block from the list and free it */
*prev= mem->next;
- my_free(mem);
+ root_free(mem_root, mem, mem->size);
}
else
prev= &mem->next;
}
/* Allocate new prealloc block and add it to the end of free list */
- if ((mem= (USED_MEM *) my_malloc(mem_root->m_psi_key, size,
- MYF(MALLOC_FLAG(mem_root->
- block_size)))))
+ if ((mem= (USED_MEM *) root_alloc(mem_root, size, &alloced_size,
+ MYF(MY_WME))))
{
- mem->size= size;
- mem->left= pre_alloc_size;
+ mem->size= alloced_size;
+ mem->left= alloced_size - ALIGN_SIZE(sizeof(USED_MEM));
mem->next= *prev;
*prev= mem_root->pre_alloc= mem;
TRASH_MEM(mem);
}
else
- {
mem_root->pre_alloc= 0;
- }
}
}
else
@@ -171,37 +263,6 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
void *alloc_root(MEM_ROOT *mem_root, size_t length)
{
-#if defined(HAVE_valgrind) && defined(EXTRA_DEBUG)
- reg1 USED_MEM *next;
- DBUG_ENTER("alloc_root");
- DBUG_PRINT("enter",("root: %p", mem_root));
-
- DBUG_ASSERT(alloc_root_inited(mem_root));
-
- DBUG_EXECUTE_IF("simulate_out_of_memory",
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- DBUG_SET("-d,simulate_out_of_memory");
- DBUG_RETURN((void*) 0); /* purecov: inspected */
- });
-
- length+=ALIGN_SIZE(sizeof(USED_MEM));
- if (!(next = (USED_MEM*) my_malloc(mem_root->m_psi_key, length,
- MYF(MY_WME | ME_FATAL |
- MALLOC_FLAG(mem_root->block_size)))))
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- DBUG_RETURN((uchar*) 0); /* purecov: inspected */
- }
- next->next= mem_root->used;
- next->left= 0;
- next->size= length;
- mem_root->used= next;
- DBUG_PRINT("exit",("ptr: %p", (((char*)next)+ALIGN_SIZE(sizeof(USED_MEM)))));
- DBUG_RETURN((((uchar*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
-#else
size_t get_size, block_size;
uchar* point;
reg1 USED_MEM *next= 0;
@@ -212,13 +273,36 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
DBUG_ASSERT(alloc_root_inited(mem_root));
DBUG_EXECUTE_IF("simulate_out_of_memory",
- {
- /* Avoid reusing an already allocated block */
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- DBUG_SET("-d,simulate_out_of_memory");
- DBUG_RETURN((void*) 0); /* purecov: inspected */
- });
+ {
+ if (mem_root->error_handler)
+ (*mem_root->error_handler)();
+ DBUG_SET("-d,simulate_out_of_memory");
+ DBUG_RETURN((void*) 0); /* purecov: inspected */
+ });
+
+#if defined(HAVE_valgrind) && defined(EXTRA_DEBUG)
+ if (!(mem_root->flags & ROOT_FLAG_MPROTECT))
+ {
+ length+= ALIGN_SIZE(sizeof(USED_MEM));
+ if (!(next = (USED_MEM*) my_malloc(mem_root->psi_key, length,
+ MYF(MY_WME | ME_FATAL |
+ (mem_root->flags &
+ ROOT_FLAG_THREAD_SPECIFIC ?
+ MY_THREAD_SPECIFIC : 0)))))
+ {
+ if (mem_root->error_handler)
+ (*mem_root->error_handler)();
+ DBUG_RETURN((uchar*) 0); /* purecov: inspected */
+ }
+ next->next= mem_root->used;
+ next->left= 0;
+ next->size= length;
+ mem_root->used= next;
+ DBUG_PRINT("exit",("ptr: %p", (((char*)next)+ALIGN_SIZE(sizeof(USED_MEM)))));
+ DBUG_RETURN((((uchar*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
+ }
+#endif /* defined(HAVE_valgrind) && defined(EXTRA_DEBUG) */
+
length= ALIGN_SIZE(length) + REDZONE_SIZE;
if ((*(prev= &mem_root->free)) != NULL)
{
@@ -237,14 +321,16 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
}
if (! next)
{ /* Time to alloc new block */
- block_size= (mem_root->block_size & ~1) * (mem_root->block_num >> 2);
- get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
+ size_t alloced_length;
+
+ /* Increase block size over time if there is a lot of mallocs */
+ block_size= (MY_ALIGN(mem_root->block_size, ROOT_MIN_BLOCK_SIZE) *
+ (mem_root->block_num >> 2)- MALLOC_OVERHEAD);
+ get_size= length + ALIGN_SIZE(sizeof(USED_MEM));
get_size= MY_MAX(get_size, block_size);
- if (!(next = (USED_MEM*) my_malloc(mem_root->m_psi_key, get_size,
- MYF(MY_WME | ME_FATAL |
- MALLOC_FLAG(mem_root->
- block_size)))))
+ if (!(next= (USED_MEM*) root_alloc(mem_root, get_size, &alloced_length,
+ MYF(MY_WME | ME_FATAL))))
{
if (mem_root->error_handler)
(*mem_root->error_handler)();
@@ -252,8 +338,8 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
}
mem_root->block_num++;
next->next= *prev;
- next->size= get_size;
- next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
+ next->size= alloced_length;
+ next->left= alloced_length - ALIGN_SIZE(sizeof(USED_MEM));
*prev=next;
TRASH_MEM(next);
}
@@ -271,7 +357,6 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
TRASH_ALLOC(point, original_length);
DBUG_PRINT("exit",("ptr: %p", point));
DBUG_RETURN((void*) point);
-#endif
}
@@ -407,13 +492,13 @@ void free_root(MEM_ROOT *root, myf MyFlags)
{
old=next; next= next->next ;
if (old != root->pre_alloc)
- my_free(old);
+ root_free(root, old, old->size);
}
for (next=root->free ; next ;)
{
old=next; next= next->next;
if (old != root->pre_alloc)
- my_free(old);
+ root_free(root, old, old->size);
}
root->used=root->free=0;
if (root->pre_alloc)
@@ -428,6 +513,7 @@ void free_root(MEM_ROOT *root, myf MyFlags)
DBUG_VOID_RETURN;
}
+
/*
Find block that contains an object and set the pre_alloc to it
*/
@@ -454,6 +540,38 @@ void set_prealloc_root(MEM_ROOT *root, char *ptr)
}
+/**
+ Change protection for all blocks in the mem root
+*/
+
+#if defined(HAVE_MMAP) && defined(HAVE_MPROTECT) && defined(MAP_ANONYMOUS)
+void protect_root(MEM_ROOT *root, int prot)
+{
+ reg1 USED_MEM *next,*old;
+ DBUG_ENTER("protect_root");
+ DBUG_PRINT("enter",("root: %p prot: %d", root, prot));
+
+ DBUG_ASSERT(root->flags & ROOT_FLAG_MPROTECT);
+
+ for (next= root->used; next ;)
+ {
+ old= next; next= next->next ;
+ mprotect(old, old->size, prot);
+ }
+ for (next= root->free; next ;)
+ {
+ old= next; next= next->next ;
+ mprotect(old, old->size, prot);
+ }
+ DBUG_VOID_RETURN;
+}
+#else
+void protect_root(MEM_ROOT *root, int prot)
+{
+}
+#endif /* defined(HAVE_MMAP) && ... */
+
+
char *strdup_root(MEM_ROOT *root, const char *str)
{
return strmake_root(root, str, strlen(str));
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index bf2bacd213c..9893c7e4a58 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -123,19 +123,6 @@ static inline my_bitmap_map last_word_mask(uint bit)
}
-static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
-{
- if (map->mutex)
- mysql_mutex_lock(map->mutex);
-}
-
-static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
-{
- if (map->mutex)
- mysql_mutex_unlock(map->mutex);
-}
-
-
static inline uint get_first_set(my_bitmap_map value, uint word_pos)
{
uchar *byte_ptr= (uchar*)&value;
@@ -159,32 +146,15 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos)
Initialize a bitmap object. All bits will be set to zero
*/
-my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
- my_bool thread_safe)
+my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits)
{
DBUG_ENTER("my_bitmap_init");
- map->mutex= 0;
if (!buf)
{
uint size_in_bytes= bitmap_buffer_size(n_bits);
- uint extra= 0;
- if (thread_safe)
- {
- size_in_bytes= ALIGN_SIZE(size_in_bytes);
- extra= sizeof(mysql_mutex_t);
- }
if (!(buf= (my_bitmap_map*) my_malloc(key_memory_MY_BITMAP_bitmap,
- size_in_bytes+extra, MYF(MY_WME))))
+ size_in_bytes, MYF(MY_WME))))
DBUG_RETURN(1);
- if (thread_safe)
- {
- map->mutex= (mysql_mutex_t *) ((char*) buf + size_in_bytes);
- mysql_mutex_init(key_BITMAP_mutex, map->mutex, MY_MUTEX_INIT_FAST);
- }
- }
- else
- {
- DBUG_ASSERT(thread_safe == 0);
}
map->bitmap= buf;
@@ -200,8 +170,6 @@ void my_bitmap_free(MY_BITMAP *map)
DBUG_ENTER("my_bitmap_free");
if (map->bitmap)
{
- if (map->mutex)
- mysql_mutex_destroy(map->mutex);
my_free(map->bitmap);
map->bitmap=0;
}
@@ -247,13 +215,9 @@ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
{
- my_bool res;
DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(bitmap_bit < map->n_bits);
- bitmap_lock(map);
- res= bitmap_fast_test_and_set(map, bitmap_bit);
- bitmap_unlock(map);
- return res;
+ return bitmap_fast_test_and_set(map, bitmap_bit);
}
/*
@@ -281,13 +245,9 @@ my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
{
- my_bool res;
DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(bitmap_bit < map->n_bits);
- bitmap_lock(map);
- res= bitmap_fast_test_and_clear(map, bitmap_bit);
- bitmap_unlock(map);
- return res;
+ return bitmap_fast_test_and_clear(map, bitmap_bit);
}
@@ -733,24 +693,3 @@ found:
DBUG_ASSERT(0);
return MY_BIT_NONE; /* Impossible */
}
-
-
-uint bitmap_lock_set_next(MY_BITMAP *map)
-{
- uint bit_found;
- bitmap_lock(map);
- bit_found= bitmap_set_next(map);
- bitmap_unlock(map);
- return bit_found;
-}
-
-
-void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
-{
- bitmap_lock(map);
- DBUG_ASSERT(map->bitmap);
- DBUG_ASSERT(bitmap_bit < map->n_bits);
- bitmap_clear_bit(map, bitmap_bit);
- bitmap_unlock(map);
-}
-
diff --git a/mysys/my_default.c b/mysys/my_default.c
index cc4462a240b..ae576f7a058 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -466,7 +466,7 @@ int my_load_defaults(const char *conf_file, const char **groups, int *argc,
if (*argc)
memcpy(res + args.elements, *argv, *argc * sizeof(char*));
- (*argc)+= args.elements;
+ (*argc)+= (int)args.elements;
*argv= res;
(*argv)[*argc]= 0;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
@@ -602,7 +602,7 @@ static int search_default_file_with_ext(struct handle_option_ctx *ctx,
MYSQL_FILE *fp;
uint line=0;
enum { NONE, PARSE, SKIP } found_group= NONE;
- uint i;
+ size_t i;
MY_DIR *search_dir;
FILEINFO *search_file;
@@ -690,7 +690,7 @@ static int search_default_file_with_ext(struct handle_option_ctx *ctx,
if (!(search_dir= my_dir(ptr, MYF(MY_WME | MY_WANT_SORT))))
goto err;
- for (i= 0; i < (uint) search_dir->number_of_files; i++)
+ for (i= 0; i < search_dir->number_of_files; i++)
{
search_file= search_dir->dir_entry + i;
ext= fn_ext2(search_file->name);
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index d322f302ea7..25c0f4657af 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -193,7 +193,7 @@ int my_rmtree(const char *dir, myf MyFlags)
char path[FN_REFLEN];
char sep[] = { FN_LIBCHAR, 0 };
int err = 0;
- uint i;
+ size_t i;
MY_DIR *dir_info = my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT));
if (!dir_info)
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 2b420da03be..d201d45a4ee 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -22,6 +22,9 @@
#include <m_ctype.h>
#include <signal.h>
#include <mysql/psi/mysql_stage.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef _WIN32
#ifdef _MSC_VER
#include <locale.h>
@@ -35,6 +38,10 @@ static my_bool win32_init_tcp_ip();
#define my_win_init()
#endif
+#if defined(_SC_PAGE_SIZE) && !defined(_SC_PAGESIZE)
+#define _SC_PAGESIZE _SC_PAGE_SIZE
+#endif
+
extern pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
#define SCALE_SEC 100
@@ -42,6 +49,7 @@ extern pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
my_bool my_init_done= 0;
uint mysys_usage_id= 0; /* Incremented for each my_init() */
+size_t my_system_page_size= 8192; /* Default if no sysconf() */
ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024);
@@ -79,6 +87,9 @@ my_bool my_init(void)
my_umask= 0660; /* Default umask for new files */
my_umask_dir= 0700; /* Default umask for new directories */
my_global_flags= 0;
+#ifdef _SC_PAGESIZE
+ my_system_page_size= sysconf(_SC_PAGESIZE);
+#endif
/* Default creation of new files */
if ((str= getenv("UMASK")) != 0)
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index 732aef1fdac..1b6b68816f8 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-/* Alloc a block of locked memory */
+/* Alloc a block of locked memory (memory protected against swap) */
#include "mysys_priv.h"
#include "mysys_err.h"
@@ -35,7 +35,7 @@ LIST *mem_list;
uchar *my_malloc_lock(uint size,myf MyFlags)
{
int success;
- uint pagesize=sysconf(_SC_PAGESIZE);
+ uint pagesize= my_system_page_size;
uchar *ptr;
struct st_mem_list *element;
DBUG_ENTER("my_malloc_lock");
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index befdcb0e5c3..b2cbb84984d 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -84,7 +84,7 @@ void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
/* We have to align size as we store MY_THREAD_SPECIFIC flag in the LSB */
size= ALIGN_SIZE(size);
- if (DBUG_EVALUATE_IF("simulate_out_of_memory", 1, 0))
+ if (DBUG_IF("simulate_out_of_memory"))
mh= NULL;
else
mh= (my_memory_header*) sf_malloc(size + HEADER_SIZE, my_flags);
diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c
index 72c8fa8507d..7925f80191b 100644
--- a/mysys/my_uuid.c
+++ b/mysys/my_uuid.c
@@ -216,37 +216,6 @@ void my_uuid(uchar *to)
}
-/**
- Convert uuid to string representation
-
- @func my_uuid2str()
- @param guid uuid
- @param s Output buffer.Must be at least MY_UUID_STRING_LENGTH+1 large.
-*/
-void my_uuid2str(const uchar *guid, char *s)
-{
- int i;
- for (i=0; i < MY_UUID_SIZE; i++)
- {
- *s++= _dig_vec_lower[guid[i] >>4];
- *s++= _dig_vec_lower[guid[i] & 15];
- /* Set '-' at intervals 3, 5, 7 and 9 */
- if ((1 << i) & ((1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)))
- *s++= '-';
- }
-}
-
-void my_uuid2str_oracle(const uchar *guid, char *s)
-{
- int i;
- for (i=0; i < MY_UUID_SIZE; i++)
- {
- *s++= _dig_vec_upper[guid[i] >>4];
- *s++= _dig_vec_upper[guid[i] & 15];
- }
-}
-
-
void my_uuid_end()
{
if (my_uuid_inited)
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index dd3a5ce132f..aca1c1f7731 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -332,7 +332,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
*/
pthread_mutex_lock(&THR_LOCK_mutex);
- if (!my_hash_search(mutex_root->locked_mutex, (uchar*) &mp->id, 0))
+ if (!my_hash_search(mutex_root->locked_mutex, (uchar*) &mp->id,
+ sizeof(mp->id)))
{
safe_mutex_deadlock_t *deadlock;
safe_mutex_t *mutex;
@@ -352,7 +353,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
mutex= mutex_root;
do
{
- if (my_hash_search(mp->locked_mutex, (uchar*) &mutex->id, 0))
+ if (my_hash_search(mp->locked_mutex, (uchar*) &mutex->id,
+ sizeof(mutex->id)))
{
print_deadlock_warning(mp, mutex);
/* Mark wrong usage to avoid future warnings for same error */
@@ -772,7 +774,8 @@ static my_bool remove_from_locked_mutex(safe_mutex_t *mp,
delete_mutex->id, mp->id));
found= (safe_mutex_deadlock_t *) my_hash_search(mp->locked_mutex,
- (uchar*) &delete_mutex->id, 0);
+ (uchar*) &delete_mutex->id,
+ sizeof(delete_mutex->id));
DBUG_ASSERT(found);
if (found)
{
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index dd60088d534..a03f8da3009 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -598,7 +598,7 @@ static int deadlock_search(struct deadlock_arg *arg, WT_THD *blocker,
{
WT_RESOURCE *rc, *volatile *shared_ptr= &blocker->waiting_for;
WT_THD *cursor;
- uint i;
+ size_t i;
int ret= WT_OK;
DBUG_ENTER("deadlock_search");
DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, depth=%u",
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index d232b3b5c65..ffcfa019294 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -15,6 +15,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+#include <my_global.h>
#include <config_auth_pam.h>
#include <unistd.h>
#include <string.h>
@@ -23,7 +24,6 @@
#include <spawn.h>
#include <mysql/plugin_auth.h>
#include "auth_pam_tool.h"
-#include <my_global.h>
#ifndef DBUG_OFF
static char pam_debug = 0;
diff --git a/plugin/cracklib_password_check/cracklib_password_check.c b/plugin/cracklib_password_check/cracklib_password_check.c
index 470e6e5280f..9568f84a03b 100644
--- a/plugin/cracklib_password_check/cracklib_password_check.c
+++ b/plugin/cracklib_password_check/cracklib_password_check.c
@@ -22,18 +22,21 @@
static char *dictionary;
static int crackme(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password)
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname)
{
char *user= alloca(username->length + 1);
- char *host;
+ char *full_name= alloca(hostname->length + username->length + 2);
const char *res;
memcpy(user, username->str, username->length);
user[username->length]= 0;
- if ((host= strchr(user, '@')))
- *host++= 0;
+ memcpy(full_name, username->str, username->length);
+ full_name[username->length]= '@';
+ memcpy(full_name + username->length + 1, hostname->str, hostname->length);
+ full_name[hostname->length+ username->length + 1]= 0;
- if ((res= FascistCheckUser(password->str, dictionary, user, host)))
+ if ((res= FascistCheckUser(password->str, dictionary, user, full_name)))
{
my_printf_error(ER_NOT_VALID_PASSWORD, "cracklib: %s",
ME_WARNING, res);
diff --git a/plugin/password_reuse_check/CMakeLists.txt b/plugin/password_reuse_check/CMakeLists.txt
new file mode 100644
index 00000000000..6c816071747
--- /dev/null
+++ b/plugin/password_reuse_check/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c
+ RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/password_reuse_check/password_reuse_check.c b/plugin/password_reuse_check/password_reuse_check.c
new file mode 100644
index 00000000000..8f5973721d8
--- /dev/null
+++ b/plugin/password_reuse_check/password_reuse_check.c
@@ -0,0 +1,262 @@
+/* Copyright (c) 2021, Oleksandr Byelkin 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 */
+
+#include <my_global.h> // for int2store
+#include <stdio.h> // for snprintf
+#include <string.h> // for memset
+#include <mysql/plugin_password_validation.h>
+#include <mysqld_error.h>
+
+#define HISTORY_DB_NAME "password_reuse_check_history"
+
+#define SQL_BUFF_LEN 2048
+
+#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
+
+// 0 - unlimited, otherwise number of days to check
+static unsigned interval= 0;
+
+// helping string for bin_to_hex512
+static char digits[]= "0123456789ABCDEF";
+
+/**
+ Store string with length
+
+ @param to buffer where to put the length and string
+ @param from the string to store
+
+ @return reference on the byte after copied string
+*/
+
+static char *store_str(char *to, const MYSQL_CONST_LEX_STRING *from)
+{
+ int2store(to, from->length);
+ memcpy(to + 2, from->str, from->length);
+ return to + 2 + from->length;
+}
+
+
+/**
+ Convert string of 512 bits (64 bytes) to hex representation
+
+ @param to pointer to the result puffer
+ (should be at least 64*2 bytes)
+ @param str pointer to 512 bits (64 bytes string)
+*/
+
+static void bin_to_hex512(char *to, const unsigned char *str)
+{
+ const unsigned char *str_end= str + (512/8);
+ for (; str != str_end; ++str)
+ {
+ *to++= digits[((unsigned char) *str) >> 4];
+ *to++= digits[((unsigned char) *str) & 0x0F];
+ }
+}
+
+
+/**
+ Send SQL error as ER_UNKNOWN_ERROR for information
+
+ @param mysql Connection handler
+*/
+
+static void report_sql_error(MYSQL *mysql)
+{
+ my_printf_error(ER_UNKNOWN_ERROR, "password_reuse_check:[%d] %s", ME_WARNING,
+ mysql_errno(mysql), mysql_error(mysql));
+}
+
+
+/**
+ Create the history of passwords table for this plugin.
+
+ @param mysql Connection handler
+
+ @retval 1 - Error
+ @retval 0 - OK
+*/
+
+static int create_table(MYSQL *mysql)
+{
+ if (mysql_real_query(mysql,
+ // 512/8 = 64
+ STRING_WITH_LEN("CREATE TABLE mysql." HISTORY_DB_NAME
+ " ( hash binary(64),"
+ " time timestamp default current_timestamp,"
+ " primary key (hash), index tm (time) )"
+ " ENGINE=Aria")))
+ {
+ report_sql_error(mysql);
+ return 1;
+ }
+ return 0;
+}
+
+
+/**
+ Run this query and create table if needed
+
+ @param mysql Connection handler
+ @param query The query to run
+ @param len length of the query text
+
+ @retval 1 - Error
+ @retval 0 - OK
+*/
+
+static int run_query_with_table_creation(MYSQL *mysql, const char *query,
+ size_t len)
+{
+ if (mysql_real_query(mysql, query, (unsigned long) len))
+ {
+ unsigned int rc= mysql_errno(mysql);
+ if (rc != ER_NO_SUCH_TABLE)
+ {
+ if (rc != ER_DUP_ENTRY)
+ {
+ report_sql_error(mysql);
+ }
+ else
+ {
+ // warning used to do not change error code
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "password_reuse_check: The password was already used",
+ ME_WARNING);
+ }
+ return 1;
+ }
+ if (create_table(mysql))
+ return 1;
+ if (mysql_real_query(mysql, query, (unsigned long) len))
+ {
+ report_sql_error(mysql);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+/**
+ Password validator
+
+ @param username User name (part of whole login name)
+ @param password Password to validate
+ @param hostname Host name (part of whole login name)
+
+ @retval 1 - Password is not OK or an error happened
+ @retval 0 - Password is OK
+*/
+
+static int validate(const MYSQL_CONST_LEX_STRING *username,
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname)
+{
+ MYSQL *mysql= NULL;
+ size_t key_len= username->length + password->length + hostname->length +
+ (3 * 2 /* space for storing length of the strings */);
+ size_t buff_len= (key_len > SQL_BUFF_LEN ? key_len : SQL_BUFF_LEN);
+ size_t len;
+ char *buff= malloc(buff_len);
+ unsigned char hash[512/8];
+ char escaped_hash[512/8*2 + 1];
+ if (!buff)
+ return 1;
+
+ mysql= mysql_init(NULL);
+ if (!mysql)
+ {
+ free(buff);
+ return 1;
+ }
+
+ /*
+ Store: username, hostname, password
+ (password first to make its rewriting password in memory simplier)
+ */
+ store_str(store_str(store_str(buff, password), username), hostname);
+ buff[key_len]= 0; // safety
+ memset(hash, 0, sizeof(hash));
+ my_sha512(hash, buff, key_len);
+ // safety: rewrite password with zerows
+ memset(buff, 0, password->length);
+ if (mysql_real_connect_local(mysql) == NULL)
+ goto sql_error;
+
+ if (interval)
+ {
+ // trim the table
+ len= snprintf(buff, buff_len,
+ "DELETE FROM mysql." HISTORY_DB_NAME
+ " WHERE time < DATE_SUB(NOW(), interval %d day)",
+ interval);
+ if (run_query_with_table_creation(mysql, buff, len))
+ goto sql_error;
+ }
+
+ bin_to_hex512(escaped_hash, hash);
+ escaped_hash[512/8*2]= '\0';
+ len= snprintf(buff, buff_len,
+ "INSERT INTO mysql." HISTORY_DB_NAME "(hash) "
+ "values (x'%s')",
+ escaped_hash);
+ if (run_query_with_table_creation(mysql, buff, len))
+ goto sql_error;
+
+ free(buff);
+ mysql_close(mysql);
+ return 0; // OK
+
+sql_error:
+ free(buff);
+ if (mysql)
+ mysql_close(mysql);
+ return 1; // Error
+}
+
+static MYSQL_SYSVAR_UINT(interval, interval, PLUGIN_VAR_RQCMDARG,
+ "Password history retention period in days (0 means unlimited)", NULL, NULL,
+ 0, 0, 365*100, 1);
+
+
+static struct st_mysql_sys_var* sysvars[]= {
+ MYSQL_SYSVAR(interval),
+ NULL
+};
+
+static struct st_mariadb_password_validation info=
+{
+ MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION,
+ validate
+};
+
+maria_declare_plugin(password_reuse_check)
+{
+ MariaDB_PASSWORD_VALIDATION_PLUGIN,
+ &info,
+ "password_reuse_check",
+ "Oleksandr Byelkin",
+ "Prevent password reuse",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0200,
+ NULL,
+ sysvars,
+ "2.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_bzip2/CMakeLists.txt b/plugin/provider_bzip2/CMakeLists.txt
new file mode 100644
index 00000000000..e2ac4592b1b
--- /dev/null
+++ b/plugin/provider_bzip2/CMakeLists.txt
@@ -0,0 +1,15 @@
+FIND_PACKAGE(BZip2)
+
+SET(CPACK_RPM_provider-bzip2_PACKAGE_SUMMARY "BZip2 compression support in the server and storage engines" PARENT_SCOPE)
+SET(CPACK_RPM_provider-bzip2_PACKAGE_DESCRIPTION "BZip2 compression support in the server and storage engines" PARENT_SCOPE)
+
+IF (BZIP2_FOUND)
+ GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
+ INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIRS})
+
+ MYSQL_ADD_PLUGIN(provider_bzip2 plugin.c COMPONENT provider-bzip2
+ LINK_LIBRARIES ${BZIP2_LIBRARIES} CONFIG provider_bzip2.cnf)
+ENDIF()
diff --git a/plugin/provider_bzip2/plugin.c b/plugin/provider_bzip2/plugin.c
new file mode 100644
index 00000000000..92978b7e888
--- /dev/null
+++ b/plugin/provider_bzip2/plugin.c
@@ -0,0 +1,61 @@
+/* Copyright (c) 2021, 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 */
+
+#include <stdbool.h>
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+#include <bzlib.h>
+#include <providers/bzlib.h>
+
+static int init(void* h)
+{
+ provider_service_bzip2->BZ2_bzBuffToBuffCompress_ptr= BZ2_bzBuffToBuffCompress;
+ provider_service_bzip2->BZ2_bzBuffToBuffDecompress_ptr= BZ2_bzBuffToBuffDecompress;
+ provider_service_bzip2->BZ2_bzCompress_ptr= BZ2_bzCompress;
+ provider_service_bzip2->BZ2_bzCompressEnd_ptr= BZ2_bzCompressEnd;
+ provider_service_bzip2->BZ2_bzCompressInit_ptr= BZ2_bzCompressInit;
+ provider_service_bzip2->BZ2_bzDecompress_ptr= BZ2_bzDecompress;
+ provider_service_bzip2->BZ2_bzDecompressEnd_ptr= BZ2_bzDecompressEnd;
+ provider_service_bzip2->BZ2_bzDecompressInit_ptr= BZ2_bzDecompressInit;
+
+ provider_service_bzip2->is_loaded = true;
+
+ return 0;
+}
+
+static int deinit(void *h)
+{
+ return 1; /* don't unload me */
+}
+
+static struct st_mysql_daemon info= { MYSQL_DAEMON_INTERFACE_VERSION };
+
+maria_declare_plugin(provider_bzip2)
+{
+ MYSQL_DAEMON_PLUGIN,
+ &info,
+ "provider_bzip2",
+ "Kartik Soneji",
+ "BZip2 compression provider",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_bzip2/provider_bzip2.cnf b/plugin/provider_bzip2/provider_bzip2.cnf
new file mode 100644
index 00000000000..9b855e88769
--- /dev/null
+++ b/plugin/provider_bzip2/provider_bzip2.cnf
@@ -0,0 +1,3 @@
+[server]
+plugin_load_add=provider_bzip2
+provider_bzip2=force_plus_permanent
diff --git a/plugin/provider_lz4/CMakeLists.txt b/plugin/provider_lz4/CMakeLists.txt
new file mode 100644
index 00000000000..daad63ac6da
--- /dev/null
+++ b/plugin/provider_lz4/CMakeLists.txt
@@ -0,0 +1,15 @@
+FIND_PACKAGE(LZ4 1.6)
+
+SET(CPACK_RPM_provider-lz4_PACKAGE_SUMMARY "LZ4 compression support in the server and storage engines" PARENT_SCOPE)
+SET(CPACK_RPM_provider-lz4_PACKAGE_DESCRIPTION "LZ4 compression support in the server and storage engines" PARENT_SCOPE)
+
+IF (LZ4_FOUND)
+ GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
+ INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIRS})
+
+ MYSQL_ADD_PLUGIN(provider_lz4 plugin.c COMPONENT provider-lz4
+ LINK_LIBRARIES ${LZ4_LIBRARIES} CONFIG provider_lz4.cnf)
+ENDIF()
diff --git a/plugin/provider_lz4/plugin.c b/plugin/provider_lz4/plugin.c
new file mode 100644
index 00000000000..f9eab163d5a
--- /dev/null
+++ b/plugin/provider_lz4/plugin.c
@@ -0,0 +1,56 @@
+/* Copyright (c) 2021, 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 */
+
+#include <stdbool.h>
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+#include <lz4.h>
+#include <providers/lz4.h>
+
+static int init(void* h)
+{
+ provider_service_lz4->LZ4_compressBound_ptr= LZ4_compressBound;
+ provider_service_lz4->LZ4_compress_default_ptr= LZ4_compress_default;
+ provider_service_lz4->LZ4_decompress_safe_ptr= LZ4_decompress_safe;
+
+ provider_service_lz4->is_loaded = true;
+
+ return 0;
+}
+
+static int deinit(void *h)
+{
+ return 1; /* don't unload me */
+}
+
+static struct st_mysql_daemon info= { MYSQL_DAEMON_INTERFACE_VERSION };
+
+maria_declare_plugin(provider_lz4)
+{
+ MYSQL_DAEMON_PLUGIN,
+ &info,
+ "provider_lz4",
+ "Kartik Soneji",
+ "LZ4 compression provider",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_lz4/provider_lz4.cnf b/plugin/provider_lz4/provider_lz4.cnf
new file mode 100644
index 00000000000..0b8a3ec5222
--- /dev/null
+++ b/plugin/provider_lz4/provider_lz4.cnf
@@ -0,0 +1,3 @@
+[server]
+plugin_load_add=provider_lz4
+provider_lz4=force_plus_permanent
diff --git a/plugin/provider_lzma/CMakeLists.txt b/plugin/provider_lzma/CMakeLists.txt
new file mode 100644
index 00000000000..8b0781aaa33
--- /dev/null
+++ b/plugin/provider_lzma/CMakeLists.txt
@@ -0,0 +1,15 @@
+FIND_PACKAGE(LibLZMA)
+
+SET(CPACK_RPM_provider-lzma_PACKAGE_SUMMARY "LZMA compression support in the server and storage engines" PARENT_SCOPE)
+SET(CPACK_RPM_provider-lzma_PACKAGE_DESCRIPTION "LZMA compression support in the server and storage engines" PARENT_SCOPE)
+
+IF (LIBLZMA_FOUND)
+ GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
+ INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
+
+ MYSQL_ADD_PLUGIN(provider_lzma plugin.c COMPONENT provider-lzma
+ LINK_LIBRARIES ${LIBLZMA_LIBRARIES} CONFIG provider_lzma.cnf)
+ENDIF()
diff --git a/plugin/provider_lzma/plugin.c b/plugin/provider_lzma/plugin.c
new file mode 100644
index 00000000000..0c18471a068
--- /dev/null
+++ b/plugin/provider_lzma/plugin.c
@@ -0,0 +1,55 @@
+/* Copyright (c) 2021, 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 */
+
+#include <stdbool.h>
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+#include <lzma.h>
+#include <providers/lzma.h>
+
+static int init(void* h)
+{
+ provider_service_lzma->lzma_stream_buffer_decode_ptr= lzma_stream_buffer_decode;
+ provider_service_lzma->lzma_easy_buffer_encode_ptr= lzma_easy_buffer_encode;
+
+ provider_service_lzma->is_loaded = true;
+
+ return 0;
+}
+
+static int deinit(void *h)
+{
+ return 1; /* don't unload me */
+}
+
+static struct st_mysql_daemon info= { MYSQL_DAEMON_INTERFACE_VERSION };
+
+maria_declare_plugin(provider_lzma)
+{
+ MYSQL_DAEMON_PLUGIN,
+ &info,
+ "provider_lzma",
+ "Kartik Soneji",
+ "LZMA compression provider",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_lzma/provider_lzma.cnf b/plugin/provider_lzma/provider_lzma.cnf
new file mode 100644
index 00000000000..3a05a356f7f
--- /dev/null
+++ b/plugin/provider_lzma/provider_lzma.cnf
@@ -0,0 +1,3 @@
+[server]
+plugin_load_add=provider_lzma
+provider_lzma=force_plus_permanent
diff --git a/plugin/provider_lzo/CMakeLists.txt b/plugin/provider_lzo/CMakeLists.txt
new file mode 100644
index 00000000000..8a8d31d238a
--- /dev/null
+++ b/plugin/provider_lzo/CMakeLists.txt
@@ -0,0 +1,15 @@
+FIND_PACKAGE(LZO)
+
+SET(CPACK_RPM_provider-lzo_PACKAGE_SUMMARY "LZO compression support in the server and storage engines" PARENT_SCOPE)
+SET(CPACK_RPM_provider-lzo_PACKAGE_DESCRIPTION "LZO compression support in the server and storage engines" PARENT_SCOPE)
+
+IF (LZO_FOUND)
+ GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
+ INCLUDE_DIRECTORIES(${LZO_INCLUDE_DIRS})
+
+ MYSQL_ADD_PLUGIN(provider_lzo plugin.c COMPONENT provider-lzo
+ LINK_LIBRARIES ${LZO_LIBRARIES} CONFIG provider_lzo.cnf)
+ENDIF()
diff --git a/plugin/provider_lzo/plugin.c b/plugin/provider_lzo/plugin.c
new file mode 100644
index 00000000000..44c6b54111b
--- /dev/null
+++ b/plugin/provider_lzo/plugin.c
@@ -0,0 +1,55 @@
+/* Copyright (c) 2021, 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 */
+
+#include <stdbool.h>
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+#include <lzo/lzo1x.h>
+#include <providers/lzo/lzo1x.h>
+
+static int init(void* h)
+{
+ provider_service_lzo->lzo1x_1_15_compress_ptr= lzo1x_1_15_compress;
+ provider_service_lzo->lzo1x_decompress_safe_ptr= lzo1x_decompress_safe;
+
+ provider_service_lzo->is_loaded = true;
+
+ return 0;
+}
+
+static int deinit(void *h)
+{
+ return 1; /* don't unload me */
+}
+
+static struct st_mysql_daemon info= { MYSQL_DAEMON_INTERFACE_VERSION };
+
+maria_declare_plugin(provider_lzo)
+{
+ MYSQL_DAEMON_PLUGIN,
+ &info,
+ "provider_lzo",
+ "Kartik Soneji",
+ "LZO compression provider",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_lzo/provider_lzo.cnf b/plugin/provider_lzo/provider_lzo.cnf
new file mode 100644
index 00000000000..65801983dd6
--- /dev/null
+++ b/plugin/provider_lzo/provider_lzo.cnf
@@ -0,0 +1,3 @@
+[server]
+plugin_load_add=provider_lzo
+provider_lzo=force_plus_permanent
diff --git a/plugin/provider_snappy/CMakeLists.txt b/plugin/provider_snappy/CMakeLists.txt
new file mode 100644
index 00000000000..d963029d75c
--- /dev/null
+++ b/plugin/provider_snappy/CMakeLists.txt
@@ -0,0 +1,15 @@
+FIND_PACKAGE(Snappy)
+
+SET(CPACK_RPM_provider-snappy_PACKAGE_SUMMARY "Snappy compression support in the server and storage engines" PARENT_SCOPE)
+SET(CPACK_RPM_provider-snappy_PACKAGE_DESCRIPTION "Snappy compression support in the server and storage engines" PARENT_SCOPE)
+
+IF (SNAPPY_FOUND)
+ GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
+ INCLUDE_DIRECTORIES(${SNAPPY_INCLUDE_DIRS})
+
+ MYSQL_ADD_PLUGIN(provider_snappy plugin.c COMPONENT provider-snappy
+ LINK_LIBRARIES ${SNAPPY_LIBRARIES} CONFIG provider_snappy.cnf)
+ENDIF()
diff --git a/plugin/provider_snappy/plugin.c b/plugin/provider_snappy/plugin.c
new file mode 100644
index 00000000000..8af7eb1b0ea
--- /dev/null
+++ b/plugin/provider_snappy/plugin.c
@@ -0,0 +1,58 @@
+/* Copyright (c) 2021, 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 */
+
+#include <stdbool.h>
+#include <mysql_version.h>
+#include <mysql/plugin.h>
+#include <snappy-c.h>
+#define SNAPPY_C
+#include <providers/snappy-c.h>
+
+static int init(void* h)
+{
+ provider_service_snappy->snappy_max_compressed_length_ptr= snappy_max_compressed_length;
+ provider_service_snappy->snappy_compress_ptr= snappy_compress;
+ provider_service_snappy->snappy_uncompressed_length_ptr= snappy_uncompressed_length;
+ provider_service_snappy->snappy_uncompress_ptr= snappy_uncompress;
+
+ provider_service_snappy->is_loaded = true;
+
+ return 0;
+}
+
+static int deinit(void *h)
+{
+ return 1; /* don't unload me */
+}
+
+static struct st_mysql_daemon info= { MYSQL_DAEMON_INTERFACE_VERSION };
+
+maria_declare_plugin(provider_snappy)
+{
+ MYSQL_DAEMON_PLUGIN,
+ &info,
+ "provider_snappy",
+ "Kartik Soneji",
+ "SNAPPY compression provider",
+ PLUGIN_LICENSE_GPL,
+ init,
+ deinit,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/provider_snappy/provider_snappy.cnf b/plugin/provider_snappy/provider_snappy.cnf
new file mode 100644
index 00000000000..da78207c3e6
--- /dev/null
+++ b/plugin/provider_snappy/provider_snappy.cnf
@@ -0,0 +1,3 @@
+[server]
+plugin_load_add=provider_snappy
+provider_snappy=force_plus_permanent
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 52af6206cb2..3c94df243d0 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1153,7 +1153,6 @@ static void setup_connection_simple(struct connection_info *ci)
#define MAX_HOSTNAME (HOSTNAME_LENGTH + 1) /* len+1 in mysql.user */
-#define USERNAME_LENGTH 384
static void setup_connection_connect(MYSQL_THD thd,struct connection_info *cn,
const struct mysql_event_connection *event)
diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c
index 1762690f2c5..929906c6afe 100644
--- a/plugin/simple_password_check/simple_password_check.c
+++ b/plugin/simple_password_check/simple_password_check.c
@@ -23,7 +23,9 @@
static unsigned min_length, min_digits, min_letters, min_others;
static int validate(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password)
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname
+ __attribute__((unused)))
{
unsigned digits=0 , uppers=0 , lowers=0, others=0, length= (unsigned)password->length;
const char *ptr= password->str, *end= ptr + length;
diff --git a/plugin/test_sql_service/CMakeLists.txt b/plugin/test_sql_service/CMakeLists.txt
index aa9ecfe685e..615508bdc4e 100644
--- a/plugin/test_sql_service/CMakeLists.txt
+++ b/plugin/test_sql_service/CMakeLists.txt
@@ -15,4 +15,4 @@
SET(SOURCES test_sql_service.c)
-MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY RECOMPILE_FOR_EMBEDDED)
+MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY)
diff --git a/plugin/test_sql_service/test_sql_service.c b/plugin/test_sql_service/test_sql_service.c
index 062f10fce58..c2dbb93bf20 100644
--- a/plugin/test_sql_service/test_sql_service.c
+++ b/plugin/test_sql_service/test_sql_service.c
@@ -14,71 +14,108 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
-#define PLUGIN_VERSION 0x100
-#define PLUGIN_STR_VERSION "1.0.0"
-
-#define _my_thread_var loc_thread_var
-
-#include <my_config.h>
-#include <assert.h>
-#include <my_global.h>
-#include <my_base.h>
-#include <typelib.h>
-//#include <mysql_com.h> /* for enum enum_server_command */
-#include <mysql/plugin.h>
-#include <mysql/plugin_audit.h>
-//#include <string.h>
-
+#define PLUGIN_VERSION 0x200
-LEX_STRING * thd_query_string (MYSQL_THD thd);
-unsigned long long thd_query_id(const MYSQL_THD thd);
-size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen);
-const char *thd_user_name(MYSQL_THD thd);
-const char *thd_client_host(MYSQL_THD thd);
-const char *thd_client_ip(MYSQL_THD thd);
-LEX_CSTRING *thd_current_db(MYSQL_THD thd);
-int thd_current_status(MYSQL_THD thd);
-enum enum_server_command thd_current_command(MYSQL_THD thd);
-
-int maria_compare_hostname(const char *wild_host, long wild_ip, long ip_mask,
- const char *host, const char *ip);
-void maria_update_hostname(const char **wild_host, long *wild_ip, long *ip_mask,
- const char *host);
+#include <mysql/plugin_audit.h>
+#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
/* Status variables for SHOW STATUS */
static long test_passed= 0;
+static char *sql_text_local, *sql_text_global;
+static char qwe_res[1024]= "";
+
static struct st_mysql_show_var test_sql_status[]=
{
{"test_sql_service_passed", (char *)&test_passed, SHOW_LONG},
+ {"test_sql_query_result", qwe_res, SHOW_CHAR},
{0,0,0}
};
-static my_bool do_test= TRUE;
-static void run_test(MYSQL_THD thd, struct st_mysql_sys_var *var,
- void *var_ptr, const void *save);
-static MYSQL_SYSVAR_BOOL(run_test, do_test, PLUGIN_VAR_OPCMDARG,
- "Perform the test now.", NULL, run_test, FALSE);
+static my_bool do_test= 1;
+static int run_test(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value);
+static int run_sql_local(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value);
+static int run_sql_global(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value);
+
+static void noop_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+
+static MYSQL_SYSVAR_BOOL(run_test, do_test,
+ PLUGIN_VAR_OPCMDARG,
+ "Perform the test now.",
+ run_test, NULL, 0);
+
+static MYSQL_SYSVAR_STR(execute_sql_local, sql_text_local,
+ PLUGIN_VAR_OPCMDARG,
+ "Create the new local connection, execute SQL statement with it.",
+ run_sql_local, noop_update, 0);
+
+static MYSQL_SYSVAR_STR(execute_sql_global, sql_text_global,
+ PLUGIN_VAR_OPCMDARG,
+ "Execute SQL statement using the global connection.",
+ run_sql_global, noop_update, 0);
+
static struct st_mysql_sys_var* test_sql_vars[]=
{
MYSQL_SYSVAR(run_test),
+ MYSQL_SYSVAR(execute_sql_local),
+ MYSQL_SYSVAR(execute_sql_global),
NULL
};
+static MYSQL *global_mysql;
+
+
+static int run_queries(MYSQL *mysql)
+{
+ MYSQL_RES *res;
+
+ if (mysql_real_query(mysql,
+ STRING_WITH_LEN("CREATE TABLE test.ts_table"
+ " ( hash varbinary(512),"
+ " time timestamp default current_time,"
+ " primary key (hash), index tm (time) )")))
+ return 1;
-extern int execute_sql_command(const char *command,
- char *hosts, char *names, char *filters);
+ if (mysql_real_query(mysql,
+ STRING_WITH_LEN("INSERT INTO test.ts_table VALUES('1234567890', NULL)")))
+ return 1;
+ if (mysql_real_query(mysql, STRING_WITH_LEN("select * from test.ts_table")))
+ return 1;
+
+ if (!(res= mysql_store_result(mysql)))
+ return 1;
+
+ mysql_free_result(res);
+
+ if (mysql_real_query(mysql, STRING_WITH_LEN("DROP TABLE test.ts_table")))
+ return 1;
+
+ return 0;
+}
static int do_tests()
{
- char plugins[1024];
- char names[1024];
- char dl[2048];
- int result;
+ MYSQL *mysql;
+ int result= 1;
+
+ mysql= mysql_init(NULL);
+ if (mysql_real_connect_local(mysql) == NULL)
+ return 1;
- result= execute_sql_command("select 'plugin', name, dl from mysql.plugin",
- plugins, names, dl);
+ if (run_queries(mysql))
+ goto exit;
+
+ if (run_queries(global_mysql))
+ goto exit;
+
+ result= 0;
+exit:
+ mysql_close(mysql);
return result;
}
@@ -89,29 +126,117 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
}
-static void run_test(MYSQL_THD thd __attribute__((unused)),
- struct st_mysql_sys_var *var __attribute__((unused)),
- void *var_ptr __attribute__((unused)),
- const void *save __attribute__((unused)))
+static int run_test(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value)
+{
+ return (test_passed= (do_tests() == 0)) == 0;
+}
+
+
+static int run_sql(MYSQL *mysql, void *save, struct st_mysql_value *value)
+{
+ const char *str;
+ int len= 0;
+ MYSQL_RES *res;
+
+ str= value->val_str(value, NULL, &len);
+
+ if (mysql_real_query(mysql, str, len))
+ {
+ if (mysql_error(mysql)[0])
+ {
+ my_snprintf(qwe_res, sizeof(qwe_res), "Error %d returned. %s",
+ mysql_errno(mysql), mysql_error(mysql));
+ return 0;
+ }
+
+ return 1;
+ }
+
+ if ((res= mysql_store_result(mysql)))
+ {
+ my_snprintf(qwe_res, sizeof(qwe_res), "Query returned %lld rows.",
+ mysql_num_rows(res));
+ mysql_free_result(res);
+ }
+ else
+ {
+ if (mysql_error(mysql)[0])
+ {
+ my_snprintf(qwe_res, sizeof(qwe_res), "Error %d returned. %s",
+ mysql_errno(mysql), mysql_error(mysql));
+ }
+ else
+ my_snprintf(qwe_res, sizeof(qwe_res), "Query affected %lld rows.",
+ mysql_affected_rows(mysql));
+ }
+
+ return 0;
+}
+
+
+static void noop_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
+{
+ sql_text_local= sql_text_global= qwe_res;
+}
+
+static int run_sql_local(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value)
+{
+ MYSQL *mysql;
+ int result= 1;
+
+ mysql= mysql_init(NULL);
+ if (mysql_real_connect_local(mysql) == NULL)
+ return 1;
+
+ if (run_sql(mysql, save, value))
+ goto exit;
+
+ result= 0;
+
+exit:
+ mysql_close(mysql);
+
+ return result;
+}
+
+
+static int run_sql_global(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
+ struct st_mysql_value *value)
{
- test_passed= do_tests();
+ return run_sql(global_mysql, save, value);
}
static int init_done= 0;
-static int test_sql_service_plugin_init(void *p __attribute__((unused)))
+static int test_sql_service_plugin_init(void *p)
{
+ (void) p;
+ global_mysql= mysql_init(NULL);
+
+ if (!global_mysql ||
+ mysql_real_connect_local(global_mysql) == NULL)
+ return 1;
+
init_done= 1;
+
+ test_passed= (do_tests() == 0);
+
return 0;
}
-static int test_sql_service_plugin_deinit(void *p __attribute__((unused)))
+static int test_sql_service_plugin_deinit(void *p)
{
+ (void) p;
if (!init_done)
return 0;
+ mysql_close(global_mysql);
+
return 0;
}
@@ -138,8 +263,8 @@ maria_declare_plugin(test_sql_service)
PLUGIN_VERSION,
test_sql_status,
test_sql_vars,
- PLUGIN_STR_VERSION,
- MariaDB_PLUGIN_MATURITY_STABLE
+ NULL,
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
}
maria_declare_plugin_end;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
index 79958ee77f4..f4de0d8f78c 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -192,9 +192,9 @@ 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
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t1`.`a`
INSERT INTO t1 VALUES (TIME'10:20:30');
-ERROR 22007: Incorrect inet6 value: '10:20:30' for column `test`.`t1`.`a` at row 1
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t1`.`a`
INSERT INTO t1 VALUES (0x00);
ERROR 22007: Incorrect inet6 value: '\x00' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
@@ -820,15 +820,15 @@ DROP TABLE t1;
#
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
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`a`
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
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t1`.`a`
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
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t1`.`a`
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(64));
INSERT INTO t1 VALUES (CAST('::' AS INET6));
@@ -1606,7 +1606,7 @@ DROP TABLE t1;
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
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1614,7 +1614,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1622,7 +1622,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1630,7 +1630,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'year' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1641,7 +1641,7 @@ DROP TABLE t1;
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
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1649,7 +1649,7 @@ 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
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1657,7 +1657,7 @@ 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
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1665,7 +1665,7 @@ 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
+ERROR HY000: Cannot cast 'year' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1676,7 +1676,7 @@ DROP TABLE t1;
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
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1684,7 +1684,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'date' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1692,7 +1692,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'datetime' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1700,7 +1700,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'timestamp' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1711,7 +1711,7 @@ DROP TABLE t1;
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
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1719,7 +1719,7 @@ 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
+ERROR HY000: Cannot cast 'date' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1727,7 +1727,7 @@ 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
+ERROR HY000: Cannot cast 'datetime' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1735,7 +1735,7 @@ 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
+ERROR HY000: Cannot cast 'timestamp' as 'inet6' in assignment of `test`.`t1`.`b`
SELECT b FROM t1;
b
NULL
@@ -1922,7 +1922,7 @@ DROP TABLE t1;
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
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t1`.`b`
SELECT * FROM t1;
a b
:: NULL
@@ -1931,7 +1931,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'timestamp' in assignment of `test`.`t1`.`b`
SELECT * FROM t1;
a b
:: 2001-01-01 10:20:30
@@ -1940,7 +1940,7 @@ 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
+ERROR HY000: Cannot cast 'inet6' as 'date' in assignment of `test`.`t1`.`a`
DROP TABLE t1;
#
# MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
index 2cdbc0eb2b9..0f587a75a7d 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -1,4 +1,3 @@
-
--echo #
--echo # Basic CREATE functionality, defaults, metadata
--echo #
@@ -48,9 +47,9 @@ 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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT INTO t1 VALUES (1);
---error ER_TRUNCATED_WRONG_VALUE
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT INTO t1 VALUES (TIME'10:20:30');
--error ER_TRUNCATED_WRONG_VALUE
INSERT INTO t1 VALUES (0x00);
@@ -447,17 +446,17 @@ DROP TABLE t1;
--echo #
CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT INTO t1 VALUES (CAST('::' AS INET6));
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT INTO t1 VALUES (CAST('::' AS INET6));
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(32,0));
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT INTO t1 VALUES (CAST('::' AS INET6));
DROP TABLE t1;
@@ -1095,28 +1094,28 @@ DROP TABLE t1;
CREATE TABLE t1 (a INET6, b INT);
INSERT INTO t1 VALUES ('ffff::ffff', NULL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT b FROM t1;
DROP TABLE t1;
@@ -1128,28 +1127,28 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, b INET6);
INSERT INTO t1 VALUES (1, NULL);
---error ER_TRUNCATED_WRONG_VALUE
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT b FROM t1;
DROP TABLE t1;
@@ -1161,28 +1160,28 @@ DROP TABLE t1;
CREATE TABLE t1 (a INET6, b TIME);
INSERT INTO t1 VALUES ('ffff::ffff', NULL);
---error ER_TRUNCATED_WRONG_VALUE
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT b FROM t1;
DROP TABLE t1;
@@ -1194,28 +1193,28 @@ DROP TABLE t1;
CREATE TABLE t1 (a TIME, b INET6);
INSERT INTO t1 VALUES ('00:00:00', NULL);
---error ER_TRUNCATED_WRONG_VALUE
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT b FROM t1;
DROP TABLE t1;
@@ -1406,7 +1405,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INET6, b INT);
INSERT INTO t1 (a) VALUES ('::');
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT * FROM t1;
DROP TABLE t1;
@@ -1414,7 +1413,7 @@ 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
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
UPDATE t1 SET b=a;
SELECT * FROM t1;
DROP TABLE t1;
@@ -1422,7 +1421,7 @@ SET timestamp=DEFAULT;
CREATE OR REPLACE TABLE t1 (a INET6);
INSERT INTO t1 (a) VALUES ('::');
---error ER_TRUNCATED_WRONG_VALUE
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
ALTER TABLE t1 MODIFY a DATE;
DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result
new file mode 100644
index 00000000000..2f715767686
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` decimal(38,0) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target decimal(38,0)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'decimal' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc decimal(38,0) DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` decimal(38,0) DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'decimal' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst decimal(38,0) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst decimal(38,0))
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst decimal(38,0) DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'decimal' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS decimal(38,0)
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst decimal(38,0) DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'decimal' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test
new file mode 100644
index 00000000000..9696d313790
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result
new file mode 100644
index 00000000000..5a4d9021dff
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` double DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target double
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc double DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` double DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a double) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst double)
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS double
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test
new file mode 100644
index 00000000000..8fc0e24d177
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result
new file mode 100644
index 00000000000..261afd7ba32
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.result
@@ -0,0 +1,406 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+SET sql_mode='';
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` double DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+UPDATE t3 SET target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column ``.`(temporary)`.`target` at row 1
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target double
+EXECUTE IMMEDIATE @alter;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+f1((SELECT source FROM t1 ORDER BY source LIMIT 1))
+NULL
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc double DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+f1()
+NULL
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+Warning 1292 Incorrect inet6 value: '0' for column ``.``.`dst` at row 1
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` double DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+UPDATE t3 SET target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column ``.`(temporary)`.`target` at row 1
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+f1((SELECT source FROM t1 ORDER BY source LIMIT 1))
+NULL
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a double) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst double)
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS double
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+f1()
+NULL
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+Warning 1366 Incorrect double value: '::' for column ``.``.`dst` at row 1
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test
new file mode 100644
index 00000000000..2721d9c5643
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_loose.test
@@ -0,0 +1,21 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+SET sql_mode='';
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result
new file mode 100644
index 00000000000..bd870d14505
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.result
@@ -0,0 +1,400 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+SET @ignore='IGNORE';
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` double DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT IGNORE INTO t3 SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+INSERT IGNORE INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+UPDATE IGNORE t3 SET target=source;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+UPDATE IGNORE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column ``.`(temporary)`.`target` at row 1
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER IGNORE TABLE t3 MODIFY target double
+EXECUTE IMMEDIATE @alter;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'double' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc double DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` double DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT IGNORE INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT IGNORE INTO t3 SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+INSERT IGNORE INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+INSERT IGNORE INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+UPDATE IGNORE t3 SET target=source;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column `test`.`t3`.`target` at row 1
+UPDATE IGNORE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+Warnings:
+Warning 4078 Cannot cast 'inet6' as 'double' in assignment of `test`.`t3`.`target`
+Warning 1366 Incorrect double value: '::' for column ``.`(temporary)`.`target` at row 1
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER IGNORE TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+Warnings:
+Warning 4078 Cannot cast 'double' as 'inet6' in assignment of `test`.`t3`.`target`
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 1
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a double) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst double)
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'double' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS double
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test
new file mode 100644
index 00000000000..ebb41854df2
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_double_strict_ignore.test
@@ -0,0 +1,21 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+SET @ignore='IGNORE';
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DOUBLE DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result
new file mode 100644
index 00000000000..f8f818f3ce3
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` int(11) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target int(11)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'int' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc int(11) DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` int(11) DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a int(11)) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst int(11))
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'int' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS int(11)
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test
new file mode 100644
index 00000000000..21a47e39f90
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_int.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target INT DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result
new file mode 100644
index 00000000000..d3280ffe3d2
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source TIME DEFAULT '00:00:00');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` time DEFAULT '00:00:00',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '00:00:00' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 00:00:00
+2 :: 00:00:00
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '00:00:00' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 00:00:00
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target time
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src time DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src time DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'time' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc time DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src time DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` time DEFAULT '00:00:00',
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 00:00:00 ::
+2 00:00:00 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect time value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00:00:00 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'time' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst time DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a time) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst time)
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst time DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'time' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS time
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst time DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'time' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test
new file mode 100644
index 00000000000..7ffb3133d0c
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_time.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source TIME DEFAULT '00:00:00');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result
new file mode 100644
index 00000000000..f040b54ee34
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT UNSIGNED DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` int(10) unsigned DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target int(10) unsigned
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+DECLARE dst inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a inet6) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a inet6) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst inet6)
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'int unsigned' as 'inet6' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS inet6
+BEGIN
+DECLARE rc int(10) unsigned DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+DECLARE cur1 CURSOR(t inet6) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst inet6 DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` int(10) unsigned DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect integer value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'int unsigned' as 'inet6' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE dst int(10) unsigned DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst int(10) unsigned)
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst int(10) unsigned DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'inet6' as 'int unsigned' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS int(10) unsigned
+BEGIN
+DECLARE rc inet6 DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src inet6 DEFAULT NULL;
+DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst int(10) unsigned DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'inet6' as 'int unsigned' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test
new file mode 100644
index 00000000000..7506b56742f
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_uint.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source INT UNSIGNED DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source INET6 DEFAULT '::0');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result
new file mode 100644
index 00000000000..df268156981
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result
@@ -0,0 +1,51 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+#
+CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (i6 inet6, a2 varchar(10));
+INSERT INTO t1 VALUES ('::','uw'), (null,'a');
+SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1;
+group_concat(coalesce(i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES();
+SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1;
+JSON_ARRAYAGG(a ORDER BY a DESC)
+[null]
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1)
+::
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1;
+GROUP_CONCAT(DISTINCT COALESCE(i6, a2))
+::
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test
new file mode 100644
index 00000000000..71dfcebf71a
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test
@@ -0,0 +1,41 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+--echo #
+
+CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 inet6, a2 varchar(10));
+INSERT INTO t1 VALUES ('::','uw'), (null,'a');
+SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES();
+SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc
index 2b3c415f346..b897f64a3b2 100644
--- a/plugin/type_mysql_json/type.cc
+++ b/plugin/type_mysql_json/type.cc
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-#include <mysql/plugin_data_type.h>
#include <my_global.h>
+#include <mysql/plugin_data_type.h>
#include <sql_type.h>
#include <field.h>
#include <mysqld_error.h>
@@ -40,6 +40,18 @@ public:
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *def,
const Field *field) const override;
+ const Type_handler *type_handler_base() const override
+ {
+ /*
+ Override this method in the same way with what Type_handler_blob_json
+ does, to tell the server that MySQL JSON inherits aggregation behaviour
+ from the LONGBLOB data type.
+ This makes MariaDB JSON column and a MySQL JSON column compatible for
+ assignment, so "ALTER TABLE table_with_mysql_json FORCE" can run without
+ raising ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION.
+ */
+ return &type_handler_long_blob;
+ }
};
Type_handler_mysql_json type_handler_mysql_json;
diff --git a/plugin/type_uuid/CMakeLists.txt b/plugin/type_uuid/CMakeLists.txt
new file mode 100644
index 00000000000..9a379abef04
--- /dev/null
+++ b/plugin/type_uuid/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (c) 2019,2021, 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 02110-1335 USA
+
+MYSQL_ADD_PLUGIN(type_uuid
+ plugin.cc sql_type_uuid.cc item_uuidfunc.cc
+ MANDATORY RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/type_uuid/item_uuidfunc.cc b/plugin/type_uuid/item_uuidfunc.cc
new file mode 100644
index 00000000000..725b696f905
--- /dev/null
+++ b/plugin/type_uuid/item_uuidfunc.cc
@@ -0,0 +1,46 @@
+/* Copyright (c) 2019,2021, 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_uuidfunc.h"
+#include "sql_type_uuid.h"
+
+String *Item_func_sys_guid::val_str(String *str)
+{
+ DBUG_ASSERT(fixed());
+ str->alloc(uuid_len()+1);
+ str->length(uuid_len());
+ str->set_charset(collation.collation);
+
+ uchar buf[MY_UUID_SIZE];
+ my_uuid(buf);
+ my_uuid2str(buf, const_cast<char*>(str->ptr()), with_dashes);
+ return str;
+}
+
+const Type_handler *Item_func_uuid::type_handler() const
+{
+ return UUIDBundle::type_handler_fbt();
+}
+
+bool Item_func_uuid::val_native(THD *, Native *to)
+{
+ DBUG_ASSERT(fixed());
+ to->alloc(MY_UUID_SIZE);
+ to->length(MY_UUID_SIZE);
+ my_uuid((uchar*)to->ptr());
+ return 0;
+}
diff --git a/plugin/type_uuid/item_uuidfunc.h b/plugin/type_uuid/item_uuidfunc.h
new file mode 100644
index 00000000000..296b6592f10
--- /dev/null
+++ b/plugin/type_uuid/item_uuidfunc.h
@@ -0,0 +1,67 @@
+#ifndef ITEM_UUIDFUNC_INCLUDED
+#define ITEM_UUIDFUNC_INCLUDED
+
+/* Copyright (c) 2019,2021, 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 */
+
+
+#include "item.h"
+
+class Item_func_sys_guid: public Item_str_func
+{
+protected:
+ bool with_dashes;
+ size_t uuid_len() const
+ { return MY_UUID_BARE_STRING_LENGTH + with_dashes*MY_UUID_SEPARATORS; }
+public:
+ Item_func_sys_guid(THD *thd): Item_str_func(thd), with_dashes(false) {}
+ bool fix_length_and_dec() override
+ {
+ collation.set(DTCollation_numeric());
+ fix_char_length(uuid_len());
+ return FALSE;
+ }
+ bool const_item() const override { return false; }
+ table_map used_tables() const override { return RAND_TABLE_BIT; }
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("sys_guid") };
+ return name;
+ }
+ String *val_str(String *) override;
+ bool check_vcol_func_processor(void *arg) override
+ {
+ return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC);
+ }
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_sys_guid>(thd, this); }
+};
+
+class Item_func_uuid: public Item_func_sys_guid
+{
+public:
+ Item_func_uuid(THD *thd): Item_func_sys_guid(thd) { with_dashes= true; }
+ const Type_handler *type_handler() const override;
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("uuid") };
+ return name;
+ }
+ bool val_native(THD *thd, Native *to) override;
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_uuid>(thd, this); }
+};
+
+#endif // ITEM_UUIDFUNC_INCLUDED
diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result
new file mode 100644
index 00000000000..a0e5a3af11c
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result
@@ -0,0 +1,37 @@
+#
+# MDEV-4958 Adding datatype UUID
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
+EXECUTE stmt USING CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS UUID);
+DEALLOCATE PREPARE stmt;
+BEGIN NOT ATOMIC
+DECLARE a UUID DEFAULT '00000000-0000-0000-0000-000000000003';
+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 UUID)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000002')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ( NAME_CONST('a','00000000-0000-0000-0000-000000000003'))
+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_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test
new file mode 100644
index 00000000000..2c2dd95858d
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test
@@ -0,0 +1,32 @@
+--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
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+
+PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)';
+EXECUTE stmt USING CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS UUID);
+DEALLOCATE PREPARE stmt;
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE a UUID DEFAULT '00000000-0000-0000-0000-000000000003';
+ 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_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result
new file mode 100644
index 00000000000..3932470cf64
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result
@@ -0,0 +1,60 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+# Using DEFAULT_CHARSET format
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('123e4567-e89b-12d3-a456-426655440000');
+# Columns(BINARY(16))
+DROP TABLE t1;
+RESET MASTER;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000');
+# Columns(BINARY(16))
+DROP TABLE t1;
+RESET MASTER;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000');
+# Columns(`a` BINARY(16))
+DROP TABLE t1;
+RESET MASTER;
+# Using COLUMN_CHARSET format
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+# Columns(BINARY(16),
+# BINARY(16),
+# BINARY(48))
+DROP TABLE t1;
+RESET MASTER;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+# Columns(BINARY(16),
+# CHAR(16) CHARSET latin1 COLLATE latin1_swedish_ci,
+# CHAR(16) CHARSET utf8mb3 COLLATE utf8mb3_general_ci)
+DROP TABLE t1;
+RESET MASTER;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+# Columns(`a` BINARY(16),
+# `b` CHAR(16) CHARSET latin1 COLLATE latin1_swedish_ci,
+# `c` CHAR(16) CHARSET utf8mb3 COLLATE utf8mb3_general_ci)
+DROP TABLE t1;
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = DEFAULT;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test
new file mode 100644
index 00000000000..aa525123855
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test
@@ -0,0 +1,72 @@
+--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 # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+--echo # Using DEFAULT_CHARSET format
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('123e4567-e89b-12d3-a456-426655440000');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+--echo # Using COLUMN_CHARSET format
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = NO_LOG;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = MINIMAL;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+RESET MASTER;
+SET GLOBAL binlog_row_metadata = FULL;
+CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8);
+INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','','');
+--source suite/binlog/include/print_optional_metadata.inc
+DROP TABLE t1;
+RESET MASTER;
+
+SET GLOBAL binlog_row_metadata = DEFAULT;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result
new file mode 100644
index 00000000000..716f33134ca
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result
@@ -0,0 +1,35 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+SELECT
+'----' AS `----`,
+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'
+ AND PLUGIN_NAME IN
+('uuid')
+ORDER BY PLUGIN_NAME;
+---- ----
+PLUGIN_NAME uuid
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE FUNCTION
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Function UUID()
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Stable
+PLUGIN_AUTH_VERSION 1.0
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test
new file mode 100644
index 00000000000..ce8aba68979
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test
@@ -0,0 +1,30 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+--vertical_results
+SELECT
+ '----' AS `----`,
+ 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'
+ AND PLUGIN_NAME IN
+ ('uuid')
+ORDER BY PLUGIN_NAME;
+--horizontal_results
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result
new file mode 100644
index 00000000000..553c8c6eacd
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result
@@ -0,0 +1,35 @@
+include/master-slave.inc
+[connection master]
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+CREATE TABLE t1 (a BINARY(16));
+connection slave;
+ALTER TABLE t1 MODIFY a UUID;
+connection master;
+INSERT INTO t1 VALUES (X'00000000000000000000000000000000');
+INSERT INTO t1 VALUES (X'00000000000000000000000000000001');
+INSERT INTO t1 VALUES (X'fffffffffffffffffffffffffffffffe');
+INSERT INTO t1 VALUES (X'ffffffffffffffffffffffffffffffff');
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+00000000000000000000000000000000
+00000000000000000000000000000001
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+connection slave;
+SELECT * FROM t1 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffffffff-ffff-ffff-ffff-fffffffffffe
+ffffffff-ffff-ffff-ffff-ffffffffffff
+connection master;
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
+include/rpl_end.inc
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test
new file mode 100644
index 00000000000..6f3f5caebc4
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test
@@ -0,0 +1,33 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+CREATE TABLE t1 (a BINARY(16));
+
+--sync_slave_with_master
+ALTER TABLE t1 MODIFY a UUID;
+
+--connection master
+INSERT INTO t1 VALUES (X'00000000000000000000000000000000');
+INSERT INTO t1 VALUES (X'00000000000000000000000000000001');
+INSERT INTO t1 VALUES (X'fffffffffffffffffffffffffffffffe');
+INSERT INTO t1 VALUES (X'ffffffffffffffffffffffffffffffff');
+SELECT HEX(a) FROM t1 ORDER BY a;
+--sync_slave_with_master
+SELECT * FROM t1 ORDER BY a;
+
+--connection master
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
+
+--source include/rpl_end.inc
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result
new file mode 100644
index 00000000000..a917a6830b0
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result
@@ -0,0 +1,35 @@
+include/master-slave.inc
+[connection master]
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+CREATE TABLE t1 (a UUID);
+connection slave;
+ALTER TABLE t1 MODIFY a BINARY(16);
+connection master;
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+SELECT a FROM t1 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffffffff-ffff-ffff-ffff-fffffffffffe
+ffffffff-ffff-ffff-ffff-ffffffffffff
+connection slave;
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+00000000000000000000000000000000
+00000000000000000000000000000001
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+connection master;
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
+include/rpl_end.inc
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test
new file mode 100644
index 00000000000..df927fafa02
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test
@@ -0,0 +1,33 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+CREATE TABLE t1 (a UUID);
+
+--sync_slave_with_master
+ALTER TABLE t1 MODIFY a BINARY(16);
+
+--connection master
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe');
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+SELECT a FROM t1 ORDER BY a;
+--sync_slave_with_master
+SELECT HEX(a) FROM t1 ORDER BY a;
+
+--connection master
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
+
+--source include/rpl_end.inc
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result
new file mode 100644
index 00000000000..c3825570a5c
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result
@@ -0,0 +1,19 @@
+include/master-slave.inc
+[connection master]
+#
+# MDEV-4958 Adding datatype UUID
+#
+connection master;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('ffffffff-ffff-ffff-ffff-ffffffffffff');
+connection slave;
+SELECT HEX(a), a FROM t1;
+HEX(a) a
+00000000000000000000000000000000 00000000-0000-0000-0000-000000000000
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ffffffff-ffff-ffff-ffff-ffffffffffff
+connection master;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test
new file mode 100644
index 00000000000..7651a0d5e02
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test
@@ -0,0 +1,18 @@
+--source include/master-slave.inc
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+connection master;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('ffffffff-ffff-ffff-ffff-ffffffffffff');
+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_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm
new file mode 100644
index 00000000000..ca934198cf7
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm
Binary files differ
diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm
new file mode 100644
index 00000000000..b3d8e433e9d
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm
Binary files differ
diff --git a/plugin/type_uuid/mysql-test/type_uuid/suite.pm b/plugin/type_uuid/mysql-test/type_uuid/suite.pm
new file mode 100644
index 00000000000..ad21c8688de
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/suite.pm
@@ -0,0 +1,7 @@
+package My::Suite::Type_uuid;
+
+@ISA = qw(My::Suite);
+
+sub is_default { 1 }
+
+bless { };
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result
new file mode 100644
index 00000000000..fc0eaae2627
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result
@@ -0,0 +1,18 @@
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET @old_debug_dbug=@@debug_dbug;
+SET debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 UUID, c02 UUID);
+Warnings:
+Note 1105 build_frm_image: Field data type info length: 12
+Note 1105 DBUG: [0] name='c01' type_info='uuid'
+Note 1105 DBUG: [1] name='c02' type_info='uuid'
+SET debug_dbug=@old_debug_dbug;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c01` uuid DEFAULT NULL,
+ `c02` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test
new file mode 100644
index 00000000000..59300d167c9
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test
@@ -0,0 +1,14 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+SET @old_debug_dbug=@@debug_dbug;
+
+SET debug_dbug="+d,frm_data_type_info";
+CREATE TABLE t1 (c01 UUID, c02 UUID);
+SET debug_dbug=@old_debug_dbug;
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result
new file mode 100644
index 00000000000..ab30c262148
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result
@@ -0,0 +1,3189 @@
+#
+# MDEV-4958 Adding datatype UUID
+#
+#
+# Basic CREATE functionality, defaults, metadata
+#
+CREATE TABLE t1 (a UUID AUTO_INCREMENT);
+ERROR 42000: Incorrect column specifier for column 'a'
+CREATE TABLE t1 (a UUID);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DESCRIBE t1;
+Field Type Null Key Default Extra
+a uuid 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 uuid
+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 uuid
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+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 (type=uuid) 36 36 Y 160 0 8
+a
+00000000-0000-0000-0000-000000000001
+SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def a 254 (type=uuid) 36 36 N 33 0 8
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 UUID DEFAULT 0x00000000000000000000000000000000,
+c2 UUID DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
+c3 UUID DEFAULT '00000000-0000-0000-0000-000000000000',
+c4 UUID DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff',
+c5 UUID DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS UUID)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `c2` uuid DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff',
+ `c3` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `c4` uuid DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff',
+ `c5` uuid DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as uuid)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DESCRIBE t1;
+Field Type Null Key Default Extra
+c1 uuid YES 00000000-0000-0000-0000-000000000000
+c2 uuid YES ffffffff-ffff-ffff-ffff-ffffffffffff
+c3 uuid YES 00000000-0000-0000-0000-000000000000
+c4 uuid YES ffffffff-ffff-ffff-ffff-ffffffffffff
+c5 uuid YES cast(X'ffffffffffffffffffffffffffffffff' as uuid)
+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 '00000000-0000-0000-0000-000000000000'
+IS_NULLABLE YES
+DATA_TYPE uuid
+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 uuid
+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 'ffffffff-ffff-ffff-ffff-ffffffffffff'
+IS_NULLABLE YES
+DATA_TYPE uuid
+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 uuid
+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 '00000000-0000-0000-0000-000000000000'
+IS_NULLABLE YES
+DATA_TYPE uuid
+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 uuid
+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 'ffffffff-ffff-ffff-ffff-ffffffffffff'
+IS_NULLABLE YES
+DATA_TYPE uuid
+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 uuid
+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 uuid)
+IS_NULLABLE YES
+DATA_TYPE uuid
+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 uuid
+COLUMN_KEY
+EXTRA
+PRIVILEGES #
+COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 UUID DEFAULT 0x00);
+ERROR 42000: Invalid default value for 'c1'
+CREATE TABLE t1 (c1 UUID DEFAULT '');
+ERROR 42000: Invalid default value for 'c1'
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect uuid value: 'x' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES (1);
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`a`
+INSERT INTO t1 VALUES (TIME'10:20:30');
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`a`
+INSERT INTO t1 VALUES (0x00);
+ERROR 22007: Incorrect uuid value: '\x00' for column `test`.`t1`.`a` at row 1
+DROP TABLE t1;
+#
+# CAST
+#
+SELECT CAST('garbage' AS UUID);
+CAST('garbage' AS UUID)
+NULL
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT CAST(0x01 AS UUID);
+CAST(0x01 AS UUID)
+NULL
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT CAST(REPEAT(0x00,16) AS UUID);
+CAST(REPEAT(0x00,16) AS UUID)
+00000000-0000-0000-0000-000000000000
+SELECT CAST(REPEAT(0x11,16) AS UUID);
+CAST(REPEAT(0x11,16) AS UUID)
+11111111-1111-1111-1111-111111111111
+CREATE TABLE t1 AS SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CAST('00000000-0000-0000-0000-000000000000' AS UUID)` uuid NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
+# Text and binary formats, comparison operators
+#
+CREATE TABLE t1 (a UUID);
+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
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 ORDER BY a DESC;
+a
+ffff0000-0000-0000-0000-000000000002
+ffff0000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000000
+SELECT HEX(a),a FROM t1 ORDER BY a;
+HEX(a) a
+00000000000000000000000000000000 00000000-0000-0000-0000-000000000000
+00000000000000000000000000000001 00000000-0000-0000-0000-000000000001
+FFFF0000000000000000000000000001 ffff0000-0000-0000-0000-000000000001
+FFFF0000000000000000000000000002 ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000001';
+a
+00000000-0000-0000-0000-000000000001
+SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000001';
+a
+ffff0000-0000-0000-0000-000000000001
+SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000002';
+a
+ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000000;
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a=0x00000000000000000000000000000001;
+a
+00000000-0000-0000-0000-000000000001
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000001;
+a
+ffff0000-0000-0000-0000-000000000001
+SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000002;
+a
+ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a< '00000000-0000-0000-0000-000000000000';
+a
+SELECT * FROM t1 WHERE a<='00000000-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a>='ffff0000-0000-0000-0000-000000000002';
+a
+ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a> 'ffff0000-0000-0000-0000-000000000002';
+a
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000000',
+'ffff0000-0000-0000-0000-000000000001'
+) ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+ffff0000-0000-0000-0000-000000000001
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000000',
+0xffff0000000000000000000000000002
+) ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+ffff0000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a<'garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a<='garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a>='garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a>'garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a<0x01;
+a
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT * FROM t1 WHERE a<=0x01;
+a
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT * FROM t1 WHERE a=0x01;
+a
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT * FROM t1 WHERE a>=0x01;
+a
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT * FROM t1 WHERE a>0x01;
+a
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a='00-000000-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a='00-00-0000-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a='00-00-00-00-0000-0000-0000-000000000000';
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a=0;
+ERROR HY000: Illegal parameter data types uuid and int for operation '='
+SELECT * FROM t1 WHERE a=0.0;
+ERROR HY000: Illegal parameter data types uuid and decimal for operation '='
+SELECT * FROM t1 WHERE a=0e0;
+ERROR HY000: Illegal parameter data types uuid and double for operation '='
+SELECT * FROM t1 WHERE a=TIME'10:20:30';
+ERROR HY000: Illegal parameter data types uuid and time for operation '='
+SELECT * FROM t1 WHERE a IN ('::', 10);
+ERROR HY000: Illegal parameter data types uuid and int for operation 'in'
+DROP TABLE t1;
+#
+# ORDER BY
+#
+CREATE TABLE t1 (a UUID);
+FOR i IN 0..15
+DO
+INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+#
+# Logical ORDER BY
+#
+SELECT * FROM t1 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000001-0000-0000-0000-000000000000
+00000002-0000-0000-0000-000000000000
+00000003-0000-0000-0000-000000000000
+00000004-0000-0000-0000-000000000000
+00000005-0000-0000-0000-000000000000
+00000006-0000-0000-0000-000000000000
+00000007-0000-0000-0000-000000000000
+00000008-0000-0000-0000-000000000000
+00000009-0000-0000-0000-000000000000
+0000000a-0000-0000-0000-000000000000
+0000000b-0000-0000-0000-000000000000
+0000000c-0000-0000-0000-000000000000
+0000000d-0000-0000-0000-000000000000
+0000000e-0000-0000-0000-000000000000
+0000000f-0000-0000-0000-000000000000
+00000100-0000-0000-0000-000000000000
+00000200-0000-0000-0000-000000000000
+00000300-0000-0000-0000-000000000000
+00000400-0000-0000-0000-000000000000
+00000500-0000-0000-0000-000000000000
+00000600-0000-0000-0000-000000000000
+00000700-0000-0000-0000-000000000000
+00000800-0000-0000-0000-000000000000
+00000900-0000-0000-0000-000000000000
+00000a00-0000-0000-0000-000000000000
+00000b00-0000-0000-0000-000000000000
+00000c00-0000-0000-0000-000000000000
+00000d00-0000-0000-0000-000000000000
+00000e00-0000-0000-0000-000000000000
+00000f00-0000-0000-0000-000000000000
+00010000-0000-0000-0000-000000000000
+00020000-0000-0000-0000-000000000000
+00030000-0000-0000-0000-000000000000
+00040000-0000-0000-0000-000000000000
+00050000-0000-0000-0000-000000000000
+00060000-0000-0000-0000-000000000000
+00070000-0000-0000-0000-000000000000
+00080000-0000-0000-0000-000000000000
+00090000-0000-0000-0000-000000000000
+000a0000-0000-0000-0000-000000000000
+000b0000-0000-0000-0000-000000000000
+000c0000-0000-0000-0000-000000000000
+000d0000-0000-0000-0000-000000000000
+000e0000-0000-0000-0000-000000000000
+000f0000-0000-0000-0000-000000000000
+01000000-0000-0000-0000-000000000000
+02000000-0000-0000-0000-000000000000
+03000000-0000-0000-0000-000000000000
+04000000-0000-0000-0000-000000000000
+05000000-0000-0000-0000-000000000000
+06000000-0000-0000-0000-000000000000
+07000000-0000-0000-0000-000000000000
+08000000-0000-0000-0000-000000000000
+09000000-0000-0000-0000-000000000000
+0a000000-0000-0000-0000-000000000000
+0b000000-0000-0000-0000-000000000000
+0c000000-0000-0000-0000-000000000000
+0d000000-0000-0000-0000-000000000000
+0e000000-0000-0000-0000-000000000000
+0f000000-0000-0000-0000-000000000000
+00000000-0001-0000-0000-000000000000
+00000000-0002-0000-0000-000000000000
+00000000-0003-0000-0000-000000000000
+00000000-0004-0000-0000-000000000000
+00000000-0005-0000-0000-000000000000
+00000000-0006-0000-0000-000000000000
+00000000-0007-0000-0000-000000000000
+00000000-0008-0000-0000-000000000000
+00000000-0009-0000-0000-000000000000
+00000000-000a-0000-0000-000000000000
+00000000-000b-0000-0000-000000000000
+00000000-000c-0000-0000-000000000000
+00000000-000d-0000-0000-000000000000
+00000000-000e-0000-0000-000000000000
+00000000-000f-0000-0000-000000000000
+00000000-0100-0000-0000-000000000000
+00000000-0200-0000-0000-000000000000
+00000000-0300-0000-0000-000000000000
+00000000-0400-0000-0000-000000000000
+00000000-0500-0000-0000-000000000000
+00000000-0600-0000-0000-000000000000
+00000000-0700-0000-0000-000000000000
+00000000-0800-0000-0000-000000000000
+00000000-0900-0000-0000-000000000000
+00000000-0a00-0000-0000-000000000000
+00000000-0b00-0000-0000-000000000000
+00000000-0c00-0000-0000-000000000000
+00000000-0d00-0000-0000-000000000000
+00000000-0e00-0000-0000-000000000000
+00000000-0f00-0000-0000-000000000000
+00000000-0000-0001-0000-000000000000
+00000000-0000-0002-0000-000000000000
+00000000-0000-0003-0000-000000000000
+00000000-0000-0004-0000-000000000000
+00000000-0000-0005-0000-000000000000
+00000000-0000-0006-0000-000000000000
+00000000-0000-0007-0000-000000000000
+00000000-0000-0008-0000-000000000000
+00000000-0000-0009-0000-000000000000
+00000000-0000-000a-0000-000000000000
+00000000-0000-000b-0000-000000000000
+00000000-0000-000c-0000-000000000000
+00000000-0000-000d-0000-000000000000
+00000000-0000-000e-0000-000000000000
+00000000-0000-000f-0000-000000000000
+00000000-0000-0100-0000-000000000000
+00000000-0000-0200-0000-000000000000
+00000000-0000-0300-0000-000000000000
+00000000-0000-0400-0000-000000000000
+00000000-0000-0500-0000-000000000000
+00000000-0000-0600-0000-000000000000
+00000000-0000-0700-0000-000000000000
+00000000-0000-0800-0000-000000000000
+00000000-0000-0900-0000-000000000000
+00000000-0000-0a00-0000-000000000000
+00000000-0000-0b00-0000-000000000000
+00000000-0000-0c00-0000-000000000000
+00000000-0000-0d00-0000-000000000000
+00000000-0000-0e00-0000-000000000000
+00000000-0000-0f00-0000-000000000000
+00000000-0000-0000-0001-000000000000
+00000000-0000-0000-0002-000000000000
+00000000-0000-0000-0003-000000000000
+00000000-0000-0000-0004-000000000000
+00000000-0000-0000-0005-000000000000
+00000000-0000-0000-0006-000000000000
+00000000-0000-0000-0007-000000000000
+00000000-0000-0000-0008-000000000000
+00000000-0000-0000-0009-000000000000
+00000000-0000-0000-000a-000000000000
+00000000-0000-0000-000b-000000000000
+00000000-0000-0000-000c-000000000000
+00000000-0000-0000-000d-000000000000
+00000000-0000-0000-000e-000000000000
+00000000-0000-0000-000f-000000000000
+00000000-0000-0000-0100-000000000000
+00000000-0000-0000-0200-000000000000
+00000000-0000-0000-0300-000000000000
+00000000-0000-0000-0400-000000000000
+00000000-0000-0000-0500-000000000000
+00000000-0000-0000-0600-000000000000
+00000000-0000-0000-0700-000000000000
+00000000-0000-0000-0800-000000000000
+00000000-0000-0000-0900-000000000000
+00000000-0000-0000-0a00-000000000000
+00000000-0000-0000-0b00-000000000000
+00000000-0000-0000-0c00-000000000000
+00000000-0000-0000-0d00-000000000000
+00000000-0000-0000-0e00-000000000000
+00000000-0000-0000-0f00-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000005
+00000000-0000-0000-0000-000000000006
+00000000-0000-0000-0000-000000000007
+00000000-0000-0000-0000-000000000008
+00000000-0000-0000-0000-000000000009
+00000000-0000-0000-0000-00000000000a
+00000000-0000-0000-0000-00000000000b
+00000000-0000-0000-0000-00000000000c
+00000000-0000-0000-0000-00000000000d
+00000000-0000-0000-0000-00000000000e
+00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000100
+00000000-0000-0000-0000-000000000200
+00000000-0000-0000-0000-000000000300
+00000000-0000-0000-0000-000000000400
+00000000-0000-0000-0000-000000000500
+00000000-0000-0000-0000-000000000600
+00000000-0000-0000-0000-000000000700
+00000000-0000-0000-0000-000000000800
+00000000-0000-0000-0000-000000000900
+00000000-0000-0000-0000-000000000a00
+00000000-0000-0000-0000-000000000b00
+00000000-0000-0000-0000-000000000c00
+00000000-0000-0000-0000-000000000d00
+00000000-0000-0000-0000-000000000e00
+00000000-0000-0000-0000-000000000f00
+00000000-0000-0000-0000-000000010000
+00000000-0000-0000-0000-000000020000
+00000000-0000-0000-0000-000000030000
+00000000-0000-0000-0000-000000040000
+00000000-0000-0000-0000-000000050000
+00000000-0000-0000-0000-000000060000
+00000000-0000-0000-0000-000000070000
+00000000-0000-0000-0000-000000080000
+00000000-0000-0000-0000-000000090000
+00000000-0000-0000-0000-0000000a0000
+00000000-0000-0000-0000-0000000b0000
+00000000-0000-0000-0000-0000000c0000
+00000000-0000-0000-0000-0000000d0000
+00000000-0000-0000-0000-0000000e0000
+00000000-0000-0000-0000-0000000f0000
+00000000-0000-0000-0000-000001000000
+00000000-0000-0000-0000-000002000000
+00000000-0000-0000-0000-000003000000
+00000000-0000-0000-0000-000004000000
+00000000-0000-0000-0000-000005000000
+00000000-0000-0000-0000-000006000000
+00000000-0000-0000-0000-000007000000
+00000000-0000-0000-0000-000008000000
+00000000-0000-0000-0000-000009000000
+00000000-0000-0000-0000-00000a000000
+00000000-0000-0000-0000-00000b000000
+00000000-0000-0000-0000-00000c000000
+00000000-0000-0000-0000-00000d000000
+00000000-0000-0000-0000-00000e000000
+00000000-0000-0000-0000-00000f000000
+00000000-0000-0000-0000-000100000000
+00000000-0000-0000-0000-000200000000
+00000000-0000-0000-0000-000300000000
+00000000-0000-0000-0000-000400000000
+00000000-0000-0000-0000-000500000000
+00000000-0000-0000-0000-000600000000
+00000000-0000-0000-0000-000700000000
+00000000-0000-0000-0000-000800000000
+00000000-0000-0000-0000-000900000000
+00000000-0000-0000-0000-000a00000000
+00000000-0000-0000-0000-000b00000000
+00000000-0000-0000-0000-000c00000000
+00000000-0000-0000-0000-000d00000000
+00000000-0000-0000-0000-000e00000000
+00000000-0000-0000-0000-000f00000000
+00000000-0000-0000-0000-010000000000
+00000000-0000-0000-0000-020000000000
+00000000-0000-0000-0000-030000000000
+00000000-0000-0000-0000-040000000000
+00000000-0000-0000-0000-050000000000
+00000000-0000-0000-0000-060000000000
+00000000-0000-0000-0000-070000000000
+00000000-0000-0000-0000-080000000000
+00000000-0000-0000-0000-090000000000
+00000000-0000-0000-0000-0a0000000000
+00000000-0000-0000-0000-0b0000000000
+00000000-0000-0000-0000-0c0000000000
+00000000-0000-0000-0000-0d0000000000
+00000000-0000-0000-0000-0e0000000000
+00000000-0000-0000-0000-0f0000000000
+SELECT COALESCE(NULL, a) FROM t1 ORDER BY a;
+COALESCE(NULL, a)
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000001-0000-0000-0000-000000000000
+00000002-0000-0000-0000-000000000000
+00000003-0000-0000-0000-000000000000
+00000004-0000-0000-0000-000000000000
+00000005-0000-0000-0000-000000000000
+00000006-0000-0000-0000-000000000000
+00000007-0000-0000-0000-000000000000
+00000008-0000-0000-0000-000000000000
+00000009-0000-0000-0000-000000000000
+0000000a-0000-0000-0000-000000000000
+0000000b-0000-0000-0000-000000000000
+0000000c-0000-0000-0000-000000000000
+0000000d-0000-0000-0000-000000000000
+0000000e-0000-0000-0000-000000000000
+0000000f-0000-0000-0000-000000000000
+00000100-0000-0000-0000-000000000000
+00000200-0000-0000-0000-000000000000
+00000300-0000-0000-0000-000000000000
+00000400-0000-0000-0000-000000000000
+00000500-0000-0000-0000-000000000000
+00000600-0000-0000-0000-000000000000
+00000700-0000-0000-0000-000000000000
+00000800-0000-0000-0000-000000000000
+00000900-0000-0000-0000-000000000000
+00000a00-0000-0000-0000-000000000000
+00000b00-0000-0000-0000-000000000000
+00000c00-0000-0000-0000-000000000000
+00000d00-0000-0000-0000-000000000000
+00000e00-0000-0000-0000-000000000000
+00000f00-0000-0000-0000-000000000000
+00010000-0000-0000-0000-000000000000
+00020000-0000-0000-0000-000000000000
+00030000-0000-0000-0000-000000000000
+00040000-0000-0000-0000-000000000000
+00050000-0000-0000-0000-000000000000
+00060000-0000-0000-0000-000000000000
+00070000-0000-0000-0000-000000000000
+00080000-0000-0000-0000-000000000000
+00090000-0000-0000-0000-000000000000
+000a0000-0000-0000-0000-000000000000
+000b0000-0000-0000-0000-000000000000
+000c0000-0000-0000-0000-000000000000
+000d0000-0000-0000-0000-000000000000
+000e0000-0000-0000-0000-000000000000
+000f0000-0000-0000-0000-000000000000
+01000000-0000-0000-0000-000000000000
+02000000-0000-0000-0000-000000000000
+03000000-0000-0000-0000-000000000000
+04000000-0000-0000-0000-000000000000
+05000000-0000-0000-0000-000000000000
+06000000-0000-0000-0000-000000000000
+07000000-0000-0000-0000-000000000000
+08000000-0000-0000-0000-000000000000
+09000000-0000-0000-0000-000000000000
+0a000000-0000-0000-0000-000000000000
+0b000000-0000-0000-0000-000000000000
+0c000000-0000-0000-0000-000000000000
+0d000000-0000-0000-0000-000000000000
+0e000000-0000-0000-0000-000000000000
+0f000000-0000-0000-0000-000000000000
+00000000-0001-0000-0000-000000000000
+00000000-0002-0000-0000-000000000000
+00000000-0003-0000-0000-000000000000
+00000000-0004-0000-0000-000000000000
+00000000-0005-0000-0000-000000000000
+00000000-0006-0000-0000-000000000000
+00000000-0007-0000-0000-000000000000
+00000000-0008-0000-0000-000000000000
+00000000-0009-0000-0000-000000000000
+00000000-000a-0000-0000-000000000000
+00000000-000b-0000-0000-000000000000
+00000000-000c-0000-0000-000000000000
+00000000-000d-0000-0000-000000000000
+00000000-000e-0000-0000-000000000000
+00000000-000f-0000-0000-000000000000
+00000000-0100-0000-0000-000000000000
+00000000-0200-0000-0000-000000000000
+00000000-0300-0000-0000-000000000000
+00000000-0400-0000-0000-000000000000
+00000000-0500-0000-0000-000000000000
+00000000-0600-0000-0000-000000000000
+00000000-0700-0000-0000-000000000000
+00000000-0800-0000-0000-000000000000
+00000000-0900-0000-0000-000000000000
+00000000-0a00-0000-0000-000000000000
+00000000-0b00-0000-0000-000000000000
+00000000-0c00-0000-0000-000000000000
+00000000-0d00-0000-0000-000000000000
+00000000-0e00-0000-0000-000000000000
+00000000-0f00-0000-0000-000000000000
+00000000-0000-0001-0000-000000000000
+00000000-0000-0002-0000-000000000000
+00000000-0000-0003-0000-000000000000
+00000000-0000-0004-0000-000000000000
+00000000-0000-0005-0000-000000000000
+00000000-0000-0006-0000-000000000000
+00000000-0000-0007-0000-000000000000
+00000000-0000-0008-0000-000000000000
+00000000-0000-0009-0000-000000000000
+00000000-0000-000a-0000-000000000000
+00000000-0000-000b-0000-000000000000
+00000000-0000-000c-0000-000000000000
+00000000-0000-000d-0000-000000000000
+00000000-0000-000e-0000-000000000000
+00000000-0000-000f-0000-000000000000
+00000000-0000-0100-0000-000000000000
+00000000-0000-0200-0000-000000000000
+00000000-0000-0300-0000-000000000000
+00000000-0000-0400-0000-000000000000
+00000000-0000-0500-0000-000000000000
+00000000-0000-0600-0000-000000000000
+00000000-0000-0700-0000-000000000000
+00000000-0000-0800-0000-000000000000
+00000000-0000-0900-0000-000000000000
+00000000-0000-0a00-0000-000000000000
+00000000-0000-0b00-0000-000000000000
+00000000-0000-0c00-0000-000000000000
+00000000-0000-0d00-0000-000000000000
+00000000-0000-0e00-0000-000000000000
+00000000-0000-0f00-0000-000000000000
+00000000-0000-0000-0001-000000000000
+00000000-0000-0000-0002-000000000000
+00000000-0000-0000-0003-000000000000
+00000000-0000-0000-0004-000000000000
+00000000-0000-0000-0005-000000000000
+00000000-0000-0000-0006-000000000000
+00000000-0000-0000-0007-000000000000
+00000000-0000-0000-0008-000000000000
+00000000-0000-0000-0009-000000000000
+00000000-0000-0000-000a-000000000000
+00000000-0000-0000-000b-000000000000
+00000000-0000-0000-000c-000000000000
+00000000-0000-0000-000d-000000000000
+00000000-0000-0000-000e-000000000000
+00000000-0000-0000-000f-000000000000
+00000000-0000-0000-0100-000000000000
+00000000-0000-0000-0200-000000000000
+00000000-0000-0000-0300-000000000000
+00000000-0000-0000-0400-000000000000
+00000000-0000-0000-0500-000000000000
+00000000-0000-0000-0600-000000000000
+00000000-0000-0000-0700-000000000000
+00000000-0000-0000-0800-000000000000
+00000000-0000-0000-0900-000000000000
+00000000-0000-0000-0a00-000000000000
+00000000-0000-0000-0b00-000000000000
+00000000-0000-0000-0c00-000000000000
+00000000-0000-0000-0d00-000000000000
+00000000-0000-0000-0e00-000000000000
+00000000-0000-0000-0f00-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000005
+00000000-0000-0000-0000-000000000006
+00000000-0000-0000-0000-000000000007
+00000000-0000-0000-0000-000000000008
+00000000-0000-0000-0000-000000000009
+00000000-0000-0000-0000-00000000000a
+00000000-0000-0000-0000-00000000000b
+00000000-0000-0000-0000-00000000000c
+00000000-0000-0000-0000-00000000000d
+00000000-0000-0000-0000-00000000000e
+00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000100
+00000000-0000-0000-0000-000000000200
+00000000-0000-0000-0000-000000000300
+00000000-0000-0000-0000-000000000400
+00000000-0000-0000-0000-000000000500
+00000000-0000-0000-0000-000000000600
+00000000-0000-0000-0000-000000000700
+00000000-0000-0000-0000-000000000800
+00000000-0000-0000-0000-000000000900
+00000000-0000-0000-0000-000000000a00
+00000000-0000-0000-0000-000000000b00
+00000000-0000-0000-0000-000000000c00
+00000000-0000-0000-0000-000000000d00
+00000000-0000-0000-0000-000000000e00
+00000000-0000-0000-0000-000000000f00
+00000000-0000-0000-0000-000000010000
+00000000-0000-0000-0000-000000020000
+00000000-0000-0000-0000-000000030000
+00000000-0000-0000-0000-000000040000
+00000000-0000-0000-0000-000000050000
+00000000-0000-0000-0000-000000060000
+00000000-0000-0000-0000-000000070000
+00000000-0000-0000-0000-000000080000
+00000000-0000-0000-0000-000000090000
+00000000-0000-0000-0000-0000000a0000
+00000000-0000-0000-0000-0000000b0000
+00000000-0000-0000-0000-0000000c0000
+00000000-0000-0000-0000-0000000d0000
+00000000-0000-0000-0000-0000000e0000
+00000000-0000-0000-0000-0000000f0000
+00000000-0000-0000-0000-000001000000
+00000000-0000-0000-0000-000002000000
+00000000-0000-0000-0000-000003000000
+00000000-0000-0000-0000-000004000000
+00000000-0000-0000-0000-000005000000
+00000000-0000-0000-0000-000006000000
+00000000-0000-0000-0000-000007000000
+00000000-0000-0000-0000-000008000000
+00000000-0000-0000-0000-000009000000
+00000000-0000-0000-0000-00000a000000
+00000000-0000-0000-0000-00000b000000
+00000000-0000-0000-0000-00000c000000
+00000000-0000-0000-0000-00000d000000
+00000000-0000-0000-0000-00000e000000
+00000000-0000-0000-0000-00000f000000
+00000000-0000-0000-0000-000100000000
+00000000-0000-0000-0000-000200000000
+00000000-0000-0000-0000-000300000000
+00000000-0000-0000-0000-000400000000
+00000000-0000-0000-0000-000500000000
+00000000-0000-0000-0000-000600000000
+00000000-0000-0000-0000-000700000000
+00000000-0000-0000-0000-000800000000
+00000000-0000-0000-0000-000900000000
+00000000-0000-0000-0000-000a00000000
+00000000-0000-0000-0000-000b00000000
+00000000-0000-0000-0000-000c00000000
+00000000-0000-0000-0000-000d00000000
+00000000-0000-0000-0000-000e00000000
+00000000-0000-0000-0000-000f00000000
+00000000-0000-0000-0000-010000000000
+00000000-0000-0000-0000-020000000000
+00000000-0000-0000-0000-030000000000
+00000000-0000-0000-0000-040000000000
+00000000-0000-0000-0000-050000000000
+00000000-0000-0000-0000-060000000000
+00000000-0000-0000-0000-070000000000
+00000000-0000-0000-0000-080000000000
+00000000-0000-0000-0000-090000000000
+00000000-0000-0000-0000-0a0000000000
+00000000-0000-0000-0000-0b0000000000
+00000000-0000-0000-0000-0c0000000000
+00000000-0000-0000-0000-0d0000000000
+00000000-0000-0000-0000-0e0000000000
+00000000-0000-0000-0000-0f0000000000
+#
+# Lexicographical ORDER BY
+#
+SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16));
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000005
+00000000-0000-0000-0000-000000000006
+00000000-0000-0000-0000-000000000007
+00000000-0000-0000-0000-000000000008
+00000000-0000-0000-0000-000000000009
+00000000-0000-0000-0000-00000000000a
+00000000-0000-0000-0000-00000000000b
+00000000-0000-0000-0000-00000000000c
+00000000-0000-0000-0000-00000000000d
+00000000-0000-0000-0000-00000000000e
+00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000100
+00000000-0000-0000-0000-000000000200
+00000000-0000-0000-0000-000000000300
+00000000-0000-0000-0000-000000000400
+00000000-0000-0000-0000-000000000500
+00000000-0000-0000-0000-000000000600
+00000000-0000-0000-0000-000000000700
+00000000-0000-0000-0000-000000000800
+00000000-0000-0000-0000-000000000900
+00000000-0000-0000-0000-000000000a00
+00000000-0000-0000-0000-000000000b00
+00000000-0000-0000-0000-000000000c00
+00000000-0000-0000-0000-000000000d00
+00000000-0000-0000-0000-000000000e00
+00000000-0000-0000-0000-000000000f00
+00000000-0000-0000-0000-000000010000
+00000000-0000-0000-0000-000000020000
+00000000-0000-0000-0000-000000030000
+00000000-0000-0000-0000-000000040000
+00000000-0000-0000-0000-000000050000
+00000000-0000-0000-0000-000000060000
+00000000-0000-0000-0000-000000070000
+00000000-0000-0000-0000-000000080000
+00000000-0000-0000-0000-000000090000
+00000000-0000-0000-0000-0000000a0000
+00000000-0000-0000-0000-0000000b0000
+00000000-0000-0000-0000-0000000c0000
+00000000-0000-0000-0000-0000000d0000
+00000000-0000-0000-0000-0000000e0000
+00000000-0000-0000-0000-0000000f0000
+00000000-0000-0000-0000-000001000000
+00000000-0000-0000-0000-000002000000
+00000000-0000-0000-0000-000003000000
+00000000-0000-0000-0000-000004000000
+00000000-0000-0000-0000-000005000000
+00000000-0000-0000-0000-000006000000
+00000000-0000-0000-0000-000007000000
+00000000-0000-0000-0000-000008000000
+00000000-0000-0000-0000-000009000000
+00000000-0000-0000-0000-00000a000000
+00000000-0000-0000-0000-00000b000000
+00000000-0000-0000-0000-00000c000000
+00000000-0000-0000-0000-00000d000000
+00000000-0000-0000-0000-00000e000000
+00000000-0000-0000-0000-00000f000000
+00000000-0000-0000-0000-000100000000
+00000000-0000-0000-0000-000200000000
+00000000-0000-0000-0000-000300000000
+00000000-0000-0000-0000-000400000000
+00000000-0000-0000-0000-000500000000
+00000000-0000-0000-0000-000600000000
+00000000-0000-0000-0000-000700000000
+00000000-0000-0000-0000-000800000000
+00000000-0000-0000-0000-000900000000
+00000000-0000-0000-0000-000a00000000
+00000000-0000-0000-0000-000b00000000
+00000000-0000-0000-0000-000c00000000
+00000000-0000-0000-0000-000d00000000
+00000000-0000-0000-0000-000e00000000
+00000000-0000-0000-0000-000f00000000
+00000000-0000-0000-0000-010000000000
+00000000-0000-0000-0000-020000000000
+00000000-0000-0000-0000-030000000000
+00000000-0000-0000-0000-040000000000
+00000000-0000-0000-0000-050000000000
+00000000-0000-0000-0000-060000000000
+00000000-0000-0000-0000-070000000000
+00000000-0000-0000-0000-080000000000
+00000000-0000-0000-0000-090000000000
+00000000-0000-0000-0000-0a0000000000
+00000000-0000-0000-0000-0b0000000000
+00000000-0000-0000-0000-0c0000000000
+00000000-0000-0000-0000-0d0000000000
+00000000-0000-0000-0000-0e0000000000
+00000000-0000-0000-0000-0f0000000000
+00000000-0000-0000-0001-000000000000
+00000000-0000-0000-0002-000000000000
+00000000-0000-0000-0003-000000000000
+00000000-0000-0000-0004-000000000000
+00000000-0000-0000-0005-000000000000
+00000000-0000-0000-0006-000000000000
+00000000-0000-0000-0007-000000000000
+00000000-0000-0000-0008-000000000000
+00000000-0000-0000-0009-000000000000
+00000000-0000-0000-000a-000000000000
+00000000-0000-0000-000b-000000000000
+00000000-0000-0000-000c-000000000000
+00000000-0000-0000-000d-000000000000
+00000000-0000-0000-000e-000000000000
+00000000-0000-0000-000f-000000000000
+00000000-0000-0000-0100-000000000000
+00000000-0000-0000-0200-000000000000
+00000000-0000-0000-0300-000000000000
+00000000-0000-0000-0400-000000000000
+00000000-0000-0000-0500-000000000000
+00000000-0000-0000-0600-000000000000
+00000000-0000-0000-0700-000000000000
+00000000-0000-0000-0800-000000000000
+00000000-0000-0000-0900-000000000000
+00000000-0000-0000-0a00-000000000000
+00000000-0000-0000-0b00-000000000000
+00000000-0000-0000-0c00-000000000000
+00000000-0000-0000-0d00-000000000000
+00000000-0000-0000-0e00-000000000000
+00000000-0000-0000-0f00-000000000000
+00000000-0000-0001-0000-000000000000
+00000000-0000-0002-0000-000000000000
+00000000-0000-0003-0000-000000000000
+00000000-0000-0004-0000-000000000000
+00000000-0000-0005-0000-000000000000
+00000000-0000-0006-0000-000000000000
+00000000-0000-0007-0000-000000000000
+00000000-0000-0008-0000-000000000000
+00000000-0000-0009-0000-000000000000
+00000000-0000-000a-0000-000000000000
+00000000-0000-000b-0000-000000000000
+00000000-0000-000c-0000-000000000000
+00000000-0000-000d-0000-000000000000
+00000000-0000-000e-0000-000000000000
+00000000-0000-000f-0000-000000000000
+00000000-0000-0100-0000-000000000000
+00000000-0000-0200-0000-000000000000
+00000000-0000-0300-0000-000000000000
+00000000-0000-0400-0000-000000000000
+00000000-0000-0500-0000-000000000000
+00000000-0000-0600-0000-000000000000
+00000000-0000-0700-0000-000000000000
+00000000-0000-0800-0000-000000000000
+00000000-0000-0900-0000-000000000000
+00000000-0000-0a00-0000-000000000000
+00000000-0000-0b00-0000-000000000000
+00000000-0000-0c00-0000-000000000000
+00000000-0000-0d00-0000-000000000000
+00000000-0000-0e00-0000-000000000000
+00000000-0000-0f00-0000-000000000000
+00000000-0001-0000-0000-000000000000
+00000000-0002-0000-0000-000000000000
+00000000-0003-0000-0000-000000000000
+00000000-0004-0000-0000-000000000000
+00000000-0005-0000-0000-000000000000
+00000000-0006-0000-0000-000000000000
+00000000-0007-0000-0000-000000000000
+00000000-0008-0000-0000-000000000000
+00000000-0009-0000-0000-000000000000
+00000000-000a-0000-0000-000000000000
+00000000-000b-0000-0000-000000000000
+00000000-000c-0000-0000-000000000000
+00000000-000d-0000-0000-000000000000
+00000000-000e-0000-0000-000000000000
+00000000-000f-0000-0000-000000000000
+00000000-0100-0000-0000-000000000000
+00000000-0200-0000-0000-000000000000
+00000000-0300-0000-0000-000000000000
+00000000-0400-0000-0000-000000000000
+00000000-0500-0000-0000-000000000000
+00000000-0600-0000-0000-000000000000
+00000000-0700-0000-0000-000000000000
+00000000-0800-0000-0000-000000000000
+00000000-0900-0000-0000-000000000000
+00000000-0a00-0000-0000-000000000000
+00000000-0b00-0000-0000-000000000000
+00000000-0c00-0000-0000-000000000000
+00000000-0d00-0000-0000-000000000000
+00000000-0e00-0000-0000-000000000000
+00000000-0f00-0000-0000-000000000000
+00000001-0000-0000-0000-000000000000
+00000002-0000-0000-0000-000000000000
+00000003-0000-0000-0000-000000000000
+00000004-0000-0000-0000-000000000000
+00000005-0000-0000-0000-000000000000
+00000006-0000-0000-0000-000000000000
+00000007-0000-0000-0000-000000000000
+00000008-0000-0000-0000-000000000000
+00000009-0000-0000-0000-000000000000
+0000000a-0000-0000-0000-000000000000
+0000000b-0000-0000-0000-000000000000
+0000000c-0000-0000-0000-000000000000
+0000000d-0000-0000-0000-000000000000
+0000000e-0000-0000-0000-000000000000
+0000000f-0000-0000-0000-000000000000
+00000100-0000-0000-0000-000000000000
+00000200-0000-0000-0000-000000000000
+00000300-0000-0000-0000-000000000000
+00000400-0000-0000-0000-000000000000
+00000500-0000-0000-0000-000000000000
+00000600-0000-0000-0000-000000000000
+00000700-0000-0000-0000-000000000000
+00000800-0000-0000-0000-000000000000
+00000900-0000-0000-0000-000000000000
+00000a00-0000-0000-0000-000000000000
+00000b00-0000-0000-0000-000000000000
+00000c00-0000-0000-0000-000000000000
+00000d00-0000-0000-0000-000000000000
+00000e00-0000-0000-0000-000000000000
+00000f00-0000-0000-0000-000000000000
+00010000-0000-0000-0000-000000000000
+00020000-0000-0000-0000-000000000000
+00030000-0000-0000-0000-000000000000
+00040000-0000-0000-0000-000000000000
+00050000-0000-0000-0000-000000000000
+00060000-0000-0000-0000-000000000000
+00070000-0000-0000-0000-000000000000
+00080000-0000-0000-0000-000000000000
+00090000-0000-0000-0000-000000000000
+000a0000-0000-0000-0000-000000000000
+000b0000-0000-0000-0000-000000000000
+000c0000-0000-0000-0000-000000000000
+000d0000-0000-0000-0000-000000000000
+000e0000-0000-0000-0000-000000000000
+000f0000-0000-0000-0000-000000000000
+01000000-0000-0000-0000-000000000000
+02000000-0000-0000-0000-000000000000
+03000000-0000-0000-0000-000000000000
+04000000-0000-0000-0000-000000000000
+05000000-0000-0000-0000-000000000000
+06000000-0000-0000-0000-000000000000
+07000000-0000-0000-0000-000000000000
+08000000-0000-0000-0000-000000000000
+09000000-0000-0000-0000-000000000000
+0a000000-0000-0000-0000-000000000000
+0b000000-0000-0000-0000-000000000000
+0c000000-0000-0000-0000-000000000000
+0d000000-0000-0000-0000-000000000000
+0e000000-0000-0000-0000-000000000000
+0f000000-0000-0000-0000-000000000000
+SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16));
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000005
+00000000-0000-0000-0000-000000000006
+00000000-0000-0000-0000-000000000007
+00000000-0000-0000-0000-000000000008
+00000000-0000-0000-0000-000000000009
+00000000-0000-0000-0000-00000000000a
+00000000-0000-0000-0000-00000000000b
+00000000-0000-0000-0000-00000000000c
+00000000-0000-0000-0000-00000000000d
+00000000-0000-0000-0000-00000000000e
+00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000100
+00000000-0000-0000-0000-000000000200
+00000000-0000-0000-0000-000000000300
+00000000-0000-0000-0000-000000000400
+00000000-0000-0000-0000-000000000500
+00000000-0000-0000-0000-000000000600
+00000000-0000-0000-0000-000000000700
+00000000-0000-0000-0000-000000000800
+00000000-0000-0000-0000-000000000900
+00000000-0000-0000-0000-000000000a00
+00000000-0000-0000-0000-000000000b00
+00000000-0000-0000-0000-000000000c00
+00000000-0000-0000-0000-000000000d00
+00000000-0000-0000-0000-000000000e00
+00000000-0000-0000-0000-000000000f00
+00000000-0000-0000-0000-000000010000
+00000000-0000-0000-0000-000000020000
+00000000-0000-0000-0000-000000030000
+00000000-0000-0000-0000-000000040000
+00000000-0000-0000-0000-000000050000
+00000000-0000-0000-0000-000000060000
+00000000-0000-0000-0000-000000070000
+00000000-0000-0000-0000-000000080000
+00000000-0000-0000-0000-000000090000
+00000000-0000-0000-0000-0000000a0000
+00000000-0000-0000-0000-0000000b0000
+00000000-0000-0000-0000-0000000c0000
+00000000-0000-0000-0000-0000000d0000
+00000000-0000-0000-0000-0000000e0000
+00000000-0000-0000-0000-0000000f0000
+00000000-0000-0000-0000-000001000000
+00000000-0000-0000-0000-000002000000
+00000000-0000-0000-0000-000003000000
+00000000-0000-0000-0000-000004000000
+00000000-0000-0000-0000-000005000000
+00000000-0000-0000-0000-000006000000
+00000000-0000-0000-0000-000007000000
+00000000-0000-0000-0000-000008000000
+00000000-0000-0000-0000-000009000000
+00000000-0000-0000-0000-00000a000000
+00000000-0000-0000-0000-00000b000000
+00000000-0000-0000-0000-00000c000000
+00000000-0000-0000-0000-00000d000000
+00000000-0000-0000-0000-00000e000000
+00000000-0000-0000-0000-00000f000000
+00000000-0000-0000-0000-000100000000
+00000000-0000-0000-0000-000200000000
+00000000-0000-0000-0000-000300000000
+00000000-0000-0000-0000-000400000000
+00000000-0000-0000-0000-000500000000
+00000000-0000-0000-0000-000600000000
+00000000-0000-0000-0000-000700000000
+00000000-0000-0000-0000-000800000000
+00000000-0000-0000-0000-000900000000
+00000000-0000-0000-0000-000a00000000
+00000000-0000-0000-0000-000b00000000
+00000000-0000-0000-0000-000c00000000
+00000000-0000-0000-0000-000d00000000
+00000000-0000-0000-0000-000e00000000
+00000000-0000-0000-0000-000f00000000
+00000000-0000-0000-0000-010000000000
+00000000-0000-0000-0000-020000000000
+00000000-0000-0000-0000-030000000000
+00000000-0000-0000-0000-040000000000
+00000000-0000-0000-0000-050000000000
+00000000-0000-0000-0000-060000000000
+00000000-0000-0000-0000-070000000000
+00000000-0000-0000-0000-080000000000
+00000000-0000-0000-0000-090000000000
+00000000-0000-0000-0000-0a0000000000
+00000000-0000-0000-0000-0b0000000000
+00000000-0000-0000-0000-0c0000000000
+00000000-0000-0000-0000-0d0000000000
+00000000-0000-0000-0000-0e0000000000
+00000000-0000-0000-0000-0f0000000000
+00000000-0000-0000-0001-000000000000
+00000000-0000-0000-0002-000000000000
+00000000-0000-0000-0003-000000000000
+00000000-0000-0000-0004-000000000000
+00000000-0000-0000-0005-000000000000
+00000000-0000-0000-0006-000000000000
+00000000-0000-0000-0007-000000000000
+00000000-0000-0000-0008-000000000000
+00000000-0000-0000-0009-000000000000
+00000000-0000-0000-000a-000000000000
+00000000-0000-0000-000b-000000000000
+00000000-0000-0000-000c-000000000000
+00000000-0000-0000-000d-000000000000
+00000000-0000-0000-000e-000000000000
+00000000-0000-0000-000f-000000000000
+00000000-0000-0000-0100-000000000000
+00000000-0000-0000-0200-000000000000
+00000000-0000-0000-0300-000000000000
+00000000-0000-0000-0400-000000000000
+00000000-0000-0000-0500-000000000000
+00000000-0000-0000-0600-000000000000
+00000000-0000-0000-0700-000000000000
+00000000-0000-0000-0800-000000000000
+00000000-0000-0000-0900-000000000000
+00000000-0000-0000-0a00-000000000000
+00000000-0000-0000-0b00-000000000000
+00000000-0000-0000-0c00-000000000000
+00000000-0000-0000-0d00-000000000000
+00000000-0000-0000-0e00-000000000000
+00000000-0000-0000-0f00-000000000000
+00000000-0000-0001-0000-000000000000
+00000000-0000-0002-0000-000000000000
+00000000-0000-0003-0000-000000000000
+00000000-0000-0004-0000-000000000000
+00000000-0000-0005-0000-000000000000
+00000000-0000-0006-0000-000000000000
+00000000-0000-0007-0000-000000000000
+00000000-0000-0008-0000-000000000000
+00000000-0000-0009-0000-000000000000
+00000000-0000-000a-0000-000000000000
+00000000-0000-000b-0000-000000000000
+00000000-0000-000c-0000-000000000000
+00000000-0000-000d-0000-000000000000
+00000000-0000-000e-0000-000000000000
+00000000-0000-000f-0000-000000000000
+00000000-0000-0100-0000-000000000000
+00000000-0000-0200-0000-000000000000
+00000000-0000-0300-0000-000000000000
+00000000-0000-0400-0000-000000000000
+00000000-0000-0500-0000-000000000000
+00000000-0000-0600-0000-000000000000
+00000000-0000-0700-0000-000000000000
+00000000-0000-0800-0000-000000000000
+00000000-0000-0900-0000-000000000000
+00000000-0000-0a00-0000-000000000000
+00000000-0000-0b00-0000-000000000000
+00000000-0000-0c00-0000-000000000000
+00000000-0000-0d00-0000-000000000000
+00000000-0000-0e00-0000-000000000000
+00000000-0000-0f00-0000-000000000000
+00000000-0001-0000-0000-000000000000
+00000000-0002-0000-0000-000000000000
+00000000-0003-0000-0000-000000000000
+00000000-0004-0000-0000-000000000000
+00000000-0005-0000-0000-000000000000
+00000000-0006-0000-0000-000000000000
+00000000-0007-0000-0000-000000000000
+00000000-0008-0000-0000-000000000000
+00000000-0009-0000-0000-000000000000
+00000000-000a-0000-0000-000000000000
+00000000-000b-0000-0000-000000000000
+00000000-000c-0000-0000-000000000000
+00000000-000d-0000-0000-000000000000
+00000000-000e-0000-0000-000000000000
+00000000-000f-0000-0000-000000000000
+00000000-0100-0000-0000-000000000000
+00000000-0200-0000-0000-000000000000
+00000000-0300-0000-0000-000000000000
+00000000-0400-0000-0000-000000000000
+00000000-0500-0000-0000-000000000000
+00000000-0600-0000-0000-000000000000
+00000000-0700-0000-0000-000000000000
+00000000-0800-0000-0000-000000000000
+00000000-0900-0000-0000-000000000000
+00000000-0a00-0000-0000-000000000000
+00000000-0b00-0000-0000-000000000000
+00000000-0c00-0000-0000-000000000000
+00000000-0d00-0000-0000-000000000000
+00000000-0e00-0000-0000-000000000000
+00000000-0f00-0000-0000-000000000000
+00000001-0000-0000-0000-000000000000
+00000002-0000-0000-0000-000000000000
+00000003-0000-0000-0000-000000000000
+00000004-0000-0000-0000-000000000000
+00000005-0000-0000-0000-000000000000
+00000006-0000-0000-0000-000000000000
+00000007-0000-0000-0000-000000000000
+00000008-0000-0000-0000-000000000000
+00000009-0000-0000-0000-000000000000
+0000000a-0000-0000-0000-000000000000
+0000000b-0000-0000-0000-000000000000
+0000000c-0000-0000-0000-000000000000
+0000000d-0000-0000-0000-000000000000
+0000000e-0000-0000-0000-000000000000
+0000000f-0000-0000-0000-000000000000
+00000100-0000-0000-0000-000000000000
+00000200-0000-0000-0000-000000000000
+00000300-0000-0000-0000-000000000000
+00000400-0000-0000-0000-000000000000
+00000500-0000-0000-0000-000000000000
+00000600-0000-0000-0000-000000000000
+00000700-0000-0000-0000-000000000000
+00000800-0000-0000-0000-000000000000
+00000900-0000-0000-0000-000000000000
+00000a00-0000-0000-0000-000000000000
+00000b00-0000-0000-0000-000000000000
+00000c00-0000-0000-0000-000000000000
+00000d00-0000-0000-0000-000000000000
+00000e00-0000-0000-0000-000000000000
+00000f00-0000-0000-0000-000000000000
+00010000-0000-0000-0000-000000000000
+00020000-0000-0000-0000-000000000000
+00030000-0000-0000-0000-000000000000
+00040000-0000-0000-0000-000000000000
+00050000-0000-0000-0000-000000000000
+00060000-0000-0000-0000-000000000000
+00070000-0000-0000-0000-000000000000
+00080000-0000-0000-0000-000000000000
+00090000-0000-0000-0000-000000000000
+000a0000-0000-0000-0000-000000000000
+000b0000-0000-0000-0000-000000000000
+000c0000-0000-0000-0000-000000000000
+000d0000-0000-0000-0000-000000000000
+000e0000-0000-0000-0000-000000000000
+000f0000-0000-0000-0000-000000000000
+01000000-0000-0000-0000-000000000000
+02000000-0000-0000-0000-000000000000
+03000000-0000-0000-0000-000000000000
+04000000-0000-0000-0000-000000000000
+05000000-0000-0000-0000-000000000000
+06000000-0000-0000-0000-000000000000
+07000000-0000-0000-0000-000000000000
+08000000-0000-0000-0000-000000000000
+09000000-0000-0000-0000-000000000000
+0a000000-0000-0000-0000-000000000000
+0b000000-0000-0000-0000-000000000000
+0c000000-0000-0000-0000-000000000000
+0d000000-0000-0000-0000-000000000000
+0e000000-0000-0000-0000-000000000000
+0f000000-0000-0000-0000-000000000000
+DROP TABLE t1;
+#
+# cmp_item_uuid: IN for non-constants
+#
+CREATE TABLE t1 (a UUID, b UUID);
+INSERT INTO t1 VALUES
+(
+'00000000-0000-0000-0000-000000000001',
+'00000000-0000-0000-0000-000000000002'
+);
+SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000000' IN (a, b);
+a b
+SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000001' IN (a, b);
+a b
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE '00-000000-0000-0000-0000-000000000001' IN (a, b);
+a b
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE '00-00-0000-0000-0000-0000-000000000001' IN (a, b);
+a b
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002
+DROP TABLE t1;
+#
+# cmp_item_uuid: DECODE_ORACLE
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+(NULL),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT a, DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000002', '01') AS d FROM t1;
+a d
+NULL NULL
+00000000-0000-0000-0000-000000000001 NULL
+00000000-0000-0000-0000-000000000002 01
+SELECT
+a,
+DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000001', '01') AS d0,
+DECODE_ORACLE(a, NULL, '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d1,
+DECODE_ORACLE(a, 'garbage', '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d2
+FROM t1;
+a d0 d1 d2
+NULL NULL <NULL> <NULL>
+00000000-0000-0000-0000-000000000001 01 01 01
+00000000-0000-0000-0000-000000000002 NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+DROP TABLE t1;
+#
+# CASE abbreviations
+#
+CREATE TABLE t1 (
+c UUID,
+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)` uuid DEFAULT NULL,
+ `COALESCE(c, c_varchar)` uuid DEFAULT NULL,
+ `COALESCE(c, c_tinytext)` uuid DEFAULT NULL,
+ `COALESCE(c, c_text)` uuid DEFAULT NULL,
+ `COALESCE(c, c_mediumtext)` uuid DEFAULT NULL,
+ `COALESCE(c, c_longtext)` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+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)` uuid DEFAULT NULL,
+ `LEAST(c, c_varchar)` uuid DEFAULT NULL,
+ `LEAST(c, c_tinytext)` uuid DEFAULT NULL,
+ `LEAST(c, c_text)` uuid DEFAULT NULL,
+ `LEAST(c, c_mediumtext)` uuid DEFAULT NULL,
+ `LEAST(c, c_longtext)` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+(NULL),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT COALESCE(a, '00000000-0000-0000-0000-000000000000') FROM t1 ORDER BY a;
+COALESCE(a, '00000000-0000-0000-0000-000000000000')
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+SELECT
+a,
+LEAST(a,'00000000-0000-0000-0000-000000000000'),
+LEAST(a,'00000000-0000-0000-0000-00000000000f')
+FROM t1 ORDER BY a;
+a LEAST(a,'00000000-0000-0000-0000-000000000000') LEAST(a,'00000000-0000-0000-0000-00000000000f')
+NULL NULL NULL
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002
+SELECT
+a,
+GREATEST(a,'00000000-0000-0000-0000-000000000000'),
+GREATEST(a,'00000000-0000-0000-0000-00000000000f')
+FROM t1 ORDER BY a;
+a GREATEST(a,'00000000-0000-0000-0000-000000000000') GREATEST(a,'00000000-0000-0000-0000-00000000000f')
+NULL NULL NULL
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-00000000000f
+CREATE TABLE t2 AS SELECT
+COALESCE(a, '00000000-0000-0000-0000-000000000000'),
+LEAST(a,'00000000-0000-0000-0000-000000000000'),
+GREATEST(a,'00000000-0000-0000-0000-000000000000')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `COALESCE(a, '00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL,
+ `LEAST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL,
+ `GREATEST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a;
+COALESCE(a, 0x00000000000000000000000000000000)
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+SELECT
+a,
+LEAST(a, 0x00000000000000000000000000000000),
+LEAST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+a LEAST(a, 0x00000000000000000000000000000000) LEAST(a, 0x0000000000000000000000000000000f)
+NULL NULL NULL
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002
+SELECT
+a,
+GREATEST(a, 0x00000000000000000000000000000000),
+GREATEST(a, 0x0000000000000000000000000000000f)
+FROM t1 ORDER BY a;
+a GREATEST(a, 0x00000000000000000000000000000000) GREATEST(a, 0x0000000000000000000000000000000f)
+NULL NULL NULL
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-00000000000f
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-00000000000f
+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)` uuid DEFAULT NULL,
+ `LEAST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL,
+ `GREATEST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+SELECT COALESCE(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types uuid and int for operation 'coalesce'
+SELECT LEAST(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types uuid and int for operation 'least'
+SELECT GREATEST(a, 10) FROM t1;
+ERROR HY000: Illegal parameter data types uuid and int for operation 'greatest'
+DROP TABLE t1;
+SELECT COALESCE('garbage', CAST('::1' AS UUID));
+COALESCE('garbage', CAST('::1' AS UUID))
+NULL
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: '::1'
+SELECT COALESCE(0x01, CAST('::1' AS UUID));
+COALESCE(0x01, CAST('::1' AS UUID))
+NULL
+Warnings:
+Warning 1292 Incorrect uuid value: '\x01'
+Warning 1292 Incorrect uuid value: '::1'
+#
+# Uniqueness
+#
+CREATE TABLE t1 (a UUID NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES
+('41000000-0000-0000-0000-000000000001'),
+('61000000-0000-0000-0000-000000000001');
+INSERT INTO t1 VALUES ('41000000-0000-0000-0000-000000000001');
+ERROR 23000: Duplicate entry '41000000-0000-0000-0000-000000000001' for key 'PRIMARY'
+SELECT * FROM t1;
+a
+41000000-0000-0000-0000-000000000001
+61000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+#
+# Indexes
+#
+CREATE TABLE t1 (a UUID, 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 UUID);
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000001' AS UUID));
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000002' AS UUID));
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000003' AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000001') AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000002') AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS UUID));
+SELECT * FROM t1 ORDER BY a;
+a
+10000000-0000-0000-0000-000000000001
+20000000-0000-0000-0000-000000000001
+10000000-0000-0000-0000-000000000002
+20000000-0000-0000-0000-000000000002
+10000000-0000-0000-0000-000000000003
+20000000-0000-0000-0000-000000000003
+DROP TABLE t1;
+#
+# Explicit CAST and implicit CAST on ALTER
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('garbage'),
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000002');
+SELECT a, CAST(a AS UUID) FROM t1 ORDER BY a;
+a CAST(a AS UUID)
+00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001 ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002 ffff0000-0000-0000-0000-000000000002
+garbage NULL
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT a, CAST(a AS UUID) FROM t1 ORDER BY CAST(a AS UUID);
+a CAST(a AS UUID)
+garbage NULL
+00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001 ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002 ffff0000-0000-0000-0000-000000000002
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+ALTER TABLE t1 MODIFY a UUID;
+ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t1`.`a` at row 1
+SET sql_mode='';
+ALTER TABLE t1 MODIFY a UUID;
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t1`.`a` at row 1
+SET sql_mode=DEFAULT;
+SELECT * FROM t1 ORDER BY a;
+a
+NULL
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+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 UUID) FROM t1 ORDER BY a;
+HEX(a) CAST(a AS UUID)
+00000000000000000000000000000000 00000000-0000-0000-0000-000000000000
+00000000000000000000000000000001 00000000-0000-0000-0000-000000000001
+FFFF0000000000000000000000000001 ffff0000-0000-0000-0000-000000000001
+FFFF0000000000000000000000000002 ffff0000-0000-0000-0000-000000000002
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+DROP TABLE t1;
+#
+# INSERT..SELECT, same data types
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+CREATE TABLE t2 (a UUID);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT * FROM t2;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+DROP TABLE t1,t2;
+#
+# Implicit CAST on INSERT..SELECT, text format
+#
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES
+('garbage'),
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000002');
+CREATE TABLE t2 (a UUID);
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1
+SELECT * FROM t2 ORDER BY a;
+a
+NULL
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+SET sql_mode=DEFAULT;
+DROP TABLE t2;
+CREATE TABLE t2 (a UUID NOT NULL);
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1
+SET sql_mode='';
+INSERT INTO t2 SELECT a FROM t1;
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1
+SELECT * FROM t2 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+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 UUID);
+INSERT INTO t2 SELECT a FROM t1;
+SELECT a FROM t2 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000001
+ffff0000-0000-0000-0000-000000000002
+DROP TABLE t1,t2;
+#
+# CAST to other data types
+#
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DOUBLE);
+ERROR HY000: Illegal parameter data type uuid for operation 'double_typecast'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS FLOAT);
+ERROR HY000: Illegal parameter data type uuid for operation 'float_typecast'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DECIMAL);
+ERROR HY000: Illegal parameter data type uuid for operation 'decimal_typecast'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS SIGNED);
+ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_signed'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS UNSIGNED);
+ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_unsigned'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS TIME);
+ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_time'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATE);
+ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_date'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATETIME);
+ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_datetime'
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR);
+CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR)
+00000000-0000-0000-0000-000000000000
+CREATE TABLE t1 AS SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR) AS a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(36) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+CREATE TABLE t2 AS SELECT
+CAST(a AS CHAR),
+CAST(a AS CHAR(36)),
+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(36) DEFAULT NULL,
+ `CAST(a AS CHAR(36))` varchar(36) 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 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+CAST(a AS CHAR) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(36)) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(530)) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(65535)) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(66000)) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(16777215)) ffffffff-ffff-ffff-ffff-ffffffffffff
+CAST(a AS CHAR(16777216)) ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+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 COLLATE=latin1_swedish_ci
+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 COLLATE=latin1_swedish_ci
+SELECT
+HEX(cb4),
+HEX(cb),
+HEX(cb16),
+HEX(cb32),
+LENGTH(cb530),
+LENGTH(cb65535)
+FROM t2;
+HEX(cb4) FFFFFFFF
+HEX(cb) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+HEX(cb16) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+HEX(cb32) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000
+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('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`a`
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`a`
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,0));
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`a`
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+#
+# Boolean context
+#
+SELECT
+CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE,
+CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE,
+CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE,
+CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE;
+CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE
+0 1 1 0
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001');
+SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a;
+a a IS TRUE a IS FALSE
+00000000-0000-0000-0000-000000000000 0 1
+00000000-0000-0000-0000-000000000001 1 0
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1 WHERE a;
+ERROR HY000: Illegal parameter data types uuid and bigint for operation '<>'
+DROP TABLE t1;
+#
+# GROUP BY
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-0000-00000000');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-0000-00000001'),
+('00000000-0000-0000-0000-0000-0000-0001');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-0000-00000002'),
+('00000000-0000-0000-0000-0000-0000-0002');
+SELECT a, COUNT(*) FROM t1 GROUP BY a;
+a COUNT(*)
+00000000-0000-0000-0000-000000000000 2
+00000000-0000-0000-0000-000000000001 3
+00000000-0000-0000-0000-000000000002 4
+DROP TABLE t1;
+#
+# Aggregate functions
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-0000-00000001'),
+('00000000-0000-0000-0000-0000-0000-0001');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002');
+SELECT MIN(a),MAX(a) FROM t1;
+MIN(a) MAX(a)
+00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(a)` uuid DEFAULT NULL,
+ `MAX(a)` uuid DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t2;
+MIN(a) MAX(a)
+00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002
+DROP TABLE t2;
+SELECT AVG(a) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'avg('
+SELECT AVG(DISTINCT a) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'avg(distinct '
+SELECT SUM(a) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'sum('
+SELECT SUM(DISTINCT a) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'sum(distinct '
+SELECT STDDEV(a) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'std('
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
+GROUP_CONCAT(a ORDER BY a)
+00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002
+SELECT a, GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
+a GROUP_CONCAT(a ORDER BY a)
+00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002
+DROP TABLE t1;
+#
+# Window functions
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000003'),
+('00000000-0000-0000-0000-000000000004');
+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)
+00000000-0000-0000-0000-000000000001 NULL 00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000004 00000000-0000-0000-0000-000000000003 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)
+00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000003
+00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000004
+00000000-0000-0000-0000-000000000004 00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000004
+DROP TABLE t1;
+#
+# Prepared statements
+#
+EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a'
+ USING CAST('00000000-0000-0000-0000-000000000000' AS UUID);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING '00000000-0000-0000-0000-000000000001';
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING CAST('00000000-0000-0000-0000-000000000002' AS UUID);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING 0x00000000000000000000000000000003;
+SELECT a FROM t1 ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+00000000-0000-0000-0000-000000000003
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING '00000000-0000-0000-0000-000000000001';
+a
+00000000-0000-0000-0000-000000000001
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING CAST('00000000-0000-0000-0000-000000000002' AS UUID);
+a
+00000000-0000-0000-0000-000000000002
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING 0x00000000000000000000000000000003;
+a
+00000000-0000-0000-0000-000000000003
+DROP TABLE t1;
+#
+# Character set and collation aggregation
+#
+CREATE TABLE t1 (a UUID);
+CREATE TABLE t2 AS SELECT
+CONCAT(a) AS c1,
+CONCAT(CAST('00000000-0000-0000-0000-000000000000' AS UUID)) AS c2
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(36) DEFAULT NULL,
+ `c2` varchar(36) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+CONCAT(_utf8'1', LEFT(a,35)) AS c1,
+CONCAT(_utf8'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2,
+CONCAT(_utf8'1', LEFT(COALESCE(a),35)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `c2` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `c3` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT
+CONCAT(_latin1'1', LEFT(a,35)) AS c1,
+CONCAT(_latin1'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2,
+CONCAT(_latin1'1', LEFT(COALESCE(a),35)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(36) DEFAULT NULL,
+ `c2` varchar(36) DEFAULT NULL,
+ `c3` varchar(36) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# UNION
+#
+CREATE TABLE t1 AS
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+UNION
+SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t1 ORDER BY c;
+c
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE TABLE t1 AS
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+UNION
+SELECT '00000000-0000-0000-0000-000000000001';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t1 ORDER BY c;
+c
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE TABLE t1 AS
+SELECT '00000000-0000-0000-0000-000000000000' AS c
+UNION
+SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t1 ORDER BY c;
+c
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE TABLE t1 AS
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+UNION
+SELECT 0x00000000000000000000000000000001;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM t1 ORDER BY c;
+c
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE TABLE t1 AS
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+UNION
+SELECT 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation 'UNION'
+#
+# Unary operators
+#
+SELECT -CAST('00000000-0000-0000-0000-000000000000' AS UUID);
+ERROR HY000: Illegal parameter data type uuid for operation '-'
+SELECT ABS(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'abs'
+SELECT ROUND(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'round'
+SELECT CEILING(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'ceiling'
+SELECT FLOOR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'floor'
+#
+# Arithmetic operators
+#
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) + 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation '+'
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) - 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation '-'
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) * 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation '*'
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) / 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation '/'
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) MOD 1;
+ERROR HY000: Illegal parameter data types uuid and int for operation 'MOD'
+#
+# Misc
+#
+SELECT RAND(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'rand'
+SELECT FROM_UNIXTIME(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'from_unixtime'
+SELECT HOUR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'hour'
+SELECT YEAR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'year'
+SELECT RELEASE_LOCK(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+ERROR HY000: Illegal parameter data type uuid for operation 'release_lock'
+SELECT JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID))
+1
+#
+# Virtual columns
+#
+CREATE TABLE t1 (
+a INT,
+b UUID GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS UUID)), 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 UUID GENERATED ALWAYS AS (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)), 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 00000000-0000-0000-0000-000000000010
+1 00000000-0000-0000-0000-000000000011
+2 00000000-0000-0000-0000-000000000012
+3 00000000-0000-0000-0000-000000000013
+4 00000000-0000-0000-0000-000000000014
+5 00000000-0000-0000-0000-000000000015
+6 00000000-0000-0000-0000-000000000016
+7 00000000-0000-0000-0000-000000000017
+8 00000000-0000-0000-0000-000000000018
+9 00000000-0000-0000-0000-000000000019
+10 00000000-0000-0000-0000-00000000001a
+11 00000000-0000-0000-0000-00000000001b
+12 00000000-0000-0000-0000-00000000001c
+13 00000000-0000-0000-0000-00000000001d
+14 00000000-0000-0000-0000-00000000001e
+15 00000000-0000-0000-0000-00000000001f
+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('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)) AS c FROM t1;
+SELECT * FROM v1 ORDER BY c;
+c
+00000000-0000-0000-0000-000000000010
+00000000-0000-0000-0000-000000000011
+00000000-0000-0000-0000-000000000012
+00000000-0000-0000-0000-000000000013
+00000000-0000-0000-0000-000000000014
+00000000-0000-0000-0000-000000000015
+00000000-0000-0000-0000-000000000016
+00000000-0000-0000-0000-000000000017
+00000000-0000-0000-0000-000000000018
+00000000-0000-0000-0000-000000000019
+00000000-0000-0000-0000-00000000001a
+00000000-0000-0000-0000-00000000001b
+00000000-0000-0000-0000-00000000001c
+00000000-0000-0000-0000-00000000001d
+00000000-0000-0000-0000-00000000001e
+00000000-0000-0000-0000-00000000001f
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+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 uuid YES 00000000-0000-0000-0000-000000000000
+INSERT INTO v1 VALUES
+(DEFAULT),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID DEFAULT CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+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 uuid YES cast('00000000-0000-0000-0000-000000000000' as uuid)
+INSERT INTO v1 VALUES
+(DEFAULT),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000000
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# Subqueries
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1 WHERE a=(SELECT MIN(a) FROM t1) ORDER BY a;
+a
+00000000-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE a=(SELECT MAX(a) FROM t1) ORDER BY a;
+a
+00000000-0000-0000-0000-000000000002
+SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a>'00000000-0000-0000-0000-000000000000') ORDER BY a;
+a
+00000000-0000-0000-0000-000000000001
+00000000-0000-0000-0000-000000000002
+DROP TABLE t1;
+#
+# Stored routines
+#
+CREATE PROCEDURE p1(a UUID)
+BEGIN
+DECLARE b UUID DEFAULT CONCAT('1',SUBSTRING(a,2,36));
+SELECT a, b;
+END;
+$$
+CALL p1('00000000-0000-0000-0000-000000000001');
+a b
+00000000-0000-0000-0000-000000000001 10000000-0000-0000-0000-000000000001
+CALL p1(CAST('00000000-0000-0000-0000-000000000002' AS UUID));
+a b
+00000000-0000-0000-0000-000000000002 10000000-0000-0000-0000-000000000002
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a UUID) RETURNS UUID
+BEGIN
+RETURN CONCAT('1',SUBSTRING(a,2,36));
+END;
+$$
+SELECT f1('00000000-0000-0000-0000-000000000001');
+f1('00000000-0000-0000-0000-000000000001')
+10000000-0000-0000-0000-000000000001
+SELECT f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID));
+f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID))
+10000000-0000-0000-0000-000000000002
+DROP FUNCTION f1;
+#
+# Anchored data types in SP variables
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE va TYPE OF t1.a;
+SELECT MAX(a) INTO va FROM t1;
+SELECT va;
+END;
+$$
+CALL p1;
+va
+00000000-0000-0000-0000-000000000001
+DROP PROCEDURE p1;
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b UUID);
+INSERT INTO t1 VALUES
+(
+'00000000-0000-0000-0000-00000000000a',
+'00000000-0000-0000-0000-00000000000b'
+);
+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
+00000000-0000-0000-0000-00000000000a 00000000-0000-0000-0000-00000000000b
+DROP PROCEDURE p1;
+DROP TABLE t1;
+#
+# Optimizer: make_const_item_for_comparison
+#
+CREATE TABLE t1 (id INT, a UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) 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` = UUID'00000000-0000-0000-0000-000000000001' and `test`.`t1`.`id` > 0
+DROP TABLE t1;
+#
+# Optimizer: equal field propagation
+#
+CREATE TABLE t1 (id INT, a UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID))
+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` = UUID'00000000-0000-0000-0000-000000000001' and octet_length(concat(UUID'00000000-0000-0000-0000-000000000001',rand())) > 1
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID))
+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` = UUID'00000000-0000-0000-0000-000000000001'
+DROP TABLE t1;
+#
+# Optimizer: equal expression propagation
+#
+CREATE TABLE t1 (id INT, a UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE COALESCE(a)='00000000-0000-0000-0000-000000000001' 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`) = '00000000-0000-0000-0000-000000000001' and concat(`test`.`t1`.`a`) = '00000000-0000-0000-0000-000000000001'
+DROP TABLE t1;
+#
+# Subquery materialization
+#
+CREATE TABLE t1 (a UUID, b VARCHAR(36), KEY (a), KEY(b)) ;
+INSERT INTO t1 VALUES
+(
+'00000000-0000-0000-0000-00000000000a',
+'00000000-0000-0000-0000-00000000000a'
+),
+(
+'00000000-0000-0000-0000-00000000000a',
+'00000000-0000-0000-0000-00000000000b'
+);
+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;
+#
+# ALTER from UUID to UUID
+#
+CREATE TABLE t1 (a UUID, b INT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001', 1);
+ALTER TABLE t1 MODIFY b DECIMAL(10,2);
+SELECT * FROM t1;
+a b
+00000000-0000-0000-0000-000000000001 1.00
+DROP TABLE t1;
+#
+# ALTER to character string data types
+#
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS CHAR(36)) FROM t1;
+CAST(a AS CHAR(36))
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a VARCHAR(36);
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TINYTEXT;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TEXT;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a MEDIUMTEXT;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a LONGTEXT;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+#
+# ALTER from character string data types
+#
+CREATE OR REPLACE TABLE t1 (a CHAR(64));
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a TINYTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a LONGTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+CAST(a AS UUID)
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+#
+# ALTER to binary string data types
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(17);
+SELECT HEX(a) FROM t1;
+HEX(a)
+0000000000000000000000000000000100
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+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 UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TINYBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a MEDIUMBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a LONGBLOB;
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+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 UUID;
+SELECT a FROM t1;
+a
+20010db8-0000-0000-0000-ff0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a BINARY(17));
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF000042832900');
+ALTER TABLE t1 MODIFY a UUID;
+ERROR 22007: Incorrect uuid 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 UUID;
+ERROR 22007: Incorrect uuid 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 UUID;
+SELECT a FROM t1;
+a
+20010db8-0000-0000-0000-ff0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+a
+20010db8-0000-0000-0000-ff0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a MEDIUMBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+a
+20010db8-0000-0000-0000-ff0000428329
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+a
+20010db8-0000-0000-0000-ff0000428329
+DROP TABLE t1;
+#
+# SET from UUID to UUID
+#
+CREATE TABLE t1 (a UUID, b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+#
+# SET from UUID to numeric
+#
+CREATE TABLE t1 (a UUID, b INT);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b DOUBLE);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b DECIMAL(32,0));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b YEAR);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'year' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from numeric to UUID
+#
+CREATE TABLE t1 (a INT, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(32,0), b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a YEAR, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'year' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from UUID to temporal
+#
+CREATE TABLE t1 (a UUID, b TIME);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b DATE);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'date' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b DATETIME);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'datetime' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'uuid' as 'timestamp' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from temporal to UUID
+#
+CREATE TABLE t1 (a TIME, b UUID);
+INSERT INTO t1 VALUES ('00:00:00', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b UUID);
+INSERT INTO t1 VALUES ('2001-01:01', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'date' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b UUID);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'datetime' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a TIMESTAMP, b UUID);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+UPDATE t1 SET b=a;
+ERROR HY000: Cannot cast 'timestamp' as 'uuid' in assignment of `test`.`t1`.`b`
+SELECT b FROM t1;
+b
+NULL
+DROP TABLE t1;
+#
+# SET from UUID to character string
+#
+CREATE TABLE t1 (a UUID, b CHAR(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b VARCHAR(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b TEXT);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b SET('ffffffff-ffff-ffff-ffff-ffffffffffff'));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+#
+# SET from character string to UUID
+#
+CREATE TABLE t1 (a CHAR(36), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(36), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffffffff-ffff-ffff-ffff-ffffffffffff
+DROP TABLE t1;
+#
+# SET from UUID to binary
+#
+CREATE TABLE t1 (a UUID, b BINARY(16));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b VARBINARY(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID, b BLOB);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+HEX(b)
+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+DROP TABLE t1;
+#
+# SET from binary to UUID
+#
+CREATE TABLE t1 (a BINARY(16), b UUID);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff0000-0000-0000-0000-00000000ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a VARBINARY(16), b UUID);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff0000-0000-0000-0000-00000000ffff
+DROP TABLE t1;
+CREATE TABLE t1 (a BLOB, b UUID);
+INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+b
+ffff0000-0000-0000-0000-00000000ffff
+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('00000000-0000-0000-0000-000000000000' AS UUID);
+1
+#
+# ALTER from UUID to CHAR
+#
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS CHAR(36)) FROM t1;
+CAST(a AS CHAR(36))
+00000000-0000-0000-0000-000000000001
+ALTER TABLE t1 MODIFY a CHAR(36);
+SELECT * FROM t1;
+a
+00000000-0000-0000-0000-000000000001
+DROP TABLE t1;
+#
+# ALTER from UUID to BINARY(16)
+#
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+HEX(a)
+00000000000000000000000000000001
+DROP TABLE t1;
+#
+# CAST(uuid AS BINARY)
+#
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT HEX(CAST(a AS BINARY)) FROM t1;
+HEX(CAST(a AS BINARY))
+00000000000000000000000000000001
+SELECT HEX(CAST(a AS BINARY(16))) FROM t1;
+HEX(CAST(a AS BINARY(16)))
+00000000000000000000000000000001
+DROP TABLE t1;
+#
+# CAST from UUID to FLOAT
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+SELECT CAST(a AS FLOAT) FROM t1;
+ERROR HY000: Illegal parameter data type uuid for operation 'float_typecast'
+DROP TABLE t1;
+#
+# CAST(UUID AS BINARY) - metadata
+#
+CREATE TABLE t1 (a UUID);
+SELECT
+CAST(a AS BINARY(0)),
+CAST(a AS BINARY(1)),
+CAST(a AS BINARY(16)),
+CAST(a AS BINARY(255)),
+CAST(a AS BINARY(256)),
+CAST(a AS BINARY(512)),
+CAST(a AS BINARY(513)),
+CAST(a AS BINARY(65532)),
+CAST(a AS BINARY(65533)),
+CAST(a AS BINARY(65534)),
+CAST(a AS BINARY(65535)),
+CAST(a AS BINARY(65536)),
+CAST(a AS BINARY(16777215)),
+CAST(a AS BINARY(16777216))
+FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def CAST(a AS BINARY(0)) 254 0 0 Y 128 0 63
+def CAST(a AS BINARY(1)) 254 1 0 Y 128 0 63
+def CAST(a AS BINARY(16)) 254 16 0 Y 128 0 63
+def CAST(a AS BINARY(255)) 254 255 0 Y 128 0 63
+def CAST(a AS BINARY(256)) 253 256 0 Y 128 0 63
+def CAST(a AS BINARY(512)) 253 512 0 Y 128 0 63
+def CAST(a AS BINARY(513)) 253 513 0 Y 128 0 63
+def CAST(a AS BINARY(65532)) 253 65532 0 Y 128 0 63
+def CAST(a AS BINARY(65533)) 252 65533 0 Y 128 0 63
+def CAST(a AS BINARY(65534)) 252 65534 0 Y 128 0 63
+def CAST(a AS BINARY(65535)) 252 65535 0 Y 128 0 63
+def CAST(a AS BINARY(65536)) 250 65536 0 Y 128 0 63
+def CAST(a AS BINARY(16777215)) 250 16777215 0 Y 128 0 63
+def CAST(a AS BINARY(16777216)) 251 16777216 0 Y 128 0 63
+CAST(a AS BINARY(0)) CAST(a AS BINARY(1)) CAST(a AS BINARY(16)) CAST(a AS BINARY(255)) CAST(a AS BINARY(256)) CAST(a AS BINARY(512)) CAST(a AS BINARY(513)) CAST(a AS BINARY(65532)) CAST(a AS BINARY(65533)) CAST(a AS BINARY(65534)) CAST(a AS BINARY(65535)) CAST(a AS BINARY(65536)) CAST(a AS BINARY(16777215)) CAST(a AS BINARY(16777216))
+DROP TABLE t1;
+#
+# MIN(uuid) with GROUP BY
+#
+CREATE TABLE t1 (id INT, a UUID) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(1, '00000000-0000-0000-0000-000000000fff'),
+(1, '00000000-0000-0000-0000-000000008888');
+SELECT MIN(a), MAX(a) FROM t1 GROUP BY id;
+MIN(a) MAX(a)
+00000000-0000-0000-0000-000000000fff 00000000-0000-0000-0000-000000008888
+DROP TABLE t1;
+#
+# MDEV-26785 Hyphens inside the value of uuid datatype
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('0000000000000000000000000000000'/*31 digits*/);
+ERROR 22007: Incorrect uuid value: '0000000000000000000000000000000' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES ('000000000000000000000000000000000'/*33 digits*/);
+ERROR 22007: Incorrect uuid value: '000000000000000000000000000000000' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES ('-00000000000000000000000000000000'/*leading hyphen*/);
+ERROR 22007: Incorrect uuid value: '-00000000000000000000000000000000' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES ('-00000000000000000000000000000000-'/*trailing hyphen*/);
+ERROR 22007: Incorrect uuid value: '-00000000000000000000000000000000-' for column `test`.`t1`.`a` at row 1
+INSERT INTO t1 VALUES ('00000000000000000000000000000000');
+INSERT INTO t1 VALUES ('0-0000000000000000000000000000011');
+INSERT INTO t1 VALUES ('0--0000000000000000000000000000012');
+INSERT INTO t1 VALUES ('0---0000000000000000000000000000013');
+INSERT INTO t1 VALUES ('0----0000000000000000000000000000014');
+INSERT INTO t1 VALUES ('00-000000000000000000000000000021');
+INSERT INTO t1 VALUES ('00--000000000000000000000000000022');
+INSERT INTO t1 VALUES ('00---000000000000000000000000000023');
+INSERT INTO t1 VALUES ('00----000000000000000000000000000024');
+INSERT INTO t1 VALUES ('5796dac11a1c11--------------ecab4ef859-713e4be4');
+INSERT INTO t1 VALUES ('5796dac11a1c11---------------ecab4ef859-713e4be4');
+DROP TABLE t1;
+#
+# MDEV-26732 Assertion `0' failed in Item::val_native
+#
+SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > '';
+f var_pop('x')
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Incorrect uuid value: ''
+#
+# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
+#
+CREATE TABLE companies (id uuid, name varchar(10));
+INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
+CREATE TABLE divisions (company_id uuid);
+INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
+SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions);
+id name
+7bc95b06-cc6c-11ec-96c5-0242ac130002 NULL
+UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions);
+SELECT * FROM companies;
+id name
+7bc95b06-cc6c-11ec-96c5-0242ac130002 value
+DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
+SELECT * FROM companies;
+id name
+DROP TABLE divisions;
+DROP TABLE companies;
+#
+# MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result
+#
+CREATE TABLE t1 (d UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000');
+SELECT * FROM t1 ORDER BY d;
+d
+11111111-0000-0000-0000-000000000000
+00000000-0000-0000-0000-111111111111
+SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1);
+d
+11111111-0000-0000-0000-000000000000
+SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
+d
+00000000-0000-0000-0000-111111111111
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test
new file mode 100644
index 00000000000..d4e34c5a74b
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test
@@ -0,0 +1,1684 @@
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+--echo #
+--echo # Basic CREATE functionality, defaults, metadata
+--echo #
+
+--error ER_WRONG_FIELD_SPEC
+CREATE TABLE t1 (a UUID AUTO_INCREMENT);
+
+CREATE TABLE t1 (a UUID);
+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 UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+--enable_metadata
+SELECT * FROM t1;
+SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a;
+--disable_metadata
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (
+ c1 UUID DEFAULT 0x00000000000000000000000000000000,
+ c2 UUID DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
+ c3 UUID DEFAULT '00000000-0000-0000-0000-000000000000',
+ c4 UUID DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff',
+ c5 UUID DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS UUID)
+);
+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 UUID DEFAULT 0x00);
+--error ER_INVALID_DEFAULT
+CREATE TABLE t1 (c1 UUID DEFAULT '');
+
+
+CREATE TABLE t1 (a UUID);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('x');
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (1);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+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 UUID);
+SELECT CAST(0x01 AS UUID);
+SELECT CAST(REPEAT(0x00,16) AS UUID);
+SELECT CAST(REPEAT(0x11,16) AS UUID);
+
+CREATE TABLE t1 AS SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Text and binary formats, comparison operators
+--echo #
+
+CREATE TABLE t1 (a UUID);
+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='00000000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000001';
+SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000001';
+SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000002';
+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< '00000000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a<='00000000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a>='ffff0000-0000-0000-0000-000000000002';
+SELECT * FROM t1 WHERE a> 'ffff0000-0000-0000-0000-000000000002';
+SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000000',
+ 'ffff0000-0000-0000-0000-000000000001'
+) ORDER BY a;
+SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000000',
+ 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='00000000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a='00-000000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a='00-00-0000-0000-0000-0000-000000000000';
+SELECT * FROM t1 WHERE a='00-00-00-00-0000-0000-0000-000000000000';
+
+--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 # ORDER BY
+--echo #
+
+CREATE TABLE t1 (a UUID);
+DELIMITER $$;
+FOR i IN 0..15
+DO
+ INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+DELIMITER ;$$
+
+--echo #
+--echo # Logical ORDER BY
+--echo #
+SELECT * FROM t1 ORDER BY a;
+SELECT COALESCE(NULL, a) FROM t1 ORDER BY a;
+
+--echo #
+--echo # Lexicographical ORDER BY
+--echo #
+
+SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16));
+SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16));
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # cmp_item_uuid: IN for non-constants
+--echo #
+
+CREATE TABLE t1 (a UUID, b UUID);
+INSERT INTO t1 VALUES
+(
+ '00000000-0000-0000-0000-000000000001',
+ '00000000-0000-0000-0000-000000000002'
+);
+SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000000' IN (a, b);
+SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000001' IN (a, b);
+SELECT * FROM t1 WHERE '00-000000-0000-0000-0000-000000000001' IN (a, b);
+SELECT * FROM t1 WHERE '00-00-0000-0000-0000-0000-000000000001' IN (a, b);
+DROP TABLE t1;
+
+
+--echo #
+--echo # cmp_item_uuid: DECODE_ORACLE
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+(NULL),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT a, DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000002', '01') AS d FROM t1;
+SELECT
+ a,
+ DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000001', '01') AS d0,
+ DECODE_ORACLE(a, NULL, '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d1,
+ DECODE_ORACLE(a, 'garbage', '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d2
+FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # CASE abbreviations
+--echo #
+
+CREATE TABLE t1 (
+ c UUID,
+ 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 UUID);
+INSERT INTO t1 VALUES
+(NULL),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+
+SELECT COALESCE(a, '00000000-0000-0000-0000-000000000000') FROM t1 ORDER BY a;
+
+SELECT
+ a,
+ LEAST(a,'00000000-0000-0000-0000-000000000000'),
+ LEAST(a,'00000000-0000-0000-0000-00000000000f')
+FROM t1 ORDER BY a;
+
+SELECT
+ a,
+ GREATEST(a,'00000000-0000-0000-0000-000000000000'),
+ GREATEST(a,'00000000-0000-0000-0000-00000000000f')
+FROM t1 ORDER BY a;
+
+CREATE TABLE t2 AS SELECT
+ COALESCE(a, '00000000-0000-0000-0000-000000000000'),
+ LEAST(a,'00000000-0000-0000-0000-000000000000'),
+ GREATEST(a,'00000000-0000-0000-0000-000000000000')
+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 UUID));
+SELECT COALESCE(0x01, CAST('::1' AS UUID));
+
+
+--echo #
+--echo # Uniqueness
+--echo #
+
+CREATE TABLE t1 (a UUID NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES
+('41000000-0000-0000-0000-000000000001'),
+('61000000-0000-0000-0000-000000000001');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES ('41000000-0000-0000-0000-000000000001');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Indexes
+--echo #
+
+--error ER_WRONG_SUB_KEY
+CREATE TABLE t1 (a UUID, KEY(a(1)));
+
+
+--echo #
+--echo # Explicit CAST on INSERT
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000001' AS UUID));
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000002' AS UUID));
+INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000003' AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000001') AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000002') AS UUID));
+INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS UUID));
+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'),
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000002');
+SELECT a, CAST(a AS UUID) FROM t1 ORDER BY a;
+SELECT a, CAST(a AS UUID) FROM t1 ORDER BY CAST(a AS UUID);
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t1 MODIFY a UUID;
+SET sql_mode='';
+ALTER TABLE t1 MODIFY a UUID;
+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 UUID) FROM t1 ORDER BY a;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+--echo #
+--echo # INSERT..SELECT, same data types
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+CREATE TABLE t2 (a UUID);
+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'),
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000001'),
+('ffff0000-0000-0000-0000-000000000002');
+
+CREATE TABLE t2 (a UUID);
+--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 UUID 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 UUID);
+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('00000000-0000-0000-0000-000000000000' AS UUID) AS DOUBLE);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS FLOAT);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DECIMAL);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS SIGNED);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS UNSIGNED);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS TIME);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATE);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATETIME);
+
+SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR);
+CREATE TABLE t1 AS SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR) AS a;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+CREATE TABLE t2 AS SELECT
+ CAST(a AS CHAR),
+ CAST(a AS CHAR(36)),
+ 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 UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff');
+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_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,0));
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+DROP TABLE t1;
+
+
+
+--echo #
+--echo # Boolean context
+--echo #
+
+SELECT
+ CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE,
+ CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE,
+ CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE,
+ CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001');
+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<>'00000000-0000-0000-0000-000000000000'.
+# The same problem is repeatable with GEOMETRY.
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+--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 UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-0000-00000000');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-0000-00000001'),
+('00000000-0000-0000-0000-0000-0000-0001');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-0000-00000002'),
+('00000000-0000-0000-0000-0000-0000-0002');
+SELECT a, COUNT(*) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # Aggregate functions
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000000');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-0000-00000001'),
+('00000000-0000-0000-0000-0000-0000-0001');
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000002');
+SELECT MIN(a),MAX(a) FROM t1;
+
+CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM 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 UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002'),
+('00000000-0000-0000-0000-000000000003'),
+('00000000-0000-0000-0000-000000000004');
+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('00000000-0000-0000-0000-000000000000' AS UUID);
+SHOW CREATE TABLE t1;
+
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING '00000000-0000-0000-0000-000000000001';
+
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING CAST('00000000-0000-0000-0000-000000000002' AS UUID);
+
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)'
+ USING 0x00000000000000000000000000000003;
+
+SELECT a FROM t1 ORDER BY a;
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING '00000000-0000-0000-0000-000000000001';
+
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING CAST('00000000-0000-0000-0000-000000000002' AS UUID);
+
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?'
+ USING 0x00000000000000000000000000000003;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Character set and collation aggregation
+--echo #
+
+CREATE TABLE t1 (a UUID);
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(a) AS c1,
+ CONCAT(CAST('00000000-0000-0000-0000-000000000000' AS UUID)) AS c2
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(_utf8'1', LEFT(a,35)) AS c1,
+ CONCAT(_utf8'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2,
+ CONCAT(_utf8'1', LEFT(COALESCE(a),35)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 AS SELECT
+ CONCAT(_latin1'1', LEFT(a,35)) AS c1,
+ CONCAT(_latin1'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2,
+ CONCAT(_latin1'1', LEFT(COALESCE(a),35)) AS c3
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # UNION
+--echo #
+
+CREATE TABLE t1 AS
+ SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+ UNION
+ SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1 ORDER BY c;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS
+ SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+ UNION
+ SELECT '00000000-0000-0000-0000-000000000001';
+SHOW CREATE TABLE t1;
+SELECT * FROM t1 ORDER BY c;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS
+ SELECT '00000000-0000-0000-0000-000000000000' AS c
+ UNION
+ SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1 ORDER BY c;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS
+ SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+ UNION
+ SELECT 0x00000000000000000000000000000001;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1 ORDER BY c;
+DROP TABLE t1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+CREATE TABLE t1 AS
+ SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c
+ UNION
+ SELECT 1;
+
+
+--echo #
+--echo # Unary operators
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT -CAST('00000000-0000-0000-0000-000000000000' AS UUID);
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT ABS(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT ROUND(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CEILING(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT FLOOR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+
+--echo #
+--echo # Arithmetic operators
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) + 1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) - 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) * 1;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) / 1;
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) MOD 1;
+
+
+--echo #
+--echo # Misc
+--echo #
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT RAND(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT FROM_UNIXTIME(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT HOUR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT YEAR(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT RELEASE_LOCK(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+SELECT JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+
+--echo #
+--echo # Virtual columns
+--echo #
+
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+CREATE TABLE t1 (
+ a INT,
+ b UUID GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS UUID)), INDEX(b)
+);
+
+CREATE TABLE t1 (
+ a INT,
+ b UUID GENERATED ALWAYS AS (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)), 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('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)) AS c FROM t1;
+SELECT * FROM v1 ORDER BY c;
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+DESCRIBE v1;
+INSERT INTO v1 VALUES
+(DEFAULT),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID DEFAULT CAST('00000000-0000-0000-0000-000000000000' AS UUID));
+CREATE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+DESCRIBE v1;
+INSERT INTO v1 VALUES
+(DEFAULT),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Subqueries
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('00000000-0000-0000-0000-000000000000'),
+('00000000-0000-0000-0000-000000000001'),
+('00000000-0000-0000-0000-000000000002');
+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>'00000000-0000-0000-0000-000000000000') ORDER BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # Stored routines
+--echo #
+
+DELIMITER $$;
+CREATE PROCEDURE p1(a UUID)
+BEGIN
+ DECLARE b UUID DEFAULT CONCAT('1',SUBSTRING(a,2,36));
+ SELECT a, b;
+END;
+$$
+DELIMITER ;$$
+CALL p1('00000000-0000-0000-0000-000000000001');
+CALL p1(CAST('00000000-0000-0000-0000-000000000002' AS UUID));
+DROP PROCEDURE p1;
+
+DELIMITER $$;
+CREATE FUNCTION f1(a UUID) RETURNS UUID
+BEGIN
+ RETURN CONCAT('1',SUBSTRING(a,2,36));
+END;
+$$
+DELIMITER ;$$
+SELECT f1('00000000-0000-0000-0000-000000000001');
+SELECT f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID));
+DROP FUNCTION f1;
+
+--echo #
+--echo # Anchored data types in SP variables
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+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 UUID, b UUID);
+INSERT INTO t1 VALUES
+(
+ '00000000-0000-0000-0000-00000000000a',
+ '00000000-0000-0000-0000-00000000000b'
+);
+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 UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) AND id>0;
+DROP TABLE t1;
+
+--echo #
+--echo # Optimizer: equal field propagation
+--echo #
+
+CREATE TABLE t1 (id INT, a UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID))
+ AND LENGTH(CONCAT(a,RAND()))>1;
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID))
+ AND LENGTH(a)>1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Optimizer: equal expression propagation
+--echo #
+
+
+CREATE TABLE t1 (id INT, a UUID);
+INSERT INTO t1 VALUES
+(1,'00000000-0000-0000-0000-000000000001'),
+(2,'00000000-0000-0000-0000-000000000002');
+EXPLAIN EXTENDED SELECT * FROM t1
+WHERE COALESCE(a)='00000000-0000-0000-0000-000000000001' AND COALESCE(a)=CONCAT(a);
+DROP TABLE t1;
+
+--echo #
+--echo # Subquery materialization
+--echo #
+
+CREATE TABLE t1 (a UUID, b VARCHAR(36), KEY (a), KEY(b)) ;
+INSERT INTO t1 VALUES
+(
+ '00000000-0000-0000-0000-00000000000a',
+ '00000000-0000-0000-0000-00000000000a'
+),
+(
+ '00000000-0000-0000-0000-00000000000a',
+ '00000000-0000-0000-0000-00000000000b'
+);
+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 # ALTER from UUID to UUID
+--echo #
+
+CREATE TABLE t1 (a UUID, b INT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001', 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 UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS CHAR(36)) FROM t1;
+ALTER TABLE t1 MODIFY a CHAR(39);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a VARCHAR(36);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TINYTEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a MEDIUMTEXT;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+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 ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a VARCHAR(64));
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a TINYTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a LONGTEXT);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS UUID) FROM t1;
+ALTER TABLE t1 MODIFY a UUID;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # ALTER to binary string data types
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(17);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+--error ER_DATA_TOO_LONG
+ALTER TABLE t1 MODIFY a BINARY(15);
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a TINYBLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a MEDIUMBLOB;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+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 UUID;
+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 UUID;
+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 UUID;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TINYBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a MEDIUMBLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BLOB);
+INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329');
+ALTER TABLE t1 MODIFY a UUID;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from UUID to UUID
+--echo #
+
+CREATE TABLE t1 (a UUID, b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # SET from UUID to numeric
+--echo #
+
+CREATE TABLE t1 (a UUID, b INT);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b DOUBLE);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b DECIMAL(32,0));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b YEAR);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from numeric to UUID
+--echo #
+
+CREATE TABLE t1 (a INT, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DECIMAL(32,0), b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a YEAR, b UUID);
+INSERT INTO t1 VALUES (1, NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from UUID to temporal
+--echo #
+
+CREATE TABLE t1 (a UUID, b TIME);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b DATE);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b DATETIME);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from temporal to UUID
+--echo #
+
+CREATE TABLE t1 (a TIME, b UUID);
+INSERT INTO t1 VALUES ('00:00:00', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATE, b UUID);
+INSERT INTO t1 VALUES ('2001-01:01', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME, b UUID);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIMESTAMP, b UUID);
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL);
+--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from UUID to character string
+--echo #
+
+CREATE TABLE t1 (a UUID, b CHAR(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b VARCHAR(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b TEXT);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b SET('ffffffff-ffff-ffff-ffff-ffffffffffff'));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from character string to UUID
+--echo #
+
+CREATE TABLE t1 (a CHAR(36), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(36), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TEXT, b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SET('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT b FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from UUID to binary
+--echo #
+
+CREATE TABLE t1 (a UUID, b BINARY(16));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b VARBINARY(39));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID, b BLOB);
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL);
+UPDATE t1 SET b=a;
+SELECT HEX(b) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # SET from binary to UUID
+--echo #
+
+CREATE TABLE t1 (a BINARY(16), b UUID);
+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 UUID);
+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 UUID);
+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('00000000-0000-0000-0000-000000000000' AS UUID);
+
+
+# TODO:
+# - Add hooks to run mysql_client_test with pluggable data types
+#
+# - This should fail with the "illegal data type" error:
+#SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) DIV 1;
+#
+# - This should fail with the "illegal data type" error:
+# EXTRACT(MINUTE...)
+#
+
+
+--echo #
+--echo # ALTER from UUID to CHAR
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT CAST(a AS CHAR(36)) FROM t1;
+ALTER TABLE t1 MODIFY a CHAR(36);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # ALTER from UUID to BINARY(16)
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+ALTER TABLE t1 MODIFY a BINARY(16);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # CAST(uuid AS BINARY)
+--echo #
+
+CREATE OR REPLACE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
+SELECT HEX(CAST(a AS BINARY)) FROM t1;
+SELECT HEX(CAST(a AS BINARY(16))) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # CAST from UUID to FLOAT
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+SELECT CAST(a AS FLOAT) FROM t1;
+DROP TABLE t1;
+
+# TODO: below does not work well
+#--echo #
+#--echo # Conversion from UUID to other types
+#--echo #
+#
+#CREATE TABLE t1 (a UUID, b INT);
+#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000');
+#--error WARN_DATA_TRUNCATED
+#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 UUID, b TIMESTAMP);
+#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000');
+#--error WARN_DATA_TRUNCATED
+#UPDATE t1 SET b=a;
+#SELECT * FROM t1;
+#DROP TABLE t1;
+#SET timestamp=DEFAULT;
+#
+#CREATE OR REPLACE TABLE t1 (a UUID);
+#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000');
+#--error WARN_DATA_TRUNCATED
+#ALTER TABLE t1 MODIFY a DATE;
+#DROP TABLE t1;
+
+--echo #
+--echo # CAST(UUID AS BINARY) - metadata
+--echo #
+
+CREATE TABLE t1 (a UUID);
+--enable_metadata
+SELECT
+ CAST(a AS BINARY(0)),
+ CAST(a AS BINARY(1)),
+ CAST(a AS BINARY(16)),
+ CAST(a AS BINARY(255)),
+ CAST(a AS BINARY(256)),
+ CAST(a AS BINARY(512)),
+ CAST(a AS BINARY(513)),
+ CAST(a AS BINARY(65532)),
+ CAST(a AS BINARY(65533)),
+ CAST(a AS BINARY(65534)),
+ CAST(a AS BINARY(65535)),
+ CAST(a AS BINARY(65536)),
+ CAST(a AS BINARY(16777215)),
+ CAST(a AS BINARY(16777216))
+FROM t1;
+--disable_metadata
+DROP TABLE t1;
+
+--echo #
+--echo # MIN(uuid) with GROUP BY
+--echo #
+
+CREATE TABLE t1 (id INT, a UUID) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(1, '00000000-0000-0000-0000-000000000fff'),
+(1, '00000000-0000-0000-0000-000000008888');
+SELECT MIN(a), MAX(a) FROM t1 GROUP BY id;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-26785 Hyphens inside the value of uuid datatype
+--echo #
+
+CREATE TABLE t1 (a UUID);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('0000000000000000000000000000000'/*31 digits*/);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('000000000000000000000000000000000'/*33 digits*/);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('-00000000000000000000000000000000'/*leading hyphen*/);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 VALUES ('-00000000000000000000000000000000-'/*trailing hyphen*/);
+
+INSERT INTO t1 VALUES ('00000000000000000000000000000000');
+INSERT INTO t1 VALUES ('0-0000000000000000000000000000011');
+INSERT INTO t1 VALUES ('0--0000000000000000000000000000012');
+INSERT INTO t1 VALUES ('0---0000000000000000000000000000013');
+INSERT INTO t1 VALUES ('0----0000000000000000000000000000014');
+INSERT INTO t1 VALUES ('00-000000000000000000000000000021');
+INSERT INTO t1 VALUES ('00--000000000000000000000000000022');
+INSERT INTO t1 VALUES ('00---000000000000000000000000000023');
+INSERT INTO t1 VALUES ('00----000000000000000000000000000024');
+
+INSERT INTO t1 VALUES ('5796dac11a1c11--------------ecab4ef859-713e4be4');
+INSERT INTO t1 VALUES ('5796dac11a1c11---------------ecab4ef859-713e4be4');
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26732 Assertion `0' failed in Item::val_native
+--echo #
+
+SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > '';
+
+
+--echo #
+--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
+--echo #
+
+CREATE TABLE companies (id uuid, name varchar(10));
+INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
+
+CREATE TABLE divisions (company_id uuid);
+INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
+SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions);
+UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions);
+SELECT * FROM companies;
+DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
+SELECT * FROM companies;
+DROP TABLE divisions;
+DROP TABLE companies;
+
+
+--echo #
+--echo # MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result
+--echo #
+
+CREATE TABLE t1 (d UUID);
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000');
+SELECT * FROM t1 ORDER BY d;
+SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1);
+SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result
new file mode 100644
index 00000000000..d912244e691
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result
@@ -0,0 +1,92 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET default_storage_engine=CSV;
+CREATE TABLE t1 (a UUID NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00,15), UNHEX(HEX(i))));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+a
+00000000-0000-0000-0000-0000000000ff
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe' ORDER BY a;
+a
+00000000-0000-0000-0000-0000000000fe
+00000000-0000-0000-0000-0000000000ff
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000ff'
+)
+ORDER BY a;
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+00000000-0000-0000-0000-0000000000ff
+SELECT * FROM t1
+WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080'
+ AND
+'00000000-0000-0000-0000-000000000081'
+ORDER BY a;
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-000000000081
+SELECT CONCAT('ffff',SUBSTRING(a, 5,256)) FROM t1 WHERE a LIKE '%a_';
+CONCAT('ffff',SUBSTRING(a, 5,256))
+ffff0000-0000-0000-0000-0000000000a0
+ffff0000-0000-0000-0000-0000000000a1
+ffff0000-0000-0000-0000-0000000000a2
+ffff0000-0000-0000-0000-0000000000a3
+ffff0000-0000-0000-0000-0000000000a4
+ffff0000-0000-0000-0000-0000000000a5
+ffff0000-0000-0000-0000-0000000000a6
+ffff0000-0000-0000-0000-0000000000a7
+ffff0000-0000-0000-0000-0000000000a8
+ffff0000-0000-0000-0000-0000000000a9
+ffff0000-0000-0000-0000-0000000000aa
+ffff0000-0000-0000-0000-0000000000ab
+ffff0000-0000-0000-0000-0000000000ac
+ffff0000-0000-0000-0000-0000000000ad
+ffff0000-0000-0000-0000-0000000000ae
+ffff0000-0000-0000-0000-0000000000af
+UPDATE t1 SET a=CONCAT('ffff',SUBSTRING(a, 5,256)) WHERE a LIKE '%a_';
+SELECT * FROM t1 WHERE a LIKE 'ffff%' ORDER BY a;
+a
+ffff0000-0000-0000-0000-0000000000a0
+ffff0000-0000-0000-0000-0000000000a1
+ffff0000-0000-0000-0000-0000000000a2
+ffff0000-0000-0000-0000-0000000000a3
+ffff0000-0000-0000-0000-0000000000a4
+ffff0000-0000-0000-0000-0000000000a5
+ffff0000-0000-0000-0000-0000000000a6
+ffff0000-0000-0000-0000-0000000000a7
+ffff0000-0000-0000-0000-0000000000a8
+ffff0000-0000-0000-0000-0000000000a9
+ffff0000-0000-0000-0000-0000000000aa
+ffff0000-0000-0000-0000-0000000000ab
+ffff0000-0000-0000-0000-0000000000ac
+ffff0000-0000-0000-0000-0000000000ad
+ffff0000-0000-0000-0000-0000000000ae
+ffff0000-0000-0000-0000-0000000000af
+DROP TABLE t1;
+CREATE TABLE t1 (a UUID NOT NULL) ENGINE=CSV;
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000');
+SELECT * FROM t1;
+a
+123e4567-e89b-12d3-a456-426655440000
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test
new file mode 100644
index 00000000000..482fb6a0e43
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test
@@ -0,0 +1,58 @@
+--source include/have_csv.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+SET default_storage_engine=CSV;
+
+CREATE TABLE t1 (a UUID NOT NULL);
+SHOW CREATE TABLE t1;
+
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00,15), UNHEX(HEX(i))));
+END FOR
+$$
+DELIMITER ;$$
+
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe' ORDER BY a;
+
+SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000080',
+ '00000000-0000-0000-0000-0000000000a0',
+ '00000000-0000-0000-0000-0000000000ff'
+)
+ORDER BY a;
+
+SELECT * FROM t1
+WHERE a BETWEEN
+ '00000000-0000-0000-0000-000000000080'
+ AND
+ '00000000-0000-0000-0000-000000000081'
+ORDER BY a;
+
+SELECT CONCAT('ffff',SUBSTRING(a, 5,256)) FROM t1 WHERE a LIKE '%a_';
+UPDATE t1 SET a=CONCAT('ffff',SUBSTRING(a, 5,256)) WHERE a LIKE '%a_';
+
+SELECT * FROM t1 WHERE a LIKE 'ffff%' ORDER BY a;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a UUID NOT NULL) ENGINE=CSV;
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc
new file mode 100644
index 00000000000..41494c86ff6
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc
@@ -0,0 +1,108 @@
+--echo #
+--echo # Range optimizer
+--echo #
+
+CREATE TABLE t1 (a UUID, INDEX(a));
+SHOW CREATE TABLE t1;
+
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY)));
+END FOR
+$$
+DELIMITER ;$$
+
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+SELECT * FROM t1 WHERE a='garbage';
+EXPLAIN SELECT * FROM t1 WHERE a='garbage';
+
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+SELECT * FROM t1 WHERE a>='garbage';
+EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
+
+SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000080',
+ '00000000-0000-0000-0000-0000000000a0',
+ '00000000-0000-0000-0000-0000000000f0'
+);
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000080',
+ '00000000-0000-0000-0000-0000000000a0',
+ '00000000-0000-0000-0000-0000000000f0'
+);
+SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000080',
+ '00000000-0000-0000-0000-0000000000a0',
+ 'garbage'
+);
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+ '00000000-0000-0000-0000-000000000080',
+ '00000000-0000-0000-0000-0000000000a0',
+ 'garbage'
+);
+
+SELECT * FROM t1 WHERE a BETWEEN
+ '00000000-0000-0000-0000-000000000080' AND
+ '00000000-0000-0000-0000-000000000081';
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+ '00000000-0000-0000-0000-000000000080' AND
+ '00000000-0000-0000-0000-000000000081';
+
+SELECT * FROM t1 WHERE a BETWEEN
+ '00000000-0000-0000-0000-000000000080' AND
+ 'garbage';
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+ '00000000-0000-0000-0000-000000000080' AND
+ 'garbage';
+
+SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+
+DROP TABLE t1;
+
+
+CREATE OR REPLACE TABLE t1 (a UUID,KEY(a));
+SHOW CREATE TABLE t1;
+BEGIN;
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+DELIMITER ;$$
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000';
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000';
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result
new file mode 100644
index 00000000000..d769f1a1374
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result
@@ -0,0 +1,203 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET default_storage_engine=InnoDB;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a UUID, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+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 uuid value: 'garbage'
+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 uuid value: 'garbage'
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+a
+00000000-0000-0000-0000-0000000000fe
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+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
+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
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+00000000-0000-0000-0000-0000000000f0
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+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
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'garbage'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'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 uuid value: 'garbage'
+SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-000000000081
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+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
+'00000000-0000-0000-0000-000000000080' AND
+'garbage';
+a
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' 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
+SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+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` = UUID'00000000-0000-0000-0000-0000000000ff'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID,KEY(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+BEGIN;
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000';
+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
+DROP TABLE t1;
+#
+# MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item
+#
+CREATE TABLE t1 ( pk uuid, c text) engine=myisam;
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000',1);
+CREATE TABLE t2 ( d text, KEY (d)) engine=innodb ;
+Warnings:
+Note 1071 Specified key was too long; max key length is 3072 bytes
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d);
+d pk c
+Warnings:
+Warning 1292 Incorrect uuid value: '2'
+EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+1 SIMPLE t2 ALL d NULL NULL NULL 1 Using where
+UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1;
+ERROR 22007: Incorrect uuid value: '2'
+DROP TABLE t1, t2;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test
new file mode 100644
index 00000000000..941a7a73d9a
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test
@@ -0,0 +1,31 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+SET default_storage_engine=InnoDB;
+--source type_uuid_engines.inc
+
+--echo #
+--echo # MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item
+--echo #
+
+CREATE TABLE t1 ( pk uuid, c text) engine=myisam;
+INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000',1);
+CREATE TABLE t2 ( d text, KEY (d)) engine=innodb ;
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d);
+EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d);
+--error ER_TRUNCATED_WRONG_VALUE
+UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1;
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result
new file mode 100644
index 00000000000..f2a1e27d0d0
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result
@@ -0,0 +1,250 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET default_storage_engine=MEMORY;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a UUID, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 4 Using where
+SELECT * FROM t1 WHERE a='garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+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 uuid value: 'garbage'
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+a
+00000000-0000-0000-0000-0000000000fe
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+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 uuid 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
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+00000000-0000-0000-0000-0000000000f0
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 12 Using where
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'garbage'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'garbage'
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 8 Using where
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-000000000081
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+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
+'00000000-0000-0000-0000-000000000080' AND
+'garbage';
+a
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+Warning 1292 Incorrect uuid value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' 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('00000000-0000-0000-0000-0000000000ff' AS UUID);
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ref a a 17 const 4 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID,KEY(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+BEGIN;
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 17 const 2 Using where
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test
new file mode 100644
index 00000000000..cdae2bc39c2
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test
@@ -0,0 +1,15 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+SET default_storage_engine=MEMORY;
+--source type_uuid_engines.inc
+
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result
new file mode 100644
index 00000000000..65dcabda42d
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `source` decimal(38,0) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+2 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target decimal(38,0)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+DECLARE dst uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a uuid) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst uuid)
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'decimal' as 'uuid' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS uuid
+BEGIN
+DECLARE rc decimal(38,0) DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src decimal(38,0) DEFAULT NULL;
+DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` decimal(38,0) DEFAULT 0,
+ `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+2 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 01000: Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target uuid
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE dst decimal(38,0) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst decimal(38,0))
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst decimal(38,0) DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'uuid' as 'decimal' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS decimal(38,0)
+BEGIN
+DECLARE rc uuid DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst decimal(38,0) DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test
new file mode 100644
index 00000000000..234e31b6565
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result
new file mode 100644
index 00000000000..ae19f916544
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `source` double DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+2 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target double
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE dst uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a uuid) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst uuid)
+BEGIN
+DECLARE src double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'double' as 'uuid' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS uuid
+BEGIN
+DECLARE rc double DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src double DEFAULT NULL;
+DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` double DEFAULT 0,
+ `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+2 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 01000: Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target uuid
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE dst double DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a double) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst double)
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'uuid' as 'double' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS double
+BEGIN
+DECLARE rc uuid DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst double DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test
new file mode 100644
index 00000000000..8e8529aeed3
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result
new file mode 100644
index 00000000000..c92584a8b1e
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `source` int(11) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+2 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target int(11)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE dst uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a uuid) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst uuid)
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'int' as 'uuid' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS uuid
+BEGIN
+DECLARE rc int(11) DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(11) DEFAULT NULL;
+DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` int(11) DEFAULT 0,
+ `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+2 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 01000: Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target uuid
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE dst int(11) DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a int(11)) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst int(11))
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'uuid' as 'int' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS int(11)
+BEGIN
+DECLARE rc uuid DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst int(11) DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test
new file mode 100644
index 00000000000..79a55566258
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result
new file mode 100644
index 00000000000..a4feb55b577
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `source` time DEFAULT '00:00:00',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 00:00:00
+2 00000000-0000-0000-0000-000000000000 00:00:00
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 00:00:00
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target time
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src time DEFAULT NULL;
+DECLARE dst uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a uuid) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst uuid)
+BEGIN
+DECLARE src time DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'time' as 'uuid' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS uuid
+BEGIN
+DECLARE rc time DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src time DEFAULT NULL;
+DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` time DEFAULT '00:00:00',
+ `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 00:00:00 00000000-0000-0000-0000-000000000000
+2 00:00:00 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect time value: '00000000-0000-0000-0000-000000000000' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00:00:00 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target uuid
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE dst time DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a time) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst time)
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst time DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'uuid' as 'time' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS time
+BEGIN
+DECLARE rc uuid DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst time DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test
new file mode 100644
index 00000000000..5182d0ceebd
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result
new file mode 100644
index 00000000000..252704d57ef
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result
@@ -0,0 +1,353 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ `source` int(10) unsigned DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+2 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 00000000-0000-0000-0000-000000000000 0
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target int(10) unsigned
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+DECLARE dst uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a uuid) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst uuid)
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'int unsigned' as 'uuid' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS uuid
+BEGIN
+DECLARE rc int(10) unsigned DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src int(10) unsigned DEFAULT NULL;
+DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst uuid DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+# Start of type_store_assignment_incompatible.inc
+SET @sql_mode_save= @@sql_mode;
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN ''
+ WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore)
+ELSE @ignore
+END;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` int(10) unsigned DEFAULT 0,
+ `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1265 Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+2 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR 01000: Data truncated for column 'target' at row 2
+SELECT * FROM v3;
+id target source
+1 0 00000000-0000-0000-0000-000000000000
+TRUNCATE TABLE t3;
+SET sql_mode=@sql_mode_save;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+UPDATE t3 SET target=source;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target`
+SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target uuid
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target`
+DROP TABLE t3;
+DROP TABLE t2;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE dst int(10) unsigned DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CALL p1;
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst`
+DROP PROCEDURE p1;
+CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;;
+SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;;
+CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1));
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a`
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(OUT dst int(10) unsigned)
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+SET dst=src;
+END;
+$$
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE dst int(10) unsigned DEFAULT NULL;
+CALL p1(dst);
+END;
+$$
+CALL p2();
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst`
+SHOW WARNINGS;
+Level Code Message
+Error 4078 Cannot cast 'uuid' as 'int unsigned' in assignment of `dst`
+Note 4094 At line 4 in test.p1
+Note 4094 At line 4 in test.p2
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+CREATE FUNCTION f1() RETURNS int(10) unsigned
+BEGIN
+DECLARE rc uuid DEFAULT NULL;
+RETURN rc;
+END;
+$$
+SELECT f1();
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `f1()`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE src uuid DEFAULT NULL;
+DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t;
+OPEN cur1(src);
+CLOSE cur1;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `t`
+DROP PROCEDURE p1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES ();
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE dst int(10) unsigned DEFAULT NULL;
+DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1;
+OPEN cur2;
+FETCH cur2 INTO dst;
+CLOSE cur2;
+END;
+$$
+CALL p1();
+ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst`
+DROP PROCEDURE p1;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test
new file mode 100644
index 00000000000..94de2dce2d8
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+--echo #
+
+CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0);
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000');
+--source include/type_mix_incompatible.inc
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result
new file mode 100644
index 00000000000..8df2c85ae48
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result
@@ -0,0 +1,237 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET default_storage_engine=MyISAM;
+#
+# Range optimizer
+#
+CREATE TABLE t1 (a UUID, INDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY)));
+END FOR
+$$
+SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff';
+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 uuid value: 'garbage'
+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 uuid value: 'garbage'
+SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+a
+00000000-0000-0000-0000-0000000000fe
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe';
+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>='garbage';
+a
+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
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+00000000-0000-0000-0000-0000000000f0
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'00000000-0000-0000-0000-0000000000f0'
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 17 NULL 4 Using where; Using index
+SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'garbage'
+);
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-0000000000a0
+Warnings:
+Warning 1292 Incorrect uuid value: 'garbage'
+EXPLAIN SELECT * FROM t1 WHERE a IN
+(
+'00000000-0000-0000-0000-000000000080',
+'00000000-0000-0000-0000-0000000000a0',
+'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 uuid value: 'garbage'
+SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+a
+00000000-0000-0000-0000-000000000080
+00000000-0000-0000-0000-000000000081
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' AND
+'00000000-0000-0000-0000-000000000081';
+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
+'00000000-0000-0000-0000-000000000080' AND
+'garbage';
+a
+EXPLAIN SELECT * FROM t1 WHERE a BETWEEN
+'00000000-0000-0000-0000-000000000080' 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
+SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+a
+00000000-0000-0000-0000-0000000000ff
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID);
+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` = UUID'00000000-0000-0000-0000-0000000000ff'
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a UUID,KEY(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+BEGIN;
+FOR i IN 0..255
+DO
+INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000';
+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
+EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000';
+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
+DROP TABLE t1;
+#
+# Testing index prefix compression
+#
+CREATE PROCEDURE test_pack_key()
+BEGIN
+SHOW CREATE TABLE t1;
+FOR i IN 0..0x1FFF
+DO
+INSERT INTO t1 VALUES (UUID());
+END FOR;
+SELECT
+CASE
+WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED'
+ WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED'
+ ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH)
+END AS PackKey
+FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+END;
+$$
+"------------------ CREATE TABLE"
+CREATE TABLE t1 (a UUID, KEY(a));
+CALL test_pack_key();
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+PackKey
+PACKED
+DROP TABLE t1;
+"------------------ t1packkey.frm"
+TRUNCATE TABLE t1;
+CALL test_pack_key();
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+PackKey
+PACKED
+DROP TABLE t1;
+"------------------ t1nopackkey.frm"
+TRUNCATE TABLE t1;
+CALL test_pack_key();
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` uuid DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+PackKey
+NOT PACKED
+DROP TABLE t1;
+DROP PROCEDURE test_pack_key;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test
new file mode 100644
index 00000000000..7526d344fc3
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test
@@ -0,0 +1,61 @@
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+
+SET default_storage_engine=MyISAM;
+--source type_uuid_engines.inc
+
+--echo #
+--echo # Testing index prefix compression
+--echo #
+
+DELIMITER $$;
+CREATE PROCEDURE test_pack_key()
+BEGIN
+ SHOW CREATE TABLE t1;
+ FOR i IN 0..0x1FFF
+ DO
+ INSERT INTO t1 VALUES (UUID());
+ END FOR;
+ SELECT
+ CASE
+ WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED'
+ WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED'
+ ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH)
+ END AS PackKey
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
+END;
+$$
+DELIMITER ;$$
+
+--echo "------------------ CREATE TABLE"
+CREATE TABLE t1 (a UUID, KEY(a));
+CALL test_pack_key();
+DROP TABLE t1;
+
+--echo "------------------ t1packkey.frm"
+--copy_file $MTR_SUITE_DIR/std_data/t1packkey.frm $MYSQLD_DATADIR/test/t1.frm
+TRUNCATE TABLE t1;
+CALL test_pack_key();
+DROP TABLE t1;
+
+--echo "------------------ t1nopackkey.frm"
+--copy_file $MTR_SUITE_DIR/std_data/t1nopackkey.frm $MYSQLD_DATADIR/test/t1.frm
+TRUNCATE TABLE t1;
+CALL test_pack_key();
+DROP TABLE t1;
+
+
+DROP PROCEDURE test_pack_key;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result
new file mode 100644
index 00000000000..51531e5c0d7
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1 (a UUID);
+Field 1: `a`
+Org_field: `a`
+Catalog: `def`
+Database: `test`
+Table: `t1`
+Org_table: `t1`
+Type: STRING (type=uuid)
+Collation: latin1_swedish_ci (8)
+Length: 36
+Max_length: 0
+Decimals: 0
+Flags: UNSIGNED BINARY
+
+
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test
new file mode 100644
index 00000000000..c9bfadca01b
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test
@@ -0,0 +1,6 @@
+-- source include/have_working_dns.inc
+-- source include/not_embedded.inc
+
+CREATE TABLE t1 (a UUID);
+--exec $MYSQL -t test --column-type-info -e "SELECT * FROM t1" 2>&1
+DROP TABLE t1;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result
new file mode 100644
index 00000000000..82b96002d2e
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result
@@ -0,0 +1,1797 @@
+#
+# MDEV-4958 Adding datatype UUID
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a UUID)
+PARTITION BY LIST COLUMNS(a)
+(PARTITION p00 VALUES IN (10));
+ERROR HY000: Partition column values of incorrect type
+CREATE TABLE t1 (a UUID)
+PARTITION BY LIST COLUMNS(a)
+(PARTITION p00 VALUES IN (TIME'10:20:30'));
+ERROR HY000: Partition column values of incorrect type
+CREATE TABLE t1 (a UUID)
+PARTITION BY LIST COLUMNS(a)
+(PARTITION p00 VALUES IN ('€'));
+ERROR 22007: Incorrect uuid value: '€'
+CREATE TABLE t1 (a UUID)
+PARTITION BY LIST COLUMNS(a)
+(PARTITION p00 VALUES IN ('123e4567-e89b-12d3-a456-426655440000'),
+PARTITION pFF VALUES IN (0xffff000000000000000000000000ffff));
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000');
+INSERT INTO t1 VALUES ('ffff0000-0000-0000-0000-00000000ffff');
+SELECT * FROM t1 PARTITION (p00);
+a
+123e4567-e89b-12d3-a456-426655440000
+SELECT * FROM t1 PARTITION (pFF);
+a
+ffff0000-0000-0000-0000-00000000ffff
+DROP TABLE t1;
+CREATE TABLE t0 (a UUID);
+FOR i IN 0..255
+DO
+INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0')));
+INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+# Test that UUID and BINARY(16) implement the same distribution by key
+CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT)
+BEGIN
+EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+INSERT INTO t1 SELECT * FROM t0;
+INSERT INTO t2 SELECT * FROM t0;
+FOR i IN 0..(parts-1)
+DO
+BEGIN
+DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM ('
+ 'SELECT a AS a_p0 FROM t1 PARTITION(p0) '
+ 'UNION ALL '
+ 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td '
+ 'GROUP BY a_p0';
+DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i));
+SELECT query;
+EXECUTE IMMEDIATE query;
+END;
+END FOR;
+DROP TABLE t1,t2;
+END;
+$$
+# Display statistics how records are distributed between partitions
+CREATE PROCEDURE test_partition_by_key_pstat(parts INT)
+BEGIN
+EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int);
+INSERT INTO t1 SELECT * FROM t0;
+FOR i IN 0..(parts-1)
+DO
+BEGIN
+DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))';
+EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i));
+END;
+END FOR;
+SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED);
+DROP TABLE t1,t1_pstat;
+END;
+$$
+CALL test_partition_by_key_uuid_vs_binary(7);
+query
+SELECT a_p0, COUNT(*) FROM (SELECT a AS a_p0 FROM t1 PARTITION(p0) UNION ALL SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td GROUP BY a_p0
+a_p0 COUNT(*)
+9cfd306d-307f-15ec-8d10-010bbc909b57 2
+9cfd306d-307f-15ec-8d10-080bbc909b57 2
+9cfd306d-307f-15ec-8d10-0d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-250bbc909b57 2
+9cfd306d-307f-15ec-8d10-2b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-300bbc909b57 2
+9cfd306d-307f-15ec-8d10-3c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-480bbc909b57 2
+9cfd306d-307f-15ec-8d10-500bbc909b57 2
+9cfd306d-307f-15ec-8d10-530bbc909b57 2
+9cfd306d-307f-15ec-8d10-560bbc909b57 2
+9cfd306d-307f-15ec-8d10-570bbc909b57 2
+9cfd306d-307f-15ec-8d10-580bbc909b57 2
+9cfd306d-307f-15ec-8d10-630bbc909b57 2
+9cfd306d-307f-15ec-8d10-680bbc909b57 2
+9cfd306d-307f-15ec-8d10-6a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-700bbc909b57 2
+9cfd306d-307f-15ec-8d10-7e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-820bbc909b57 2
+9cfd306d-307f-15ec-8d10-8e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-930bbc909b57 2
+9cfd306d-307f-15ec-8d10-970bbc909b57 2
+9cfd306d-307f-15ec-8d10-980bbc909b57 2
+9cfd306d-307f-15ec-8d10-9b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-9f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-a00bbc909b57 2
+9cfd306d-307f-15ec-8d10-a70bbc909b57 2
+9cfd306d-307f-15ec-8d10-a80bbc909b57 2
+9cfd306d-307f-15ec-8d10-b80bbc909b57 2
+9cfd306d-307f-15ec-8d10-c10bbc909b57 2
+9cfd306d-307f-15ec-8d10-c30bbc909b57 2
+9cfd306d-307f-15ec-8d10-c60bbc909b57 2
+9cfd306d-307f-15ec-8d10-cb0bbc909b57 2
+9cfd306d-307f-15ec-8d10-cf0bbc909b57 2
+9cfd306d-307f-15ec-8d10-d00bbc909b57 2
+9cfd306d-307f-15ec-8d10-d10bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b04 2
+9cfd306d-307f-16ec-8d10-d20bbc909b13 2
+9cfd306d-307f-16ec-8d10-d20bbc909b29 2
+9cfd306d-307f-16ec-8d10-d20bbc909b31 2
+9cfd306d-307f-16ec-8d10-d20bbc909b37 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b45 2
+9cfd306d-307f-16ec-8d10-d20bbc909b51 2
+9cfd306d-307f-16ec-8d10-d20bbc909b56 2
+9cfd306d-307f-14ec-8d05-d20bbc909b57 2
+9cfd306d-307f-14ec-8d07-d20bbc909b57 2
+0bfd306d-307f-11ec-8d10-d20bbc909b57 2
+0dfd306d-307f-11ec-8d10-d20bbc909b57 2
+16fd306d-307f-11ec-8d10-d20bbc909b57 2
+17fd306d-307f-11ec-8d10-d20bbc909b57 2
+19fd306d-307f-11ec-8d10-d20bbc909b57 2
+34fd306d-307f-11ec-8d10-d20bbc909b57 2
+36fd306d-307f-11ec-8d10-d20bbc909b57 2
+48fd306d-307f-11ec-8d10-d20bbc909b57 2
+58fd306d-307f-11ec-8d10-d20bbc909b57 2
+61fd306d-307f-11ec-8d10-d20bbc909b57 2
+76fd306d-307f-11ec-8d10-d20bbc909b57 2
+78fd306d-307f-11ec-8d10-d20bbc909b57 2
+7efd306d-307f-11ec-8d10-d20bbc909b57 2
+7ffd306d-307f-11ec-8d10-d20bbc909b57 2
+85fd306d-307f-11ec-8d10-d20bbc909b57 2
+8ffd306d-307f-11ec-8d10-d20bbc909b57 2
+91fd306d-307f-11ec-8d10-d20bbc909b57 2
+9bfd306d-307f-11ec-8d10-d20bbc909b57 2
+affd306d-307f-11ec-8d10-d20bbc909b57 2
+b2fd306d-307f-11ec-8d10-d20bbc909b57 2
+b3fd306d-307f-11ec-8d10-d20bbc909b57 2
+b4fd306d-307f-11ec-8d10-d20bbc909b57 2
+c3fd306d-307f-11ec-8d10-d20bbc909b57 2
+cdfd306d-307f-11ec-8d10-d20bbc909b57 2
+d0fd306d-307f-11ec-8d10-d20bbc909b57 2
+d3fd306d-307f-11ec-8d10-d20bbc909b57 2
+d4fd306d-307f-11ec-8d10-d20bbc909b57 2
+e4fd306d-307f-11ec-8d10-d20bbc909b57 2
+f3fd306d-307f-11ec-8d10-d20bbc909b57 2
+f6fd306d-307f-11ec-8d10-d20bbc909b57 2
+f7fd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-0e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-177f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-347f-12ec-8d10-d20bbc909b57 2
+9cfd306d-377f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-447f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-527f-12ec-8d10-d20bbc909b57 2
+9cfd306d-537f-12ec-8d10-d20bbc909b57 2
+9cfd306d-547f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-727f-12ec-8d10-d20bbc909b57 2
+9cfd306d-787f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-807f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-977f-12ec-8d10-d20bbc909b57 2
+9cfd306d-987f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ac7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-bb7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-fd7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-1300-8d10-d20bbc909b57 2
+9cfd306d-307f-1309-8d10-d20bbc909b57 2
+9cfd306d-307f-130b-8d10-d20bbc909b57 2
+9cfd306d-307f-130e-8d10-d20bbc909b57 2
+9cfd306d-307f-1313-8d10-d20bbc909b57 2
+9cfd306d-307f-1329-8d10-d20bbc909b57 2
+9cfd306d-307f-132a-8d10-d20bbc909b57 2
+9cfd306d-307f-1332-8d10-d20bbc909b57 2
+9cfd306d-307f-1336-8d10-d20bbc909b57 2
+9cfd306d-307f-1337-8d10-d20bbc909b57 2
+9cfd306d-307f-133d-8d10-d20bbc909b57 2
+9cfd306d-307f-1340-8d10-d20bbc909b57 2
+9cfd306d-307f-134d-8d10-d20bbc909b57 2
+9cfd306d-307f-1351-8d10-d20bbc909b57 2
+9cfd306d-307f-1363-8d10-d20bbc909b57 2
+9cfd306d-307f-1375-8d10-d20bbc909b57 2
+9cfd306d-307f-137d-8d10-d20bbc909b57 2
+9cfd306d-307f-137e-8d10-d20bbc909b57 2
+9cfd306d-307f-138e-8d10-d20bbc909b57 2
+9cfd306d-307f-139f-8d10-d20bbc909b57 2
+9cfd306d-307f-13a1-8d10-d20bbc909b57 2
+9cfd306d-307f-13a2-8d10-d20bbc909b57 2
+9cfd306d-307f-13b1-8d10-d20bbc909b57 2
+9cfd306d-307f-13b3-8d10-d20bbc909b57 2
+9cfd306d-307f-13b5-8d10-d20bbc909b57 2
+9cfd306d-307f-13bf-8d10-d20bbc909b57 2
+9cfd306d-307f-13d0-8d10-d20bbc909b57 2
+9cfd306d-307f-13db-8d10-d20bbc909b57 2
+9cfd306d-307f-13fe-8d10-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d27-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d30-d20bbc909b57 2
+9cfd306d-307f-14ec-8d33-d20bbc909b57 2
+9cfd306d-307f-14ec-8d36-d20bbc909b57 2
+9cfd306d-307f-14ec-8d38-d20bbc909b57 2
+9cfd306d-307f-14ec-8d40-d20bbc909b57 2
+9cfd306d-307f-14ec-8d42-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d50-d20bbc909b57 2
+9cfd306d-307f-14ec-8d51-d20bbc909b57 2
+9cfd306d-307f-14ec-8d59-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d63-d20bbc909b57 2
+9cfd306d-307f-14ec-8d67-d20bbc909b57 2
+9cfd306d-307f-14ec-8d68-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d75-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d81-d20bbc909b57 2
+9cfd306d-307f-14ec-8d82-d20bbc909b57 2
+9cfd306d-307f-14ec-8d86-d20bbc909b57 2
+9cfd306d-307f-14ec-8d87-d20bbc909b57 2
+9cfd306d-307f-14ec-8d94-d20bbc909b57 2
+9cfd306d-307f-14ec-8d95-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9f-d20bbc909b57 2
+9cfd306d-307f-14ec-8db4-d20bbc909b57 2
+9cfd306d-307f-14ec-8db9-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc6-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd3-d20bbc909b57 2
+9cfd306d-307f-14ec-8de1-d20bbc909b57 2
+9cfd306d-307f-14ec-8de6-d20bbc909b57 2
+9cfd306d-307f-14ec-8dee-d20bbc909b57 2
+9cfd306d-307f-14ec-8df1-d20bbc909b57 2
+9cfd306d-307f-14ec-8df6-d20bbc909b57 2
+9cfd306d-307f-14ec-8df7-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b69 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b72 2
+9cfd306d-307f-16ec-8d10-d20bbc909b78 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b82 2
+9cfd306d-307f-16ec-8d10-d20bbc909b83 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9c 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba2 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bab 2
+9cfd306d-307f-16ec-8d10-d20bbc909bac 2
+9cfd306d-307f-16ec-8d10-d20bbc909bad 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb6 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd4 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bdf 2
+9cfd306d-307f-16ec-8d10-d20bbc909be8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bee 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf0 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf1 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf2 2
+9cfd306d-307f-16ec-8d10-d20bbc909bfb 2
+9cfd306d-307f-16ec-8d10-d20bbc909bff 2
+9cfd306d-307f-15ec-8d10-d40bbc909b57 2
+9cfd306d-307f-15ec-8d10-df0bbc909b57 2
+9cfd306d-307f-15ec-8d10-e40bbc909b57 2
+9cfd306d-307f-15ec-8d10-eb0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ef0bbc909b57 2
+9cfd306d-307f-15ec-8d10-f10bbc909b57 2
+9cfd306d-307f-15ec-8d10-f90bbc909b57 2
+query
+SELECT a_p1, COUNT(*) FROM (SELECT a AS a_p1 FROM t1 PARTITION(p1) UNION ALL SELECT CAST(a AS UUID) AS a_p1 FROM t2 PARTITION(p1)) td GROUP BY a_p1
+a_p1 COUNT(*)
+9cfd306d-307f-15ec-8d10-060bbc909b57 2
+9cfd306d-307f-15ec-8d10-0c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-120bbc909b57 2
+9cfd306d-307f-15ec-8d10-150bbc909b57 2
+9cfd306d-307f-15ec-8d10-1a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-1c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-1d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-1f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-230bbc909b57 2
+9cfd306d-307f-15ec-8d10-2d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-310bbc909b57 2
+9cfd306d-307f-15ec-8d10-3a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-3e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-400bbc909b57 2
+9cfd306d-307f-15ec-8d10-4c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-5e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-5f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-7b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-7d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-8c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-910bbc909b57 2
+9cfd306d-307f-15ec-8d10-920bbc909b57 2
+9cfd306d-307f-15ec-8d10-940bbc909b57 2
+9cfd306d-307f-15ec-8d10-950bbc909b57 2
+9cfd306d-307f-15ec-8d10-9d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-a20bbc909b57 2
+9cfd306d-307f-15ec-8d10-aa0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ac0bbc909b57 2
+9cfd306d-307f-15ec-8d10-af0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ba0bbc909b57 2
+9cfd306d-307f-15ec-8d10-bc0bbc909b57 2
+9cfd306d-307f-15ec-8d10-c50bbc909b57 2
+9cfd306d-307f-15ec-8d10-cc0bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b05 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b34 2
+9cfd306d-307f-16ec-8d10-d20bbc909b35 2
+9cfd306d-307f-16ec-8d10-d20bbc909b42 2
+00fd306d-307f-11ec-8d10-d20bbc909b57 2
+09fd306d-307f-11ec-8d10-d20bbc909b57 2
+10fd306d-307f-11ec-8d10-d20bbc909b57 2
+13fd306d-307f-11ec-8d10-d20bbc909b57 2
+1cfd306d-307f-11ec-8d10-d20bbc909b57 2
+3ffd306d-307f-11ec-8d10-d20bbc909b57 2
+45fd306d-307f-11ec-8d10-d20bbc909b57 2
+4efd306d-307f-11ec-8d10-d20bbc909b57 2
+4ffd306d-307f-11ec-8d10-d20bbc909b57 2
+50fd306d-307f-11ec-8d10-d20bbc909b57 2
+54fd306d-307f-11ec-8d10-d20bbc909b57 2
+55fd306d-307f-11ec-8d10-d20bbc909b57 2
+5bfd306d-307f-11ec-8d10-d20bbc909b57 2
+5ffd306d-307f-11ec-8d10-d20bbc909b57 2
+6ffd306d-307f-11ec-8d10-d20bbc909b57 2
+73fd306d-307f-11ec-8d10-d20bbc909b57 2
+89fd306d-307f-11ec-8d10-d20bbc909b57 2
+8cfd306d-307f-11ec-8d10-d20bbc909b57 2
+8dfd306d-307f-11ec-8d10-d20bbc909b57 2
+93fd306d-307f-11ec-8d10-d20bbc909b57 2
+94fd306d-307f-11ec-8d10-d20bbc909b57 2
+9efd306d-307f-11ec-8d10-d20bbc909b57 2
+aefd306d-307f-11ec-8d10-d20bbc909b57 2
+b0fd306d-307f-11ec-8d10-d20bbc909b57 2
+c2fd306d-307f-11ec-8d10-d20bbc909b57 2
+cbfd306d-307f-11ec-8d10-d20bbc909b57 2
+ddfd306d-307f-11ec-8d10-d20bbc909b57 2
+defd306d-307f-11ec-8d10-d20bbc909b57 2
+e5fd306d-307f-11ec-8d10-d20bbc909b57 2
+e6fd306d-307f-11ec-8d10-d20bbc909b57 2
+edfd306d-307f-11ec-8d10-d20bbc909b57 2
+f9fd306d-307f-11ec-8d10-d20bbc909b57 2
+fafd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-007f-12ec-8d10-d20bbc909b57 2
+9cfd306d-037f-12ec-8d10-d20bbc909b57 2
+9cfd306d-047f-12ec-8d10-d20bbc909b57 2
+9cfd306d-057f-12ec-8d10-d20bbc909b57 2
+9cfd306d-0a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-0b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-117f-12ec-8d10-d20bbc909b57 2
+9cfd306d-127f-12ec-8d10-d20bbc909b57 2
+9cfd306d-1a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-207f-12ec-8d10-d20bbc909b57 2
+9cfd306d-227f-12ec-8d10-d20bbc909b57 2
+9cfd306d-247f-12ec-8d10-d20bbc909b57 2
+9cfd306d-277f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-12ec-8d10-d20bbc909b57 2
+9cfd306d-317f-12ec-8d10-d20bbc909b57 2
+9cfd306d-357f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-407f-12ec-8d10-d20bbc909b57 2
+9cfd306d-437f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-657f-12ec-8d10-d20bbc909b57 2
+9cfd306d-747f-12ec-8d10-d20bbc909b57 2
+9cfd306d-817f-12ec-8d10-d20bbc909b57 2
+9cfd306d-927f-12ec-8d10-d20bbc909b57 2
+9cfd306d-967f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-bd7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-dd7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ea7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-1314-8d10-d20bbc909b57 2
+9cfd306d-307f-1319-8d10-d20bbc909b57 2
+9cfd306d-307f-131e-8d10-d20bbc909b57 2
+9cfd306d-307f-1325-8d10-d20bbc909b57 2
+9cfd306d-307f-132d-8d10-d20bbc909b57 2
+9cfd306d-307f-132e-8d10-d20bbc909b57 2
+9cfd306d-307f-1330-8d10-d20bbc909b57 2
+9cfd306d-307f-1335-8d10-d20bbc909b57 2
+9cfd306d-307f-1339-8d10-d20bbc909b57 2
+9cfd306d-307f-1341-8d10-d20bbc909b57 2
+9cfd306d-307f-1345-8d10-d20bbc909b57 2
+9cfd306d-307f-1355-8d10-d20bbc909b57 2
+9cfd306d-307f-135a-8d10-d20bbc909b57 2
+9cfd306d-307f-135b-8d10-d20bbc909b57 2
+9cfd306d-307f-135c-8d10-d20bbc909b57 2
+9cfd306d-307f-1379-8d10-d20bbc909b57 2
+9cfd306d-307f-137f-8d10-d20bbc909b57 2
+9cfd306d-307f-1383-8d10-d20bbc909b57 2
+9cfd306d-307f-1388-8d10-d20bbc909b57 2
+9cfd306d-307f-1389-8d10-d20bbc909b57 2
+9cfd306d-307f-138c-8d10-d20bbc909b57 2
+9cfd306d-307f-138d-8d10-d20bbc909b57 2
+9cfd306d-307f-138f-8d10-d20bbc909b57 2
+9cfd306d-307f-1390-8d10-d20bbc909b57 2
+9cfd306d-307f-1391-8d10-d20bbc909b57 2
+9cfd306d-307f-139c-8d10-d20bbc909b57 2
+9cfd306d-307f-13a3-8d10-d20bbc909b57 2
+9cfd306d-307f-13aa-8d10-d20bbc909b57 2
+9cfd306d-307f-13ab-8d10-d20bbc909b57 2
+9cfd306d-307f-13af-8d10-d20bbc909b57 2
+9cfd306d-307f-13b4-8d10-d20bbc909b57 2
+9cfd306d-307f-13bc-8d10-d20bbc909b57 2
+9cfd306d-307f-13be-8d10-d20bbc909b57 2
+9cfd306d-307f-13c2-8d10-d20bbc909b57 2
+9cfd306d-307f-13c8-8d10-d20bbc909b57 2
+9cfd306d-307f-13cf-8d10-d20bbc909b57 2
+9cfd306d-307f-13e0-8d10-d20bbc909b57 2
+9cfd306d-307f-13e7-8d10-d20bbc909b57 2
+9cfd306d-307f-13fa-8d10-d20bbc909b57 2
+9cfd306d-307f-15ec-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d11-d20bbc909b57 2
+9cfd306d-307f-14ec-8d17-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d37-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d45-d20bbc909b57 2
+9cfd306d-307f-14ec-8d47-d20bbc909b57 2
+9cfd306d-307f-14ec-8d49-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d57-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d78-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d88-d20bbc909b57 2
+9cfd306d-307f-14ec-8d89-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d92-d20bbc909b57 2
+9cfd306d-307f-14ec-8d97-d20bbc909b57 2
+9cfd306d-307f-14ec-8da0-d20bbc909b57 2
+9cfd306d-307f-14ec-8da3-d20bbc909b57 2
+9cfd306d-307f-14ec-8da5-d20bbc909b57 2
+9cfd306d-307f-14ec-8daa-d20bbc909b57 2
+9cfd306d-307f-14ec-8db5-d20bbc909b57 2
+9cfd306d-307f-14ec-8dcc-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd1-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd6-d20bbc909b57 2
+9cfd306d-307f-14ec-8dda-d20bbc909b57 2
+9cfd306d-307f-14ec-8ddd-d20bbc909b57 2
+9cfd306d-307f-14ec-8df9-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b65 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b73 2
+9cfd306d-307f-16ec-8d10-d20bbc909b80 2
+9cfd306d-307f-16ec-8d10-d20bbc909b86 2
+9cfd306d-307f-16ec-8d10-d20bbc909b87 2
+9cfd306d-307f-16ec-8d10-d20bbc909b89 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8e 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bae 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb0 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb1 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb7 2
+9cfd306d-307f-16ec-8d10-d20bbc909bbb 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc6 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bca 2
+9cfd306d-307f-16ec-8d10-d20bbc909bcf 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bfc 2
+9cfd306d-307f-15ec-8d10-d30bbc909b57 2
+9cfd306d-307f-15ec-8d10-dc0bbc909b57 2
+9cfd306d-307f-15ec-8d10-e30bbc909b57 2
+9cfd306d-307f-15ec-8d10-e80bbc909b57 2
+9cfd306d-307f-15ec-8d10-ed0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ee0bbc909b57 2
+query
+SELECT a_p2, COUNT(*) FROM (SELECT a AS a_p2 FROM t1 PARTITION(p2) UNION ALL SELECT CAST(a AS UUID) AS a_p2 FROM t2 PARTITION(p2)) td GROUP BY a_p2
+a_p2 COUNT(*)
+9cfd306d-307f-15ec-8d10-040bbc909b57 2
+9cfd306d-307f-15ec-8d10-0f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-100bbc909b57 2
+9cfd306d-307f-15ec-8d10-110bbc909b57 2
+9cfd306d-307f-15ec-8d10-130bbc909b57 2
+9cfd306d-307f-15ec-8d10-180bbc909b57 2
+9cfd306d-307f-15ec-8d10-1e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-320bbc909b57 2
+9cfd306d-307f-15ec-8d10-330bbc909b57 2
+9cfd306d-307f-15ec-8d10-430bbc909b57 2
+9cfd306d-307f-15ec-8d10-460bbc909b57 2
+9cfd306d-307f-15ec-8d10-520bbc909b57 2
+9cfd306d-307f-15ec-8d10-650bbc909b57 2
+9cfd306d-307f-15ec-8d10-660bbc909b57 2
+9cfd306d-307f-15ec-8d10-6e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-750bbc909b57 2
+9cfd306d-307f-15ec-8d10-780bbc909b57 2
+9cfd306d-307f-15ec-8d10-790bbc909b57 2
+9cfd306d-307f-15ec-8d10-830bbc909b57 2
+9cfd306d-307f-15ec-8d10-8f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-900bbc909b57 2
+9cfd306d-307f-15ec-8d10-9a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-9c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-a40bbc909b57 2
+9cfd306d-307f-15ec-8d10-c00bbc909b57 2
+9cfd306d-307f-15ec-8d10-c20bbc909b57 2
+9cfd306d-307f-15ec-8d10-c40bbc909b57 2
+9cfd306d-307f-15ec-8d10-cd0bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b02 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b16 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b26 2
+9cfd306d-307f-16ec-8d10-d20bbc909b27 2
+9cfd306d-307f-16ec-8d10-d20bbc909b38 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b43 2
+9cfd306d-307f-16ec-8d10-d20bbc909b46 2
+9cfd306d-307f-16ec-8d10-d20bbc909b47 2
+9cfd306d-307f-16ec-8d10-d20bbc909b49 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4f 2
+9cfd306d-307f-14ec-8d01-d20bbc909b57 2
+9cfd306d-307f-14ec-8d06-d20bbc909b57 2
+9cfd306d-307f-14ec-8d0a-d20bbc909b57 2
+02fd306d-307f-11ec-8d10-d20bbc909b57 2
+07fd306d-307f-11ec-8d10-d20bbc909b57 2
+08fd306d-307f-11ec-8d10-d20bbc909b57 2
+0efd306d-307f-11ec-8d10-d20bbc909b57 2
+1afd306d-307f-11ec-8d10-d20bbc909b57 2
+20fd306d-307f-11ec-8d10-d20bbc909b57 2
+25fd306d-307f-11ec-8d10-d20bbc909b57 2
+26fd306d-307f-11ec-8d10-d20bbc909b57 2
+2afd306d-307f-11ec-8d10-d20bbc909b57 2
+2dfd306d-307f-11ec-8d10-d20bbc909b57 2
+32fd306d-307f-11ec-8d10-d20bbc909b57 2
+33fd306d-307f-11ec-8d10-d20bbc909b57 2
+3dfd306d-307f-11ec-8d10-d20bbc909b57 2
+42fd306d-307f-11ec-8d10-d20bbc909b57 2
+46fd306d-307f-11ec-8d10-d20bbc909b57 2
+4bfd306d-307f-11ec-8d10-d20bbc909b57 2
+53fd306d-307f-11ec-8d10-d20bbc909b57 2
+5afd306d-307f-11ec-8d10-d20bbc909b57 2
+65fd306d-307f-11ec-8d10-d20bbc909b57 2
+69fd306d-307f-11ec-8d10-d20bbc909b57 2
+6bfd306d-307f-11ec-8d10-d20bbc909b57 2
+7cfd306d-307f-11ec-8d10-d20bbc909b57 2
+82fd306d-307f-11ec-8d10-d20bbc909b57 2
+86fd306d-307f-11ec-8d10-d20bbc909b57 2
+99fd306d-307f-11ec-8d10-d20bbc909b57 2
+9afd306d-307f-11ec-8d10-d20bbc909b57 2
+a3fd306d-307f-11ec-8d10-d20bbc909b57 2
+aafd306d-307f-11ec-8d10-d20bbc909b57 2
+ccfd306d-307f-11ec-8d10-d20bbc909b57 2
+d5fd306d-307f-11ec-8d10-d20bbc909b57 2
+dcfd306d-307f-11ec-8d10-d20bbc909b57 2
+e0fd306d-307f-11ec-8d10-d20bbc909b57 2
+f0fd306d-307f-11ec-8d10-d20bbc909b57 2
+f1fd306d-307f-11ec-8d10-d20bbc909b57 2
+f4fd306d-307f-11ec-8d10-d20bbc909b57 2
+f8fd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-097f-12ec-8d10-d20bbc909b57 2
+9cfd306d-137f-12ec-8d10-d20bbc909b57 2
+9cfd306d-267f-12ec-8d10-d20bbc909b57 2
+9cfd306d-297f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-757f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-867f-12ec-8d10-d20bbc909b57 2
+9cfd306d-897f-12ec-8d10-d20bbc909b57 2
+9cfd306d-907f-12ec-8d10-d20bbc909b57 2
+9cfd306d-937f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ab7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-da7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-eb7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ec7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ff7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-131c-8d10-d20bbc909b57 2
+9cfd306d-307f-1320-8d10-d20bbc909b57 2
+9cfd306d-307f-1321-8d10-d20bbc909b57 2
+9cfd306d-307f-1327-8d10-d20bbc909b57 2
+9cfd306d-307f-1331-8d10-d20bbc909b57 2
+9cfd306d-307f-1338-8d10-d20bbc909b57 2
+9cfd306d-307f-133a-8d10-d20bbc909b57 2
+9cfd306d-307f-133b-8d10-d20bbc909b57 2
+9cfd306d-307f-133e-8d10-d20bbc909b57 2
+9cfd306d-307f-1356-8d10-d20bbc909b57 2
+9cfd306d-307f-135e-8d10-d20bbc909b57 2
+9cfd306d-307f-1361-8d10-d20bbc909b57 2
+9cfd306d-307f-1368-8d10-d20bbc909b57 2
+9cfd306d-307f-136a-8d10-d20bbc909b57 2
+9cfd306d-307f-136c-8d10-d20bbc909b57 2
+9cfd306d-307f-136e-8d10-d20bbc909b57 2
+9cfd306d-307f-136f-8d10-d20bbc909b57 2
+9cfd306d-307f-1372-8d10-d20bbc909b57 2
+9cfd306d-307f-1376-8d10-d20bbc909b57 2
+9cfd306d-307f-1381-8d10-d20bbc909b57 2
+9cfd306d-307f-1382-8d10-d20bbc909b57 2
+9cfd306d-307f-1385-8d10-d20bbc909b57 2
+9cfd306d-307f-1386-8d10-d20bbc909b57 2
+9cfd306d-307f-1387-8d10-d20bbc909b57 2
+9cfd306d-307f-138a-8d10-d20bbc909b57 2
+9cfd306d-307f-1394-8d10-d20bbc909b57 2
+9cfd306d-307f-1398-8d10-d20bbc909b57 2
+9cfd306d-307f-13a6-8d10-d20bbc909b57 2
+9cfd306d-307f-13a7-8d10-d20bbc909b57 2
+9cfd306d-307f-13b0-8d10-d20bbc909b57 2
+9cfd306d-307f-13b8-8d10-d20bbc909b57 2
+9cfd306d-307f-13ba-8d10-d20bbc909b57 2
+9cfd306d-307f-13bb-8d10-d20bbc909b57 2
+9cfd306d-307f-13c0-8d10-d20bbc909b57 2
+9cfd306d-307f-13ca-8d10-d20bbc909b57 2
+9cfd306d-307f-13ce-8d10-d20bbc909b57 2
+9cfd306d-307f-13d1-8d10-d20bbc909b57 2
+9cfd306d-307f-13d3-8d10-d20bbc909b57 2
+9cfd306d-307f-13d6-8d10-d20bbc909b57 2
+9cfd306d-307f-13d8-8d10-d20bbc909b57 2
+9cfd306d-307f-13df-8d10-d20bbc909b57 2
+9cfd306d-307f-13e9-8d10-d20bbc909b57 2
+9cfd306d-307f-13eb-8d10-d20bbc909b57 2
+9cfd306d-307f-13f5-8d10-d20bbc909b57 2
+9cfd306d-307f-13f7-8d10-d20bbc909b57 2
+9cfd306d-307f-13f9-8d10-d20bbc909b57 2
+9cfd306d-307f-13fb-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d31-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d44-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d61-d20bbc909b57 2
+9cfd306d-307f-14ec-8d76-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d96-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9b-d20bbc909b57 2
+9cfd306d-307f-14ec-8da6-d20bbc909b57 2
+9cfd306d-307f-14ec-8dab-d20bbc909b57 2
+9cfd306d-307f-14ec-8dad-d20bbc909b57 2
+9cfd306d-307f-14ec-8dba-d20bbc909b57 2
+9cfd306d-307f-14ec-8dbd-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc5-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc7-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd4-d20bbc909b57 2
+9cfd306d-307f-14ec-8de5-d20bbc909b57 2
+9cfd306d-307f-14ec-8de8-d20bbc909b57 2
+9cfd306d-307f-14ec-8de9-d20bbc909b57 2
+9cfd306d-307f-14ec-8def-d20bbc909b57 2
+9cfd306d-307f-14ec-8df8-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b58 2
+9cfd306d-307f-16ec-8d10-d20bbc909b62 2
+9cfd306d-307f-16ec-8d10-d20bbc909b63 2
+9cfd306d-307f-16ec-8d10-d20bbc909b70 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b81 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b94 2
+9cfd306d-307f-16ec-8d10-d20bbc909b95 2
+9cfd306d-307f-16ec-8d10-d20bbc909b96 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9f 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba7 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb4 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb5 2
+9cfd306d-307f-16ec-8d10-d20bbc909bbc 2
+9cfd306d-307f-16ec-8d10-d20bbc909bbf 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc7 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd2 2
+9cfd306d-307f-16ec-8d10-d20bbc909bdd 2
+9cfd306d-307f-16ec-8d10-d20bbc909be0 2
+9cfd306d-307f-16ec-8d10-d20bbc909be1 2
+9cfd306d-307f-16ec-8d10-d20bbc909be6 2
+9cfd306d-307f-16ec-8d10-d20bbc909bec 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bfa 2
+9cfd306d-307f-15ec-8d10-e20bbc909b57 2
+9cfd306d-307f-15ec-8d10-ec0bbc909b57 2
+9cfd306d-307f-15ec-8d10-f70bbc909b57 2
+9cfd306d-307f-15ec-8d10-fb0bbc909b57 2
+query
+SELECT a_p3, COUNT(*) FROM (SELECT a AS a_p3 FROM t1 PARTITION(p3) UNION ALL SELECT CAST(a AS UUID) AS a_p3 FROM t2 PARTITION(p3)) td GROUP BY a_p3
+a_p3 COUNT(*)
+9cfd306d-307f-15ec-8d10-090bbc909b57 2
+9cfd306d-307f-15ec-8d10-190bbc909b57 2
+9cfd306d-307f-15ec-8d10-240bbc909b57 2
+9cfd306d-307f-15ec-8d10-260bbc909b57 2
+9cfd306d-307f-15ec-8d10-270bbc909b57 2
+9cfd306d-307f-15ec-8d10-470bbc909b57 2
+9cfd306d-307f-15ec-8d10-490bbc909b57 2
+9cfd306d-307f-15ec-8d10-510bbc909b57 2
+9cfd306d-307f-15ec-8d10-5a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-5d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-640bbc909b57 2
+9cfd306d-307f-15ec-8d10-740bbc909b57 2
+9cfd306d-307f-15ec-8d10-770bbc909b57 2
+9cfd306d-307f-15ec-8d10-840bbc909b57 2
+9cfd306d-307f-15ec-8d10-860bbc909b57 2
+9cfd306d-307f-15ec-8d10-880bbc909b57 2
+9cfd306d-307f-15ec-8d10-8b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-990bbc909b57 2
+9cfd306d-307f-15ec-8d10-ad0bbc909b57 2
+9cfd306d-307f-15ec-8d10-b00bbc909b57 2
+9cfd306d-307f-15ec-8d10-b60bbc909b57 2
+9cfd306d-307f-15ec-8d10-b70bbc909b57 2
+9cfd306d-307f-15ec-8d10-c70bbc909b57 2
+9cfd306d-307f-15ec-8d10-ca0bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b03 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b10 2
+9cfd306d-307f-16ec-8d10-d20bbc909b11 2
+9cfd306d-307f-16ec-8d10-d20bbc909b17 2
+9cfd306d-307f-16ec-8d10-d20bbc909b19 2
+9cfd306d-307f-16ec-8d10-d20bbc909b22 2
+9cfd306d-307f-16ec-8d10-d20bbc909b24 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b40 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b54 2
+9cfd306d-307f-16ec-8d10-d20bbc909b55 2
+9cfd306d-307f-14ec-8d02-d20bbc909b57 2
+03fd306d-307f-11ec-8d10-d20bbc909b57 2
+04fd306d-307f-11ec-8d10-d20bbc909b57 2
+11fd306d-307f-11ec-8d10-d20bbc909b57 2
+14fd306d-307f-11ec-8d10-d20bbc909b57 2
+1bfd306d-307f-11ec-8d10-d20bbc909b57 2
+21fd306d-307f-11ec-8d10-d20bbc909b57 2
+29fd306d-307f-11ec-8d10-d20bbc909b57 2
+2bfd306d-307f-11ec-8d10-d20bbc909b57 2
+38fd306d-307f-11ec-8d10-d20bbc909b57 2
+3bfd306d-307f-11ec-8d10-d20bbc909b57 2
+3efd306d-307f-11ec-8d10-d20bbc909b57 2
+51fd306d-307f-11ec-8d10-d20bbc909b57 2
+52fd306d-307f-11ec-8d10-d20bbc909b57 2
+5cfd306d-307f-11ec-8d10-d20bbc909b57 2
+60fd306d-307f-11ec-8d10-d20bbc909b57 2
+62fd306d-307f-11ec-8d10-d20bbc909b57 2
+66fd306d-307f-11ec-8d10-d20bbc909b57 2
+6efd306d-307f-11ec-8d10-d20bbc909b57 2
+75fd306d-307f-11ec-8d10-d20bbc909b57 2
+83fd306d-307f-11ec-8d10-d20bbc909b57 2
+97fd306d-307f-11ec-8d10-d20bbc909b57 2
+a1fd306d-307f-11ec-8d10-d20bbc909b57 2
+adfd306d-307f-11ec-8d10-d20bbc909b57 2
+b7fd306d-307f-11ec-8d10-d20bbc909b57 2
+b8fd306d-307f-11ec-8d10-d20bbc909b57 2
+b9fd306d-307f-11ec-8d10-d20bbc909b57 2
+bcfd306d-307f-11ec-8d10-d20bbc909b57 2
+c7fd306d-307f-11ec-8d10-d20bbc909b57 2
+d8fd306d-307f-11ec-8d10-d20bbc909b57 2
+dbfd306d-307f-11ec-8d10-d20bbc909b57 2
+ebfd306d-307f-11ec-8d10-d20bbc909b57 2
+eefd306d-307f-11ec-8d10-d20bbc909b57 2
+fdfd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-077f-12ec-8d10-d20bbc909b57 2
+9cfd306d-087f-12ec-8d10-d20bbc909b57 2
+9cfd306d-0d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-147f-12ec-8d10-d20bbc909b57 2
+9cfd306d-187f-12ec-8d10-d20bbc909b57 2
+9cfd306d-197f-12ec-8d10-d20bbc909b57 2
+9cfd306d-1b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-367f-12ec-8d10-d20bbc909b57 2
+9cfd306d-387f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-467f-12ec-8d10-d20bbc909b57 2
+9cfd306d-517f-12ec-8d10-d20bbc909b57 2
+9cfd306d-587f-12ec-8d10-d20bbc909b57 2
+9cfd306d-617f-12ec-8d10-d20bbc909b57 2
+9cfd306d-667f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-777f-12ec-8d10-d20bbc909b57 2
+9cfd306d-797f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-837f-12ec-8d10-d20bbc909b57 2
+9cfd306d-917f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-aa7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ad7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-bc7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-cb7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-cf7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-df7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-fb7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-fc7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-1304-8d10-d20bbc909b57 2
+9cfd306d-307f-1310-8d10-d20bbc909b57 2
+9cfd306d-307f-1316-8d10-d20bbc909b57 2
+9cfd306d-307f-1317-8d10-d20bbc909b57 2
+9cfd306d-307f-131a-8d10-d20bbc909b57 2
+9cfd306d-307f-131b-8d10-d20bbc909b57 2
+9cfd306d-307f-131f-8d10-d20bbc909b57 2
+9cfd306d-307f-132c-8d10-d20bbc909b57 2
+9cfd306d-307f-134a-8d10-d20bbc909b57 2
+9cfd306d-307f-134c-8d10-d20bbc909b57 2
+9cfd306d-307f-134f-8d10-d20bbc909b57 2
+9cfd306d-307f-1358-8d10-d20bbc909b57 2
+9cfd306d-307f-1360-8d10-d20bbc909b57 2
+9cfd306d-307f-1365-8d10-d20bbc909b57 2
+9cfd306d-307f-1371-8d10-d20bbc909b57 2
+9cfd306d-307f-137a-8d10-d20bbc909b57 2
+9cfd306d-307f-1380-8d10-d20bbc909b57 2
+9cfd306d-307f-1384-8d10-d20bbc909b57 2
+9cfd306d-307f-1393-8d10-d20bbc909b57 2
+9cfd306d-307f-1395-8d10-d20bbc909b57 2
+9cfd306d-307f-139e-8d10-d20bbc909b57 2
+9cfd306d-307f-13a0-8d10-d20bbc909b57 2
+9cfd306d-307f-13a5-8d10-d20bbc909b57 2
+9cfd306d-307f-13a9-8d10-d20bbc909b57 2
+9cfd306d-307f-13ac-8d10-d20bbc909b57 2
+9cfd306d-307f-13ad-8d10-d20bbc909b57 2
+9cfd306d-307f-13c3-8d10-d20bbc909b57 2
+9cfd306d-307f-13cb-8d10-d20bbc909b57 2
+9cfd306d-307f-13d9-8d10-d20bbc909b57 2
+9cfd306d-307f-13dc-8d10-d20bbc909b57 2
+9cfd306d-307f-13e2-8d10-d20bbc909b57 2
+9cfd306d-307f-13e5-8d10-d20bbc909b57 2
+9cfd306d-307f-13ef-8d10-d20bbc909b57 2
+9cfd306d-307f-13f1-8d10-d20bbc909b57 2
+9cfd306d-307f-13f6-8d10-d20bbc909b57 2
+9cfd306d-307f-13fc-8d10-d20bbc909b57 2
+9cfd306d-307f-13fd-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d14-d20bbc909b57 2
+9cfd306d-307f-14ec-8d19-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d23-d20bbc909b57 2
+9cfd306d-307f-14ec-8d26-d20bbc909b57 2
+9cfd306d-307f-14ec-8d28-d20bbc909b57 2
+9cfd306d-307f-14ec-8d35-d20bbc909b57 2
+9cfd306d-307f-14ec-8d39-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d4b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d56-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d66-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d6f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d93-d20bbc909b57 2
+9cfd306d-307f-14ec-8dac-d20bbc909b57 2
+9cfd306d-307f-14ec-8daf-d20bbc909b57 2
+9cfd306d-307f-14ec-8db7-d20bbc909b57 2
+9cfd306d-307f-14ec-8dbb-d20bbc909b57 2
+9cfd306d-307f-14ec-8dbe-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc2-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd7-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd9-d20bbc909b57 2
+9cfd306d-307f-14ec-8de7-d20bbc909b57 2
+9cfd306d-307f-14ec-8dea-d20bbc909b57 2
+9cfd306d-307f-14ec-8deb-d20bbc909b57 2
+9cfd306d-307f-14ec-8df5-d20bbc909b57 2
+9cfd306d-307f-14ec-8dfc-d20bbc909b57 2
+9cfd306d-307f-14ec-8dff-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b68 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b71 2
+9cfd306d-307f-16ec-8d10-d20bbc909b79 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b92 2
+9cfd306d-307f-16ec-8d10-d20bbc909b97 2
+9cfd306d-307f-16ec-8d10-d20bbc909b99 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9a 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba6 2
+9cfd306d-307f-16ec-8d10-d20bbc909baa 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bba 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc2 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc4 2
+9cfd306d-307f-16ec-8d10-d20bbc909bcd 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd6 2
+9cfd306d-307f-16ec-8d10-d20bbc909bde 2
+9cfd306d-307f-16ec-8d10-d20bbc909beb 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf6 2
+9cfd306d-307f-16ec-8d10-d20bbc909bfe 2
+9cfd306d-307f-15ec-8d10-d70bbc909b57 2
+9cfd306d-307f-15ec-8d10-d80bbc909b57 2
+9cfd306d-307f-15ec-8d10-dd0bbc909b57 2
+9cfd306d-307f-15ec-8d10-de0bbc909b57 2
+9cfd306d-307f-15ec-8d10-e00bbc909b57 2
+9cfd306d-307f-15ec-8d10-ea0bbc909b57 2
+9cfd306d-307f-15ec-8d10-f60bbc909b57 2
+9cfd306d-307f-15ec-8d10-fa0bbc909b57 2
+9cfd306d-307f-15ec-8d10-fd0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ff0bbc909b57 2
+query
+SELECT a_p4, COUNT(*) FROM (SELECT a AS a_p4 FROM t1 PARTITION(p4) UNION ALL SELECT CAST(a AS UUID) AS a_p4 FROM t2 PARTITION(p4)) td GROUP BY a_p4
+a_p4 COUNT(*)
+9cfd306d-307f-15ec-8d10-000bbc909b57 2
+9cfd306d-307f-15ec-8d10-020bbc909b57 2
+9cfd306d-307f-15ec-8d10-030bbc909b57 2
+9cfd306d-307f-15ec-8d10-050bbc909b57 2
+9cfd306d-307f-15ec-8d10-220bbc909b57 2
+9cfd306d-307f-15ec-8d10-2c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-340bbc909b57 2
+9cfd306d-307f-15ec-8d10-370bbc909b57 2
+9cfd306d-307f-15ec-8d10-380bbc909b57 2
+9cfd306d-307f-15ec-8d10-3d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-440bbc909b57 2
+9cfd306d-307f-15ec-8d10-4a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-4d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-4f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-5c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-610bbc909b57 2
+9cfd306d-307f-15ec-8d10-6c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-6d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-6f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-710bbc909b57 2
+9cfd306d-307f-15ec-8d10-7c0bbc909b57 2
+9cfd306d-307f-15ec-8d10-800bbc909b57 2
+9cfd306d-307f-15ec-8d10-850bbc909b57 2
+9cfd306d-307f-15ec-8d10-890bbc909b57 2
+9cfd306d-307f-15ec-8d10-a50bbc909b57 2
+9cfd306d-307f-15ec-8d10-a90bbc909b57 2
+9cfd306d-307f-15ec-8d10-c90bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b00 2
+9cfd306d-307f-16ec-8d10-d20bbc909b06 2
+9cfd306d-307f-16ec-8d10-d20bbc909b07 2
+9cfd306d-307f-16ec-8d10-d20bbc909b09 2
+9cfd306d-307f-16ec-8d10-d20bbc909b14 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b25 2
+9cfd306d-307f-16ec-8d10-d20bbc909b28 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b32 2
+9cfd306d-307f-16ec-8d10-d20bbc909b41 2
+9cfd306d-307f-16ec-8d10-d20bbc909b50 2
+9cfd306d-307f-16ec-8d10-d20bbc909b52 2
+9cfd306d-307f-14ec-8d0f-d20bbc909b57 2
+0ffd306d-307f-11ec-8d10-d20bbc909b57 2
+15fd306d-307f-11ec-8d10-d20bbc909b57 2
+1dfd306d-307f-11ec-8d10-d20bbc909b57 2
+23fd306d-307f-11ec-8d10-d20bbc909b57 2
+24fd306d-307f-11ec-8d10-d20bbc909b57 2
+28fd306d-307f-11ec-8d10-d20bbc909b57 2
+2cfd306d-307f-11ec-8d10-d20bbc909b57 2
+2ffd306d-307f-11ec-8d10-d20bbc909b57 2
+35fd306d-307f-11ec-8d10-d20bbc909b57 2
+37fd306d-307f-11ec-8d10-d20bbc909b57 2
+43fd306d-307f-11ec-8d10-d20bbc909b57 2
+44fd306d-307f-11ec-8d10-d20bbc909b57 2
+49fd306d-307f-11ec-8d10-d20bbc909b57 2
+4dfd306d-307f-11ec-8d10-d20bbc909b57 2
+59fd306d-307f-11ec-8d10-d20bbc909b57 2
+63fd306d-307f-11ec-8d10-d20bbc909b57 2
+64fd306d-307f-11ec-8d10-d20bbc909b57 2
+67fd306d-307f-11ec-8d10-d20bbc909b57 2
+6afd306d-307f-11ec-8d10-d20bbc909b57 2
+70fd306d-307f-11ec-8d10-d20bbc909b57 2
+72fd306d-307f-11ec-8d10-d20bbc909b57 2
+79fd306d-307f-11ec-8d10-d20bbc909b57 2
+7afd306d-307f-11ec-8d10-d20bbc909b57 2
+81fd306d-307f-11ec-8d10-d20bbc909b57 2
+8afd306d-307f-11ec-8d10-d20bbc909b57 2
+8bfd306d-307f-11ec-8d10-d20bbc909b57 2
+96fd306d-307f-11ec-8d10-d20bbc909b57 2
+98fd306d-307f-11ec-8d10-d20bbc909b57 2
+a6fd306d-307f-11ec-8d10-d20bbc909b57 2
+abfd306d-307f-11ec-8d10-d20bbc909b57 2
+acfd306d-307f-11ec-8d10-d20bbc909b57 2
+b1fd306d-307f-11ec-8d10-d20bbc909b57 2
+b5fd306d-307f-11ec-8d10-d20bbc909b57 2
+bbfd306d-307f-11ec-8d10-d20bbc909b57 2
+bdfd306d-307f-11ec-8d10-d20bbc909b57 2
+bffd306d-307f-11ec-8d10-d20bbc909b57 2
+c0fd306d-307f-11ec-8d10-d20bbc909b57 2
+c4fd306d-307f-11ec-8d10-d20bbc909b57 2
+c6fd306d-307f-11ec-8d10-d20bbc909b57 2
+c9fd306d-307f-11ec-8d10-d20bbc909b57 2
+d1fd306d-307f-11ec-8d10-d20bbc909b57 2
+d6fd306d-307f-11ec-8d10-d20bbc909b57 2
+d9fd306d-307f-11ec-8d10-d20bbc909b57 2
+dafd306d-307f-11ec-8d10-d20bbc909b57 2
+e8fd306d-307f-11ec-8d10-d20bbc909b57 2
+eafd306d-307f-11ec-8d10-d20bbc909b57 2
+effd306d-307f-11ec-8d10-d20bbc909b57 2
+f5fd306d-307f-11ec-8d10-d20bbc909b57 2
+fbfd306d-307f-11ec-8d10-d20bbc909b57 2
+fcfd306d-307f-11ec-8d10-d20bbc909b57 2
+fefd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-017f-12ec-8d10-d20bbc909b57 2
+9cfd306d-067f-12ec-8d10-d20bbc909b57 2
+9cfd306d-0f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-107f-12ec-8d10-d20bbc909b57 2
+9cfd306d-167f-12ec-8d10-d20bbc909b57 2
+9cfd306d-1c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-217f-12ec-8d10-d20bbc909b57 2
+9cfd306d-237f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-327f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-417f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-4e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-507f-12ec-8d10-d20bbc909b57 2
+9cfd306d-597f-12ec-8d10-d20bbc909b57 2
+9cfd306d-607f-12ec-8d10-d20bbc909b57 2
+9cfd306d-627f-12ec-8d10-d20bbc909b57 2
+9cfd306d-637f-12ec-8d10-d20bbc909b57 2
+9cfd306d-677f-12ec-8d10-d20bbc909b57 2
+9cfd306d-697f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-737f-12ec-8d10-d20bbc909b57 2
+9cfd306d-767f-12ec-8d10-d20bbc909b57 2
+9cfd306d-7c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-827f-12ec-8d10-d20bbc909b57 2
+9cfd306d-847f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-997f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-af7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ba7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-be7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ce7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-db7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ee7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-fa7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-fe7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-1302-8d10-d20bbc909b57 2
+9cfd306d-307f-1303-8d10-d20bbc909b57 2
+9cfd306d-307f-1308-8d10-d20bbc909b57 2
+9cfd306d-307f-130d-8d10-d20bbc909b57 2
+9cfd306d-307f-130f-8d10-d20bbc909b57 2
+9cfd306d-307f-1311-8d10-d20bbc909b57 2
+9cfd306d-307f-1315-8d10-d20bbc909b57 2
+9cfd306d-307f-1318-8d10-d20bbc909b57 2
+9cfd306d-307f-1326-8d10-d20bbc909b57 2
+9cfd306d-307f-132f-8d10-d20bbc909b57 2
+9cfd306d-307f-1333-8d10-d20bbc909b57 2
+9cfd306d-307f-1342-8d10-d20bbc909b57 2
+9cfd306d-307f-1344-8d10-d20bbc909b57 2
+9cfd306d-307f-134b-8d10-d20bbc909b57 2
+9cfd306d-307f-134e-8d10-d20bbc909b57 2
+9cfd306d-307f-1350-8d10-d20bbc909b57 2
+9cfd306d-307f-1354-8d10-d20bbc909b57 2
+9cfd306d-307f-1357-8d10-d20bbc909b57 2
+9cfd306d-307f-1369-8d10-d20bbc909b57 2
+9cfd306d-307f-1370-8d10-d20bbc909b57 2
+9cfd306d-307f-1373-8d10-d20bbc909b57 2
+9cfd306d-307f-1378-8d10-d20bbc909b57 2
+9cfd306d-307f-1392-8d10-d20bbc909b57 2
+9cfd306d-307f-1397-8d10-d20bbc909b57 2
+9cfd306d-307f-139a-8d10-d20bbc909b57 2
+9cfd306d-307f-139d-8d10-d20bbc909b57 2
+9cfd306d-307f-13b2-8d10-d20bbc909b57 2
+9cfd306d-307f-13b7-8d10-d20bbc909b57 2
+9cfd306d-307f-13b9-8d10-d20bbc909b57 2
+9cfd306d-307f-13c1-8d10-d20bbc909b57 2
+9cfd306d-307f-13d2-8d10-d20bbc909b57 2
+9cfd306d-307f-13e3-8d10-d20bbc909b57 2
+9cfd306d-307f-13e8-8d10-d20bbc909b57 2
+9cfd306d-307f-13f0-8d10-d20bbc909b57 2
+9cfd306d-307f-13f2-8d10-d20bbc909b57 2
+9cfd306d-307f-13ff-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d13-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d24-d20bbc909b57 2
+9cfd306d-307f-14ec-8d29-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2e-d20bbc909b57 2
+9cfd306d-307f-14ec-8d2f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d34-d20bbc909b57 2
+9cfd306d-307f-14ec-8d3a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d41-d20bbc909b57 2
+9cfd306d-307f-14ec-8d46-d20bbc909b57 2
+9cfd306d-307f-14ec-8d55-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d60-d20bbc909b57 2
+9cfd306d-307f-14ec-8d69-d20bbc909b57 2
+9cfd306d-307f-14ec-8d70-d20bbc909b57 2
+9cfd306d-307f-14ec-8d73-d20bbc909b57 2
+9cfd306d-307f-14ec-8d77-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d80-d20bbc909b57 2
+9cfd306d-307f-14ec-8d85-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d90-d20bbc909b57 2
+9cfd306d-307f-14ec-8d91-d20bbc909b57 2
+9cfd306d-307f-14ec-8d98-d20bbc909b57 2
+9cfd306d-307f-14ec-8d99-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9d-d20bbc909b57 2
+9cfd306d-307f-14ec-8da2-d20bbc909b57 2
+9cfd306d-307f-14ec-8da4-d20bbc909b57 2
+9cfd306d-307f-14ec-8da8-d20bbc909b57 2
+9cfd306d-307f-14ec-8da9-d20bbc909b57 2
+9cfd306d-307f-14ec-8db1-d20bbc909b57 2
+9cfd306d-307f-14ec-8db6-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc0-d20bbc909b57 2
+9cfd306d-307f-14ec-8dca-d20bbc909b57 2
+9cfd306d-307f-14ec-8dcb-d20bbc909b57 2
+9cfd306d-307f-14ec-8ddf-d20bbc909b57 2
+9cfd306d-307f-14ec-8de0-d20bbc909b57 2
+9cfd306d-307f-14ec-8de4-d20bbc909b57 2
+9cfd306d-307f-14ec-8ded-d20bbc909b57 2
+9cfd306d-307f-14ec-8df3-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b76 2
+9cfd306d-307f-16ec-8d10-d20bbc909b84 2
+9cfd306d-307f-16ec-8d10-d20bbc909b85 2
+9cfd306d-307f-16ec-8d10-d20bbc909b88 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b9e 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba0 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc0 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc5 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bce 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd0 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd1 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd7 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bda 2
+9cfd306d-307f-16ec-8d10-d20bbc909bdb 2
+9cfd306d-307f-16ec-8d10-d20bbc909be4 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf7 2
+9cfd306d-307f-15ec-8d10-d60bbc909b57 2
+9cfd306d-307f-15ec-8d10-d90bbc909b57 2
+9cfd306d-307f-15ec-8d10-e10bbc909b57 2
+9cfd306d-307f-15ec-8d10-e90bbc909b57 2
+9cfd306d-307f-15ec-8d10-f80bbc909b57 2
+query
+SELECT a_p5, COUNT(*) FROM (SELECT a AS a_p5 FROM t1 PARTITION(p5) UNION ALL SELECT CAST(a AS UUID) AS a_p5 FROM t2 PARTITION(p5)) td GROUP BY a_p5
+a_p5 COUNT(*)
+9cfd306d-307f-15ec-8d10-070bbc909b57 2
+9cfd306d-307f-15ec-8d10-0a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-0b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-140bbc909b57 2
+9cfd306d-307f-15ec-8d10-1b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-200bbc909b57 2
+9cfd306d-307f-15ec-8d10-210bbc909b57 2
+9cfd306d-307f-15ec-8d10-280bbc909b57 2
+9cfd306d-307f-15ec-8d10-2a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-2f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-360bbc909b57 2
+9cfd306d-307f-15ec-8d10-390bbc909b57 2
+9cfd306d-307f-15ec-8d10-3b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-3f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-410bbc909b57 2
+9cfd306d-307f-15ec-8d10-420bbc909b57 2
+9cfd306d-307f-15ec-8d10-4b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-4e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-590bbc909b57 2
+9cfd306d-307f-15ec-8d10-720bbc909b57 2
+9cfd306d-307f-15ec-8d10-760bbc909b57 2
+9cfd306d-307f-15ec-8d10-7f0bbc909b57 2
+9cfd306d-307f-15ec-8d10-810bbc909b57 2
+9cfd306d-307f-15ec-8d10-8d0bbc909b57 2
+9cfd306d-307f-15ec-8d10-960bbc909b57 2
+9cfd306d-307f-15ec-8d10-a10bbc909b57 2
+9cfd306d-307f-15ec-8d10-a30bbc909b57 2
+9cfd306d-307f-15ec-8d10-ab0bbc909b57 2
+9cfd306d-307f-15ec-8d10-ae0bbc909b57 2
+9cfd306d-307f-15ec-8d10-b10bbc909b57 2
+9cfd306d-307f-15ec-8d10-b20bbc909b57 2
+9cfd306d-307f-15ec-8d10-b30bbc909b57 2
+9cfd306d-307f-15ec-8d10-bb0bbc909b57 2
+9cfd306d-307f-15ec-8d10-be0bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b01 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0a 2
+9cfd306d-307f-16ec-8d10-d20bbc909b0c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b15 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b1e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b20 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b33 2
+9cfd306d-307f-16ec-8d10-d20bbc909b36 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b48 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b53 2
+9cfd306d-307f-14ec-8d00-d20bbc909b57 2
+9cfd306d-307f-14ec-8d04-d20bbc909b57 2
+9cfd306d-307f-14ec-8d08-d20bbc909b57 2
+9cfd306d-307f-14ec-8d0b-d20bbc909b57 2
+06fd306d-307f-11ec-8d10-d20bbc909b57 2
+0afd306d-307f-11ec-8d10-d20bbc909b57 2
+12fd306d-307f-11ec-8d10-d20bbc909b57 2
+18fd306d-307f-11ec-8d10-d20bbc909b57 2
+22fd306d-307f-11ec-8d10-d20bbc909b57 2
+27fd306d-307f-11ec-8d10-d20bbc909b57 2
+39fd306d-307f-11ec-8d10-d20bbc909b57 2
+41fd306d-307f-11ec-8d10-d20bbc909b57 2
+47fd306d-307f-11ec-8d10-d20bbc909b57 2
+4cfd306d-307f-11ec-8d10-d20bbc909b57 2
+56fd306d-307f-11ec-8d10-d20bbc909b57 2
+5dfd306d-307f-11ec-8d10-d20bbc909b57 2
+68fd306d-307f-11ec-8d10-d20bbc909b57 2
+6dfd306d-307f-11ec-8d10-d20bbc909b57 2
+77fd306d-307f-11ec-8d10-d20bbc909b57 2
+7dfd306d-307f-11ec-8d10-d20bbc909b57 2
+80fd306d-307f-11ec-8d10-d20bbc909b57 2
+84fd306d-307f-11ec-8d10-d20bbc909b57 2
+87fd306d-307f-11ec-8d10-d20bbc909b57 2
+90fd306d-307f-11ec-8d10-d20bbc909b57 2
+92fd306d-307f-11ec-8d10-d20bbc909b57 2
+95fd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-307f-11ec-8d10-d20bbc909b57 2
+9dfd306d-307f-11ec-8d10-d20bbc909b57 2
+a4fd306d-307f-11ec-8d10-d20bbc909b57 2
+a5fd306d-307f-11ec-8d10-d20bbc909b57 2
+a7fd306d-307f-11ec-8d10-d20bbc909b57 2
+a8fd306d-307f-11ec-8d10-d20bbc909b57 2
+a9fd306d-307f-11ec-8d10-d20bbc909b57 2
+b6fd306d-307f-11ec-8d10-d20bbc909b57 2
+cafd306d-307f-11ec-8d10-d20bbc909b57 2
+cefd306d-307f-11ec-8d10-d20bbc909b57 2
+d2fd306d-307f-11ec-8d10-d20bbc909b57 2
+e1fd306d-307f-11ec-8d10-d20bbc909b57 2
+e2fd306d-307f-11ec-8d10-d20bbc909b57 2
+ecfd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-1d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-1e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-257f-12ec-8d10-d20bbc909b57 2
+9cfd306d-337f-12ec-8d10-d20bbc909b57 2
+9cfd306d-457f-12ec-8d10-d20bbc909b57 2
+9cfd306d-477f-12ec-8d10-d20bbc909b57 2
+9cfd306d-487f-12ec-8d10-d20bbc909b57 2
+9cfd306d-497f-12ec-8d10-d20bbc909b57 2
+9cfd306d-557f-12ec-8d10-d20bbc909b57 2
+9cfd306d-577f-12ec-8d10-d20bbc909b57 2
+9cfd306d-647f-12ec-8d10-d20bbc909b57 2
+9cfd306d-687f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-6e7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-707f-12ec-8d10-d20bbc909b57 2
+9cfd306d-717f-12ec-8d10-d20bbc909b57 2
+9cfd306d-857f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8a7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ae7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-cd7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-dc7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-de7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e87f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ef7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f17f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-130a-8d10-d20bbc909b57 2
+9cfd306d-307f-1322-8d10-d20bbc909b57 2
+9cfd306d-307f-1323-8d10-d20bbc909b57 2
+9cfd306d-307f-1324-8d10-d20bbc909b57 2
+9cfd306d-307f-1328-8d10-d20bbc909b57 2
+9cfd306d-307f-132b-8d10-d20bbc909b57 2
+9cfd306d-307f-1346-8d10-d20bbc909b57 2
+9cfd306d-307f-1348-8d10-d20bbc909b57 2
+9cfd306d-307f-1352-8d10-d20bbc909b57 2
+9cfd306d-307f-1353-8d10-d20bbc909b57 2
+9cfd306d-307f-1359-8d10-d20bbc909b57 2
+9cfd306d-307f-135f-8d10-d20bbc909b57 2
+9cfd306d-307f-1366-8d10-d20bbc909b57 2
+9cfd306d-307f-1367-8d10-d20bbc909b57 2
+9cfd306d-307f-136b-8d10-d20bbc909b57 2
+9cfd306d-307f-1374-8d10-d20bbc909b57 2
+9cfd306d-307f-139b-8d10-d20bbc909b57 2
+9cfd306d-307f-13a4-8d10-d20bbc909b57 2
+9cfd306d-307f-13a8-8d10-d20bbc909b57 2
+9cfd306d-307f-13b6-8d10-d20bbc909b57 2
+9cfd306d-307f-13c5-8d10-d20bbc909b57 2
+9cfd306d-307f-13c6-8d10-d20bbc909b57 2
+9cfd306d-307f-13c7-8d10-d20bbc909b57 2
+9cfd306d-307f-13d4-8d10-d20bbc909b57 2
+9cfd306d-307f-13d5-8d10-d20bbc909b57 2
+9cfd306d-307f-13de-8d10-d20bbc909b57 2
+9cfd306d-307f-13e4-8d10-d20bbc909b57 2
+9cfd306d-307f-13ea-8d10-d20bbc909b57 2
+9cfd306d-307f-13f3-8d10-d20bbc909b57 2
+9cfd306d-307f-13f4-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d12-d20bbc909b57 2
+9cfd306d-307f-14ec-8d15-d20bbc909b57 2
+9cfd306d-307f-14ec-8d16-d20bbc909b57 2
+9cfd306d-307f-14ec-8d18-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d20-d20bbc909b57 2
+9cfd306d-307f-14ec-8d43-d20bbc909b57 2
+9cfd306d-307f-14ec-8d52-d20bbc909b57 2
+9cfd306d-307f-14ec-8d53-d20bbc909b57 2
+9cfd306d-307f-14ec-8d54-d20bbc909b57 2
+9cfd306d-307f-14ec-8d58-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d65-d20bbc909b57 2
+9cfd306d-307f-14ec-8d72-d20bbc909b57 2
+9cfd306d-307f-14ec-8d74-d20bbc909b57 2
+9cfd306d-307f-14ec-8d79-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d7f-d20bbc909b57 2
+9cfd306d-307f-14ec-8d83-d20bbc909b57 2
+9cfd306d-307f-14ec-8db3-d20bbc909b57 2
+9cfd306d-307f-14ec-8dbc-d20bbc909b57 2
+9cfd306d-307f-14ec-8dbf-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc4-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc9-d20bbc909b57 2
+9cfd306d-307f-14ec-8dcd-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd2-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd5-d20bbc909b57 2
+9cfd306d-307f-14ec-8dde-d20bbc909b57 2
+9cfd306d-307f-14ec-8dec-d20bbc909b57 2
+9cfd306d-307f-14ec-8df0-d20bbc909b57 2
+9cfd306d-307f-14ec-8df2-d20bbc909b57 2
+9cfd306d-307f-14ec-8df4-d20bbc909b57 2
+9cfd306d-307f-14ec-8dfa-d20bbc909b57 2
+9cfd306d-307f-14ec-8dfe-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b5e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b60 2
+9cfd306d-307f-16ec-8d10-d20bbc909b66 2
+9cfd306d-307f-16ec-8d10-d20bbc909b67 2
+9cfd306d-307f-16ec-8d10-d20bbc909b77 2
+9cfd306d-307f-16ec-8d10-d20bbc909b8f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b93 2
+9cfd306d-307f-16ec-8d10-d20bbc909b98 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba1 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba4 2
+9cfd306d-307f-16ec-8d10-d20bbc909baf 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb2 2
+9cfd306d-307f-16ec-8d10-d20bbc909bb3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bbe 2
+9cfd306d-307f-16ec-8d10-d20bbc909bcb 2
+9cfd306d-307f-16ec-8d10-d20bbc909bcc 2
+9cfd306d-307f-16ec-8d10-d20bbc909bdc 2
+9cfd306d-307f-16ec-8d10-d20bbc909be5 2
+9cfd306d-307f-16ec-8d10-d20bbc909be7 2
+9cfd306d-307f-16ec-8d10-d20bbc909be9 2
+9cfd306d-307f-16ec-8d10-d20bbc909bef 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf4 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf8 2
+9cfd306d-307f-16ec-8d10-d20bbc909bfd 2
+9cfd306d-307f-15ec-8d10-e50bbc909b57 2
+9cfd306d-307f-15ec-8d10-f20bbc909b57 2
+9cfd306d-307f-15ec-8d10-f40bbc909b57 2
+9cfd306d-307f-15ec-8d10-f50bbc909b57 2
+9cfd306d-307f-15ec-8d10-fc0bbc909b57 2
+query
+SELECT a_p6, COUNT(*) FROM (SELECT a AS a_p6 FROM t1 PARTITION(p6) UNION ALL SELECT CAST(a AS UUID) AS a_p6 FROM t2 PARTITION(p6)) td GROUP BY a_p6
+a_p6 COUNT(*)
+9cfd306d-307f-15ec-8d10-0e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-160bbc909b57 2
+9cfd306d-307f-15ec-8d10-170bbc909b57 2
+9cfd306d-307f-15ec-8d10-290bbc909b57 2
+9cfd306d-307f-15ec-8d10-2e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-350bbc909b57 2
+9cfd306d-307f-15ec-8d10-450bbc909b57 2
+9cfd306d-307f-15ec-8d10-540bbc909b57 2
+9cfd306d-307f-15ec-8d10-550bbc909b57 2
+9cfd306d-307f-15ec-8d10-5b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-600bbc909b57 2
+9cfd306d-307f-15ec-8d10-620bbc909b57 2
+9cfd306d-307f-15ec-8d10-670bbc909b57 2
+9cfd306d-307f-15ec-8d10-690bbc909b57 2
+9cfd306d-307f-15ec-8d10-6b0bbc909b57 2
+9cfd306d-307f-15ec-8d10-730bbc909b57 2
+9cfd306d-307f-15ec-8d10-7a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-870bbc909b57 2
+9cfd306d-307f-15ec-8d10-8a0bbc909b57 2
+9cfd306d-307f-15ec-8d10-9e0bbc909b57 2
+9cfd306d-307f-15ec-8d10-a60bbc909b57 2
+9cfd306d-307f-15ec-8d10-b40bbc909b57 2
+9cfd306d-307f-15ec-8d10-b50bbc909b57 2
+9cfd306d-307f-15ec-8d10-b90bbc909b57 2
+9cfd306d-307f-15ec-8d10-bd0bbc909b57 2
+9cfd306d-307f-15ec-8d10-bf0bbc909b57 2
+9cfd306d-307f-15ec-8d10-c80bbc909b57 2
+9cfd306d-307f-15ec-8d10-ce0bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b08 2
+9cfd306d-307f-16ec-8d10-d20bbc909b12 2
+9cfd306d-307f-16ec-8d10-d20bbc909b18 2
+9cfd306d-307f-16ec-8d10-d20bbc909b21 2
+9cfd306d-307f-16ec-8d10-d20bbc909b23 2
+9cfd306d-307f-16ec-8d10-d20bbc909b2c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b30 2
+9cfd306d-307f-16ec-8d10-d20bbc909b39 2
+9cfd306d-307f-16ec-8d10-d20bbc909b3b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b44 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b4c 2
+9cfd306d-307f-14ec-8d03-d20bbc909b57 2
+9cfd306d-307f-14ec-8d09-d20bbc909b57 2
+9cfd306d-307f-14ec-8d0c-d20bbc909b57 2
+9cfd306d-307f-14ec-8d0d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d0e-d20bbc909b57 2
+01fd306d-307f-11ec-8d10-d20bbc909b57 2
+05fd306d-307f-11ec-8d10-d20bbc909b57 2
+0cfd306d-307f-11ec-8d10-d20bbc909b57 2
+1efd306d-307f-11ec-8d10-d20bbc909b57 2
+1ffd306d-307f-11ec-8d10-d20bbc909b57 2
+2efd306d-307f-11ec-8d10-d20bbc909b57 2
+30fd306d-307f-11ec-8d10-d20bbc909b57 2
+31fd306d-307f-11ec-8d10-d20bbc909b57 2
+3afd306d-307f-11ec-8d10-d20bbc909b57 2
+3cfd306d-307f-11ec-8d10-d20bbc909b57 2
+40fd306d-307f-11ec-8d10-d20bbc909b57 2
+4afd306d-307f-11ec-8d10-d20bbc909b57 2
+57fd306d-307f-11ec-8d10-d20bbc909b57 2
+5efd306d-307f-11ec-8d10-d20bbc909b57 2
+6cfd306d-307f-11ec-8d10-d20bbc909b57 2
+71fd306d-307f-11ec-8d10-d20bbc909b57 2
+74fd306d-307f-11ec-8d10-d20bbc909b57 2
+7bfd306d-307f-11ec-8d10-d20bbc909b57 2
+88fd306d-307f-11ec-8d10-d20bbc909b57 2
+8efd306d-307f-11ec-8d10-d20bbc909b57 2
+9ffd306d-307f-11ec-8d10-d20bbc909b57 2
+a0fd306d-307f-11ec-8d10-d20bbc909b57 2
+a2fd306d-307f-11ec-8d10-d20bbc909b57 2
+bafd306d-307f-11ec-8d10-d20bbc909b57 2
+befd306d-307f-11ec-8d10-d20bbc909b57 2
+c1fd306d-307f-11ec-8d10-d20bbc909b57 2
+c5fd306d-307f-11ec-8d10-d20bbc909b57 2
+c8fd306d-307f-11ec-8d10-d20bbc909b57 2
+cffd306d-307f-11ec-8d10-d20bbc909b57 2
+d7fd306d-307f-11ec-8d10-d20bbc909b57 2
+dffd306d-307f-11ec-8d10-d20bbc909b57 2
+e3fd306d-307f-11ec-8d10-d20bbc909b57 2
+e7fd306d-307f-11ec-8d10-d20bbc909b57 2
+e9fd306d-307f-11ec-8d10-d20bbc909b57 2
+f2fd306d-307f-11ec-8d10-d20bbc909b57 2
+fffd306d-307f-11ec-8d10-d20bbc909b57 2
+9cfd306d-027f-12ec-8d10-d20bbc909b57 2
+9cfd306d-0c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-157f-12ec-8d10-d20bbc909b57 2
+9cfd306d-1f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-287f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2d7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-2f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-397f-12ec-8d10-d20bbc909b57 2
+9cfd306d-3b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-427f-12ec-8d10-d20bbc909b57 2
+9cfd306d-567f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-5f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-877f-12ec-8d10-d20bbc909b57 2
+9cfd306d-887f-12ec-8d10-d20bbc909b57 2
+9cfd306d-8f7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-947f-12ec-8d10-d20bbc909b57 2
+9cfd306d-957f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9b7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-9c7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-a57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-b77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-bf7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-c57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ca7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-cc7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-d57f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e07f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e77f-12ec-8d10-d20bbc909b57 2
+9cfd306d-e97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-ed7f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f27f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f37f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f47f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f67f-12ec-8d10-d20bbc909b57 2
+9cfd306d-f97f-12ec-8d10-d20bbc909b57 2
+9cfd306d-307f-1301-8d10-d20bbc909b57 2
+9cfd306d-307f-1305-8d10-d20bbc909b57 2
+9cfd306d-307f-1306-8d10-d20bbc909b57 2
+9cfd306d-307f-1307-8d10-d20bbc909b57 2
+9cfd306d-307f-130c-8d10-d20bbc909b57 2
+9cfd306d-307f-1312-8d10-d20bbc909b57 2
+9cfd306d-307f-131d-8d10-d20bbc909b57 2
+9cfd306d-307f-1334-8d10-d20bbc909b57 2
+9cfd306d-307f-133c-8d10-d20bbc909b57 2
+9cfd306d-307f-133f-8d10-d20bbc909b57 2
+9cfd306d-307f-1343-8d10-d20bbc909b57 2
+9cfd306d-307f-1347-8d10-d20bbc909b57 2
+9cfd306d-307f-1349-8d10-d20bbc909b57 2
+9cfd306d-307f-135d-8d10-d20bbc909b57 2
+9cfd306d-307f-1362-8d10-d20bbc909b57 2
+9cfd306d-307f-1364-8d10-d20bbc909b57 2
+9cfd306d-307f-136d-8d10-d20bbc909b57 2
+9cfd306d-307f-1377-8d10-d20bbc909b57 2
+9cfd306d-307f-137b-8d10-d20bbc909b57 2
+9cfd306d-307f-137c-8d10-d20bbc909b57 2
+9cfd306d-307f-138b-8d10-d20bbc909b57 2
+9cfd306d-307f-1396-8d10-d20bbc909b57 2
+9cfd306d-307f-1399-8d10-d20bbc909b57 2
+9cfd306d-307f-13ae-8d10-d20bbc909b57 2
+9cfd306d-307f-13bd-8d10-d20bbc909b57 2
+9cfd306d-307f-13c4-8d10-d20bbc909b57 2
+9cfd306d-307f-13c9-8d10-d20bbc909b57 2
+9cfd306d-307f-13cc-8d10-d20bbc909b57 2
+9cfd306d-307f-13cd-8d10-d20bbc909b57 2
+9cfd306d-307f-13d7-8d10-d20bbc909b57 2
+9cfd306d-307f-13da-8d10-d20bbc909b57 2
+9cfd306d-307f-13dd-8d10-d20bbc909b57 2
+9cfd306d-307f-13e1-8d10-d20bbc909b57 2
+9cfd306d-307f-13e6-8d10-d20bbc909b57 2
+9cfd306d-307f-13ec-8d10-d20bbc909b57 2
+9cfd306d-307f-13ed-8d10-d20bbc909b57 2
+9cfd306d-307f-13ee-8d10-d20bbc909b57 2
+9cfd306d-307f-13f8-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d10-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1b-d20bbc909b57 2
+9cfd306d-307f-14ec-8d1d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d21-d20bbc909b57 2
+9cfd306d-307f-14ec-8d22-d20bbc909b57 2
+9cfd306d-307f-14ec-8d25-d20bbc909b57 2
+9cfd306d-307f-14ec-8d32-d20bbc909b57 2
+9cfd306d-307f-14ec-8d48-d20bbc909b57 2
+9cfd306d-307f-14ec-8d5d-d20bbc909b57 2
+9cfd306d-307f-14ec-8d62-d20bbc909b57 2
+9cfd306d-307f-14ec-8d64-d20bbc909b57 2
+9cfd306d-307f-14ec-8d71-d20bbc909b57 2
+9cfd306d-307f-14ec-8d84-d20bbc909b57 2
+9cfd306d-307f-14ec-8d8a-d20bbc909b57 2
+9cfd306d-307f-14ec-8d9a-d20bbc909b57 2
+9cfd306d-307f-14ec-8da1-d20bbc909b57 2
+9cfd306d-307f-14ec-8da7-d20bbc909b57 2
+9cfd306d-307f-14ec-8dae-d20bbc909b57 2
+9cfd306d-307f-14ec-8db0-d20bbc909b57 2
+9cfd306d-307f-14ec-8db2-d20bbc909b57 2
+9cfd306d-307f-14ec-8db8-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc1-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc3-d20bbc909b57 2
+9cfd306d-307f-14ec-8dc8-d20bbc909b57 2
+9cfd306d-307f-14ec-8dce-d20bbc909b57 2
+9cfd306d-307f-14ec-8dcf-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd0-d20bbc909b57 2
+9cfd306d-307f-14ec-8dd8-d20bbc909b57 2
+9cfd306d-307f-14ec-8ddb-d20bbc909b57 2
+9cfd306d-307f-14ec-8ddc-d20bbc909b57 2
+9cfd306d-307f-14ec-8de2-d20bbc909b57 2
+9cfd306d-307f-14ec-8de3-d20bbc909b57 2
+9cfd306d-307f-14ec-8dfb-d20bbc909b57 2
+9cfd306d-307f-14ec-8dfd-d20bbc909b57 2
+9cfd306d-307f-16ec-8d10-d20bbc909b59 2
+9cfd306d-307f-16ec-8d10-d20bbc909b61 2
+9cfd306d-307f-16ec-8d10-d20bbc909b64 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6b 2
+9cfd306d-307f-16ec-8d10-d20bbc909b6c 2
+9cfd306d-307f-16ec-8d10-d20bbc909b74 2
+9cfd306d-307f-16ec-8d10-d20bbc909b75 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7d 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7e 2
+9cfd306d-307f-16ec-8d10-d20bbc909b7f 2
+9cfd306d-307f-16ec-8d10-d20bbc909b90 2
+9cfd306d-307f-16ec-8d10-d20bbc909b91 2
+9cfd306d-307f-16ec-8d10-d20bbc909ba5 2
+9cfd306d-307f-16ec-8d10-d20bbc909bbd 2
+9cfd306d-307f-16ec-8d10-d20bbc909bc1 2
+9cfd306d-307f-16ec-8d10-d20bbc909bd5 2
+9cfd306d-307f-16ec-8d10-d20bbc909be2 2
+9cfd306d-307f-16ec-8d10-d20bbc909be3 2
+9cfd306d-307f-16ec-8d10-d20bbc909bea 2
+9cfd306d-307f-16ec-8d10-d20bbc909bed 2
+9cfd306d-307f-16ec-8d10-d20bbc909bf5 2
+9cfd306d-307f-15ec-8d10-d50bbc909b57 2
+9cfd306d-307f-15ec-8d10-da0bbc909b57 2
+9cfd306d-307f-15ec-8d10-db0bbc909b57 2
+9cfd306d-307f-15ec-8d10-e60bbc909b57 2
+9cfd306d-307f-15ec-8d10-e70bbc909b57 2
+9cfd306d-307f-15ec-8d10-f00bbc909b57 2
+9cfd306d-307f-15ec-8d10-f30bbc909b57 2
+9cfd306d-307f-15ec-8d10-fe0bbc909b57 2
+CALL test_partition_by_key_pstat(7);
+pname pcount
+p0 213
+p1 212
+p2 216
+p3 216
+p4 240
+p5 213
+p6 226
+CALL test_partition_by_key_pstat(4);
+pname pcount
+p0 64
+p1 64
+p2 64
+p3 1344
+CALL test_partition_by_key_pstat(5);
+pname pcount
+p0 343
+p1 305
+p2 288
+p3 307
+p4 293
+CALL test_partition_by_key_pstat(6);
+pname pcount
+p0 47
+p1 469
+p2 38
+p3 451
+p4 43
+p5 488
+CALL test_partition_by_key_pstat(8);
+pname pcount
+p0 32
+p1 32
+p2 32
+p3 32
+p4 32
+p5 32
+p6 32
+p7 1312
+CALL test_partition_by_key_pstat(9);
+pname pcount
+p0 174
+p1 171
+p2 175
+p3 155
+p4 157
+p5 180
+p6 169
+p7 184
+p8 171
+CALL test_partition_by_key_pstat(10);
+pname pcount
+p0 23
+p1 283
+p2 31
+p3 282
+p4 27
+p5 320
+p6 22
+p7 257
+p8 25
+p9 266
+CALL test_partition_by_key_pstat(11);
+pname pcount
+p0 119
+p1 149
+p2 166
+p3 147
+p4 150
+p5 138
+p6 150
+p7 142
+p8 131
+p9 126
+p10 118
+CALL test_partition_by_key_pstat(12);
+pname pcount
+p0 23
+p1 21
+p2 19
+p3 435
+p4 22
+p5 27
+p6 24
+p7 448
+p8 19
+p9 16
+p10 21
+p11 461
+CALL test_partition_by_key_pstat(13);
+pname pcount
+p0 123
+p1 108
+p2 115
+p3 104
+p4 124
+p5 118
+p6 134
+p7 107
+p8 119
+p9 126
+p10 114
+p11 117
+p12 127
+CALL test_partition_by_key_pstat(14);
+pname pcount
+p0 17
+p1 200
+p2 22
+p3 194
+p4 21
+p5 193
+p6 14
+p7 196
+p8 12
+p9 194
+p10 22
+p11 219
+p12 20
+p13 212
+CALL test_partition_by_key_pstat(15);
+pname pcount
+p0 121
+p1 110
+p2 99
+p3 90
+p4 82
+p5 112
+p6 105
+p7 110
+p8 117
+p9 103
+p10 110
+p11 90
+p12 79
+p13 100
+p14 108
+CALL test_partition_by_key_pstat(16);
+pname pcount
+p0 16
+p1 16
+p2 16
+p3 16
+p4 16
+p5 16
+p6 16
+p7 1296
+p8 16
+p9 16
+p10 16
+p11 16
+p12 16
+p13 16
+p14 16
+p15 16
+DROP PROCEDURE test_partition_by_key_uuid_vs_binary;
+DROP PROCEDURE test_partition_by_key_pstat;
+DROP TABLE t0;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test
new file mode 100644
index 00000000000..5bd198c4e8b
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test
@@ -0,0 +1,104 @@
+--source include/have_partition.inc
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+SET NAMES utf8;
+
+--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
+CREATE TABLE t1 (a UUID)
+ PARTITION BY LIST COLUMNS(a)
+ (PARTITION p00 VALUES IN (10));
+
+--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
+CREATE TABLE t1 (a UUID)
+ PARTITION BY LIST COLUMNS(a)
+ (PARTITION p00 VALUES IN (TIME'10:20:30'));
+
+--error ER_TRUNCATED_WRONG_VALUE
+CREATE TABLE t1 (a UUID)
+ PARTITION BY LIST COLUMNS(a)
+ (PARTITION p00 VALUES IN ('€'));
+
+CREATE TABLE t1 (a UUID)
+ PARTITION BY LIST COLUMNS(a)
+ (PARTITION p00 VALUES IN ('123e4567-e89b-12d3-a456-426655440000'),
+ PARTITION pFF VALUES IN (0xffff000000000000000000000000ffff));
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000');
+INSERT INTO t1 VALUES ('ffff0000-0000-0000-0000-00000000ffff');
+SELECT * FROM t1 PARTITION (p00);
+SELECT * FROM t1 PARTITION (pFF);
+DROP TABLE t1;
+
+
+CREATE TABLE t0 (a UUID);
+DELIMITER $$;
+FOR i IN 0..255
+DO
+ INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0')));
+ INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0')));
+END FOR;
+$$
+--echo # Test that UUID and BINARY(16) implement the same distribution by key
+CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT)
+BEGIN
+ EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+ EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+ INSERT INTO t1 SELECT * FROM t0;
+ INSERT INTO t2 SELECT * FROM t0;
+ FOR i IN 0..(parts-1)
+ DO
+ BEGIN
+ DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM ('
+ 'SELECT a AS a_p0 FROM t1 PARTITION(p0) '
+ 'UNION ALL '
+ 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td '
+ 'GROUP BY a_p0';
+ DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i));
+ SELECT query;
+ EXECUTE IMMEDIATE query;
+ END;
+ END FOR;
+ DROP TABLE t1,t2;
+END;
+$$
+--echo # Display statistics how records are distributed between partitions
+CREATE PROCEDURE test_partition_by_key_pstat(parts INT)
+BEGIN
+ EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts);
+ CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int);
+ INSERT INTO t1 SELECT * FROM t0;
+ FOR i IN 0..(parts-1)
+ DO
+ BEGIN
+ DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))';
+ EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i));
+ END;
+ END FOR;
+ SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED);
+ DROP TABLE t1,t1_pstat;
+END;
+$$
+DELIMITER ;$$
+CALL test_partition_by_key_uuid_vs_binary(7);
+CALL test_partition_by_key_pstat(7);
+CALL test_partition_by_key_pstat(4);
+CALL test_partition_by_key_pstat(5);
+CALL test_partition_by_key_pstat(6);
+CALL test_partition_by_key_pstat(8);
+CALL test_partition_by_key_pstat(9);
+CALL test_partition_by_key_pstat(10);
+CALL test_partition_by_key_pstat(11);
+CALL test_partition_by_key_pstat(12);
+CALL test_partition_by_key_pstat(13);
+CALL test_partition_by_key_pstat(14);
+CALL test_partition_by_key_pstat(15);
+CALL test_partition_by_key_pstat(16);
+DROP PROCEDURE test_partition_by_key_uuid_vs_binary;
+DROP PROCEDURE test_partition_by_key_pstat;
+DROP TABLE t0;
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result
new file mode 100644
index 00000000000..a8fc3ca22a6
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result
@@ -0,0 +1,31 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+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='uuid';
+PLUGIN_NAME uuid
+PLUGIN_VERSION 1.0
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE DATA TYPE
+PLUGIN_AUTHOR MariaDB Corporation
+PLUGIN_DESCRIPTION Data type UUID
+PLUGIN_LICENSE GPL
+PLUGIN_MATURITY Stable
+PLUGIN_AUTH_VERSION 1.0
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test
new file mode 100644
index 00000000000..112105a176b
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test
@@ -0,0 +1,27 @@
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--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='uuid';
+--horizontal_results
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result
new file mode 100644
index 00000000000..09784df61ff
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result
@@ -0,0 +1,24 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-4958 Adding datatype UUID
+#
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+('123e4567-e89b-12d3-a456-426655440000'),
+('123e4567-e89b-12d3-a456-426655440001');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440002');
+SELECT * FROM t1 ORDER BY a;
+a
+123e4567-e89b-12d3-a456-426655440000
+123e4567-e89b-12d3-a456-426655440001
+123e4567-e89b-12d3-a456-426655440002
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test
new file mode 100644
index 00000000000..1a39f813cba
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test
@@ -0,0 +1,22 @@
+--source include/have_stat_tables.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-4958 Adding datatype UUID
+--echo #
+
+CREATE TABLE t1 (a UUID);
+INSERT INTO t1 VALUES
+ ('123e4567-e89b-12d3-a456-426655440000'),
+ ('123e4567-e89b-12d3-a456-426655440001');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440002');
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result
new file mode 100644
index 00000000000..e5d88c3df2a
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result
@@ -0,0 +1,17 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+#
+CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1)
+ffffffff-ffff-ffff-ffff-fffffffffffe
+Warnings:
+Warning 1292 Incorrect uuid value: 'a'
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test
new file mode 100644
index 00000000000..45cdf927210
--- /dev/null
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test
@@ -0,0 +1,17 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+--echo #
+
+CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/plugin/type_uuid/plugin.cc b/plugin/type_uuid/plugin.cc
new file mode 100644
index 00000000000..bd320a9a897
--- /dev/null
+++ b/plugin/type_uuid/plugin.cc
@@ -0,0 +1,122 @@
+/* Copyright (c) 2019,2021, 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_uuid.h"
+#include "item_uuidfunc.h"
+#include <mysql/plugin_data_type.h>
+#include <mysql/plugin_function.h>
+
+static struct st_mariadb_data_type plugin_descriptor_type_uuid=
+{
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ UUIDBundle::type_handler_fbt()
+};
+
+/*************************************************************************/
+
+class Create_func_uuid : public Create_func_arg0
+{
+public:
+ Item *create_builder(THD *thd) override
+ {
+ DBUG_ENTER("Create_func_uuid::create");
+ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
+ thd->lex->safe_to_cache_query= 0;
+ DBUG_RETURN(new (thd->mem_root) Item_func_uuid(thd));
+ }
+ static Create_func_uuid s_singleton;
+
+protected:
+ Create_func_uuid() {}
+ virtual ~Create_func_uuid() {}
+};
+
+
+class Create_func_sys_guid : public Create_func_arg0
+{
+public:
+ Item *create_builder(THD *thd) override
+ {
+ DBUG_ENTER("Create_func_sys_guid::create");
+ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
+ thd->lex->safe_to_cache_query= 0;
+ DBUG_RETURN(new (thd->mem_root) Item_func_sys_guid(thd));
+ }
+ static Create_func_sys_guid s_singleton;
+
+protected:
+ Create_func_sys_guid() {}
+ virtual ~Create_func_sys_guid() {}
+};
+
+Create_func_uuid Create_func_uuid::s_singleton;
+Create_func_sys_guid Create_func_sys_guid::s_singleton;
+
+static Plugin_function
+ plugin_descriptor_function_uuid(&Create_func_uuid::s_singleton),
+ plugin_descriptor_function_sys_guid(&Create_func_sys_guid::s_singleton);
+
+/*************************************************************************/
+
+maria_declare_plugin(type_uuid)
+{
+ MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_type_uuid, // pointer to type-specific plugin descriptor
+ "uuid", // plugin name
+ "MariaDB Corporation", // plugin author
+ "Data type UUID", // 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 version
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
+},
+{
+ MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_function_uuid,// pointer to type-specific plugin descriptor
+ "uuid", // plugin name
+ "MariaDB Corporation", // plugin author
+ "Function UUID()", // 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 version
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
+},
+{
+ MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h)
+ &plugin_descriptor_function_sys_guid,// pointer to type-specific plugin descriptor
+ "sys_guid", // plugin name
+ "MariaDB Corporation", // plugin author
+ "Function SYS_GUID()", // 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 version
+ NULL, // Status variables
+ NULL, // System variables
+ "1.0", // String version representation
+ MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/
+}
+maria_declare_plugin_end;
diff --git a/plugin/type_uuid/sql_type_uuid.cc b/plugin/type_uuid/sql_type_uuid.cc
new file mode 100644
index 00000000000..9b4a731dbb2
--- /dev/null
+++ b/plugin/type_uuid/sql_type_uuid.cc
@@ -0,0 +1,117 @@
+/* Copyright (c) 2019,2021 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_uuid.h"
+
+
+static bool get_digit(char ch, uint *val)
+{
+ if (ch >= '0' && ch <= '9')
+ {
+ *val= (uint) ch - '0';
+ return false;
+ }
+ if (ch >= 'a' && ch <= 'f')
+ {
+ *val= (uint) ch - 'a' + 0x0a;
+ return false;
+ }
+ if (ch >= 'A' && ch <= 'F')
+ {
+ *val= (uint) ch - 'A' + 0x0a;
+ return false;
+ }
+ return true;
+}
+
+
+static bool get_digit(uint *val, const char *str, const char *end)
+{
+ if (str >= end)
+ return true;
+ return get_digit(*str, val);
+}
+
+
+static size_t skip_hyphens(const char *str, const char *end)
+{
+ const char *str0= str;
+ for ( ; str < end; str++)
+ {
+ if (str[0] != '-')
+ break;
+ }
+ return str - str0;
+}
+
+
+static const char *get_two_digits(char *val, const char *str, const char *end)
+{
+ uint hi, lo;
+ if (get_digit(&hi, str++, end))
+ return NULL;
+ str+= skip_hyphens(str, end);
+ if (get_digit(&lo, str++, end))
+ return NULL;
+ *val= (char) ((hi << 4) + lo);
+ return str;
+}
+
+
+bool UUID::ascii_to_fbt(const char *str, size_t str_length)
+{
+ const char *end= str + str_length;
+ /*
+ The format understood:
+ - Hyphen is not allowed on the first and the last position.
+ - Otherwise, hyphens are allowed on any (odd and even) position,
+ with any amount.
+ */
+ if (str_length < 32)
+ goto err;
+
+ for (uint oidx= 0; oidx < binary_length(); oidx++)
+ {
+ if (!(str= get_two_digits(&m_buffer[oidx], str, end)))
+ goto err;
+ // Allow hypheps after two digits, but not after the last digit
+ if (oidx + 1 < binary_length())
+ str+= skip_hyphens(str, end);
+ }
+ if (str < end)
+ goto err; // Some input left
+ return false;
+err:
+ bzero(m_buffer, sizeof(m_buffer));
+ return true;
+}
+
+size_t UUID::to_string(char *dst, size_t dstsize) const
+{
+ my_uuid2str((const uchar *) m_buffer, dst, 1);
+ return MY_UUID_STRING_LENGTH;
+}
+
+
+const Name &UUID::default_value()
+{
+ static Name def(STRING_WITH_LEN("00000000-0000-0000-0000-000000000000"));
+ return def;
+}
diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h
new file mode 100644
index 00000000000..be9fea8ebc9
--- /dev/null
+++ b/plugin/type_uuid/sql_type_uuid.h
@@ -0,0 +1,186 @@
+#ifndef SQL_TYPE_UUID_INCLUDED
+#define SQL_TYPE_UUID_INCLUDED
+
+/* Copyright (c) 2019,2021 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 */
+
+#include "sql_type_fixedbin_storage.h"
+class UUID: public FixedBinTypeStorage<MY_UUID_SIZE, MY_UUID_STRING_LENGTH>
+{
+public:
+ using FixedBinTypeStorage::FixedBinTypeStorage;
+ bool ascii_to_fbt(const char *str, size_t str_length);
+ size_t to_string(char *dst, size_t dstsize) const;
+ static const Name &default_value();
+
+ /*
+ Binary (in-memory) UUIDv1 representation:
+
+ llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn
+
+ Binary sortable (in-record) representation:
+
+ nnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll
+
+ Sign Section Bits Bytes Pos PosBinSortable
+ ------------- ------- ---- ----- --- --------------
+ llllllll time low 32 4 0 12
+ mmmm time mid 16 2 4 10
+ Vhhh version and time hi 16 2 6 8
+ vsss variant and clock seq 16 2 8 6
+ nnnnnnnnnnnn node ID 48 6 10 0
+ */
+
+ class Segment
+ {
+ size_t m_memory_pos;
+ size_t m_record_pos;
+ size_t m_length;
+ public:
+ constexpr Segment(size_t memory_pos, size_t record_pos, size_t length)
+ :m_memory_pos(memory_pos), m_record_pos(record_pos), m_length(length)
+ { }
+ void memory_to_record(char *to, const char *from) const
+ {
+ memcpy(to + m_record_pos, from + m_memory_pos, m_length);
+ }
+ void record_to_memory(char *to, const char * from) const
+ {
+ memcpy(to + m_memory_pos, from + m_record_pos, m_length);
+ }
+ int cmp_memory(const char *a, const char *b) const
+ {
+ return memcmp(a + m_memory_pos, b + m_memory_pos, m_length);
+ }
+ void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) const
+ {
+ my_charset_bin.hash_sort(ptr + m_record_pos, m_length, nr, nr2);
+ }
+ };
+
+ static const Segment & segment(uint i)
+ {
+ static Segment segments[]=
+ {
+ {0, 12, 4}, // llllllll
+ {4, 10, 2}, // mmmm
+ {6, 8, 2}, // Vhhh
+ {8, 6, 2}, // vsss
+ {10, 0, 6} // nnnnnnnnnnnn
+ };
+ return segments[i];
+ }
+
+ // Convert the in-memory representation to the in-record representation
+ static void memory_to_record(char *to, const char *from)
+ {
+ segment(0).memory_to_record(to, from);
+ segment(1).memory_to_record(to, from);
+ segment(2).memory_to_record(to, from);
+ segment(3).memory_to_record(to, from);
+ segment(4).memory_to_record(to, from);
+ }
+
+ // Convert the in-record representation to the in-memory representation
+ static void record_to_memory(char *to, const char *from)
+ {
+ segment(0).record_to_memory(to, from);
+ segment(1).record_to_memory(to, from);
+ segment(2).record_to_memory(to, from);
+ segment(3).record_to_memory(to, from);
+ segment(4).record_to_memory(to, from);
+ }
+
+ /*
+ Calculate a hash of the in-record representation.
+ Used in Field_uuid::hash(), e.g. for KEY partitioning. This
+ makes partition distribution for UUID and BINARY(16) equal,
+ so for example:
+
+ CREATE OR REPLACE TABLE t1 (c1 UUID) PARTITION BY KEY(c1) PARTITIONS 5;
+ INSERT INTO t1 (c1) VALUES (UUID());
+
+ and
+
+ CREATE OR REPLACE TABLE t1 (c1 BINARY(16)) PARTITION BY KEY(c1) PARTITIONS 5;
+ INSERT INTO t1 (c1) VALUES (UUID());
+
+ put values into the same partition.
+ */
+ static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2)
+ {
+ segment(0).hash_record(ptr, nr, nr2);
+ segment(1).hash_record(ptr, nr, nr2);
+ segment(2).hash_record(ptr, nr, nr2);
+ segment(3).hash_record(ptr, nr, nr2);
+ segment(4).hash_record(ptr, nr, nr2);
+ }
+
+ // Compare two in-memory values
+ static int cmp(const LEX_CSTRING &a, const LEX_CSTRING &b)
+ {
+ DBUG_ASSERT(a.length == binary_length());
+ DBUG_ASSERT(b.length == binary_length());
+ int res;
+ if ((res= segment(4).cmp_memory(a.str, b.str)) ||
+ (res= segment(3).cmp_memory(a.str, b.str)) ||
+ (res= segment(2).cmp_memory(a.str, b.str)) ||
+ (res= segment(1).cmp_memory(a.str, b.str)) ||
+ (res= segment(0).cmp_memory(a.str, b.str)))
+ return res;
+ return 0;
+ }
+
+ static ulong KEY_pack_flags(uint column_nr)
+ {
+ return HA_PACK_KEY;
+ }
+
+ /*
+ Convert in-record representation to binlog representation.
+ We tranfer UUID values in binlog by compressing in-memory representation.
+ This makes replication between UUID and BINARY(16) simpler:
+
+ Transferring by compressing the in-record representation would require
+ extending the binary log format to put the extact data type name into
+ the column metadata.
+ */
+ static uchar *pack(uchar *to, const uchar *from, uint max_length)
+ {
+ uchar buf[binary_length()];
+ record_to_memory((char *) buf, (const char *) from);
+ return StringPack(&my_charset_bin, binary_length()).
+ pack(to, buf, max_length);
+ }
+
+ // Convert binlog representation to in-record representation
+ static const uchar *unpack(uchar *to,
+ const uchar *from, const uchar *from_end,
+ uint param_data)
+ {
+ uchar buf[binary_length()];
+ const uchar *rc= StringPack(&my_charset_bin, binary_length()).
+ unpack(buf, from, from_end, param_data);
+ memory_to_record((char *) to, (const char *) buf);
+ return rc;
+ }
+
+};
+
+
+#include "sql_type_fixedbin.h"
+typedef FixedBinTypeBundle<UUID> UUIDBundle;
+
+#endif // SQL_TYPE_UUID_INCLUDED
diff --git a/plugin/user_variables/mysql-test/user_variables/basic.result b/plugin/user_variables/mysql-test/user_variables/basic.result
index 3e6f1a3bb7e..07f51ee5607 100644
--- a/plugin/user_variables/mysql-test/user_variables/basic.result
+++ b/plugin/user_variables/mysql-test/user_variables/basic.result
@@ -29,13 +29,13 @@ SET @dec_var=CAST(1 AS DECIMAL(20, 10));
SET @time_var=CAST('2016-02-25' AS DATE);
SET @' @#^%'='Value of variable with odd name';
SET @''='Value of variable with empty name';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '='Value of variable with empty name'' at line 1
SET @null_var=NULL;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.USER_VARIABLES;
COUNT(*)
-10
+9
SELECT * FROM INFORMATION_SCHEMA.USER_VARIABLES ORDER BY VARIABLE_NAME;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_TYPE CHARACTER_SET_NAME
- Value of variable with empty name VARCHAR latin1
@#^% Value of variable with odd name VARCHAR latin1
dec_var 1.0000000000 DECIMAL latin1
double_var 1 DOUBLE latin1
@@ -47,7 +47,6 @@ uint_var 2 INT UNSIGNED latin1
utf8str_var UTF8 string value VARCHAR utf8mb3
SHOW USER_VARIABLES;
Variable_name Value
- Value of variable with empty name
@#^% Value of variable with odd name
dec_var 1.0000000000
double_var 1
diff --git a/plugin/user_variables/mysql-test/user_variables/basic.test b/plugin/user_variables/mysql-test/user_variables/basic.test
index 7e67e4fa5af..7432f6537a9 100644
--- a/plugin/user_variables/mysql-test/user_variables/basic.test
+++ b/plugin/user_variables/mysql-test/user_variables/basic.test
@@ -12,6 +12,7 @@ SET @double_var=CAST(1 AS DOUBLE);
SET @dec_var=CAST(1 AS DECIMAL(20, 10));
SET @time_var=CAST('2016-02-25' AS DATE);
SET @' @#^%'='Value of variable with odd name';
+--error ER_PARSE_ERROR
SET @''='Value of variable with empty name';
SET @null_var=NULL;
diff --git a/plugin/win_auth_client/handshake_client.cc b/plugin/win_auth_client/handshake_client.cc
index 28a228cc210..feeaae88d19 100644
--- a/plugin/win_auth_client/handshake_client.cc
+++ b/plugin/win_auth_client/handshake_client.cc
@@ -252,7 +252,7 @@ Blob Handshake_client::process_data(const Blob &data)
static byte test_buf[2048];
if (m_round == 1
- && DBUG_EVALUATE_IF("winauth_first_packet_test", true, false))
+ && DBUG_IF("winauth_first_packet_test"))
{
const char *env= getenv("TEST_PACKET_LENGTH");
size_t len= env ? atoi(env) : 0;
diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql
index ff4ca0fec80..a3bdc17a045 100644
--- a/scripts/fill_help_tables.sql
+++ b/scripts/fill_help_tables.sql
@@ -85,7 +85,7 @@ 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 (50,'Prepared Statements',1,'');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','Help Contents generated from the MariaDB Knowledge Base on 22 October 2022.','','');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,9,'HELP_VERSION','Help Contents generated for MariaDB 10.6 from the MariaDB Knowledge Base on 22 October 2022.','','');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,9,'HELP_VERSION','Help Contents generated for MariaDB 10.7 from the MariaDB Knowledge Base on 22 October 2022.','','');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'AREA','A synonym for ST_AREA.\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 (4,2,'CENTROID','A synonym for ST_CENTROID.\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 (5,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n\nURL: https://mariadb.com/kb/en/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/polygon-properties-exteriorring/');
@@ -377,565 +377,570 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example,
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (284,23,'VARBINARY','Syntax\n------\n\nVARBINARY(M)\n\nDescription\n-----------\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary byte\nstrings rather than non-binary character strings. M represents the maximum\ncolumn length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the\nnumeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the\nextra characters will be dropped with a warning. If strict mode is enabled, an\nerror will occur.\n\nUnlike BINARY values, VARBINARYs are not right-padded when inserting.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, RAW is a synonym for VARBINARY.\n\nExamples\n--------\n\nInserting too many characters, first with strict mode off, then 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| 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| 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\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 (285,23,'VARCHAR','Syntax\n------\n\n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,532. The effective maximum length of a\nVARCHAR is subject to the maximum row size and the character set used. For\nexample, utf8 characters can require up to three bytes per character, so a\nVARCHAR column that uses the utf8 character set can be declared to be a\nmaximum of 21,844 characters.\n\nNote: For the ColumnStore engine, M represents the maximum column length in\nbytes.\n\nMariaDB stores VARCHAR values as a one-byte or two-byte length prefix plus\ndata. The length prefix indicates the number of bytes in the value. A VARCHAR\ncolumn uses one length byte if values require no more than 255 bytes, two\nlength bytes if values may require more than 255 bytes.\n\nMariaDB follows the standard SQL specification, and does not remove trailing\nspaces from VARCHAR values.\n\nVARCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns\ncannot be part of an index. The CONNECT storage engine does not support\nVARCHAR(0).\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the standard\nSQL way to define that a VARCHAR column should use some predefined character\nset. MariaDB uses utf8 as this predefined character set, as does MySQL 4.1 and\nup. NVARCHAR is shorthand for NATIONAL VARCHAR.\n\nBefore MariaDB 10.2, all MariaDB collations were of type PADSPACE, meaning\nthat VARCHAR (as well as CHAR and TEXT values) are compared without regard for\ntrailing spaces. This does not apply to the LIKE pattern-matching operator,\nwhich takes into account trailing spaces. From MariaDB 10.2, a number of NO\nPAD collations are available.\n\nIf a unique index consists of a column where trailing pad characters are\nstripped or ignored, inserts into that column where values differ only by the\nnumber of trailing pad characters will result in a duplicate-key error.\n\nExamples\n--------\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----------\n\n* Depending on whether or not strict sql mode is set, you will either get a\nwarning or an error if you try to insert a string that is too long into a\nVARCHAR column. If the extra characters are spaces, the spaces that can\'t fit\nwill be removed and you will always get a warning, regardless of the sql mode\nsetting.\n\nDifference Between VARCHAR and TEXT\n-----------------------------------\n\n* VARCHAR columns can be fully indexed. TEXT columns can only be indexed over\na specified length.\n* Using TEXT or BLOB in a SELECT query that uses temporary tables for storing\nintermediate results will force the temporary table to be disk based (using\nthe Aria storage engine instead of the memory storage engine, which is a bit\nslower. This is not that bad as the Aria storage engine caches the rows in\nmemory. To get the benefit of this, one should ensure that the\naria_pagecache_buffer_size variable is big enough to hold most of the row and\nindex data for temporary tables.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, VARCHAR2 is a synonym.\n\nFor Storage Engine Developers\n-----------------------------\n\n* Internally the full length of the VARCHAR column is allocated inside each\nTABLE objects record[] structure. As there are three such buffers, each open\ntable will allocate 3 times max-length-to-store-varchar bytes of memory.\n* TEXT and BLOB columns are stored with a pointer (4 or 8 bytes) + a 1-4 bytes\nlength. The TEXT data is only stored once. This means that internally TEXT\nuses less memory for each open table but instead has the additional overhead\nthat each TEXT object needs to be allocated and freed for each row access\n(with some caching in between).\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 (286,23,'SET Data Type','Syntax\n------\n\nSET(\'value1\',\'value2\',...) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nDescription\n-----------\n\nA set. A string object that can have zero or more values, each of which must\nbe chosen from the list of values \'value1\', \'value2\', ... A SET column can\nhave a maximum of 64 members. SET values are represented internally as\nintegers.\n\nSET values cannot contain commas.\n\nIf a SET contains duplicate values, an error will be returned if strict mode\nis enabled, or a warning if strict mode is not enabled.\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 (287,23,'DATE','Syntax\n------\n\nDATE\n\nDescription\n-----------\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MariaDB displays\nDATE values in \'YYYY-MM-DD\' format, but can be assigned dates in looser\nformats, including strings or numbers, as long as they make sense. These\ninclude a short year, YY-MM-DD, no delimiters, YYMMDD, or any other acceptable\ndelimiter, for example YYYY/MM/DD. For details, see date and time literals.\n\n\'0000-00-00\' is a permitted special value (zero-date), unless the NO_ZERO_DATE\nSQL_MODE is used. Also, individual components of a date can be set to 0 (for\nexample: \'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is used. In many\ncases, the result of en expression involving a zero-date, or a date with\nzero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the\nday part is in the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATE);\n\nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"), (\'120314\'),(\'13*04*21\');\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\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 (288,23,'TIME','Syntax\n------\n\nTIME [(<microsecond precision>)]\n\nDescription\n-----------\n\nA time. The range is \'-838:59:59.999999\' to \'838:59:59.999999\'. Microsecond\nprecision can be from 0-6; if not specified 0 is used. Microseconds have been\navailable since MariaDB 5.3.\n\nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format, but allows\nassignment of times in looser formats, including \'D HH:MM:SS\', \'HH:MM:SS\',\n\'HH:MM\', \'D HH:MM\', \'D HH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for example \'3:9:10\'. For\ndetails, see date and time literals.\n\nMariaDB starting with 10.1.2\n----------------------------\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store TIMEs using the same low-level format MySQL 5.6\nuses.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace 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 the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_time\\G\n*************************** 1. row ***************************\n Table: mariadb5312_time\nCreate Table: CREATE TABLE `mariadb5312_time` (\n `t0` time /* mariadb-5.3 */ DEFAULT NULL,\n `t6` time(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nNote, columns with the current format are not marked with a comment.\n\nExamples\n--------\n\nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'), (800), (22), (151413),\n(\'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\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 (289,23,'DATETIME','Syntax\n------\n\nDATETIME [(microsecond precision)]\n\nDescription\n-----------\n\nA date and time combination.\n\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS.ffffff\' format, but\nallows assignment of values to DATETIME columns using either strings or\nnumbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store DATETMEs using the same low-level format MySQL\n5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the DATETIME data type in a format that\nsupports values between 1000-01-01 00:00:00.000000 and 9999-12-31\n23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nMariaDB also supports \'0000-00-00\' as a special zero-date value, unless\nNO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of\na date can be set to 0 (for example: \'2015-00-12\'), unless NO_ZERO_IN_DATE is\nspecified in the SQL_MODE. In many cases, the result of en expression\ninvolving a zero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range\nbetween 1 and 31, the date does not produce any error, even for months that\nhave less than 31 days.\n\nTime Zones\n----------\n\nIf a column uses the DATETIME data type, then any inserted values are stored\nas-is, so no automatic time zone conversions are performed.\n\nMariaDB also does not currently support time zone literals that contain time\nzone identifiers. See MDEV-11829 for more information.\n\nMariaDB validates DATETIME literals against the session\'s time zone. For\nexample, if a specific time range never occurred in a specific time zone due\nto daylight savings time, then DATETIME values within that range would be\ninvalid for that time zone.\n\nFor example, daylight savings time started on March 10, 2019 in the US, so the\ntime range between 02:00:00 and 02:59:59 is invalid for that day in US time\nzones:\n\nSET time_zone = \'America/New_York\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nERROR 1292 (22007): Incorrect datetime value: \'2019-03-10 02:55:05\' for column\n`db1`.`timestamp_test`.`timestamp_test` at row 1\n\nBut that same time range is fine in other time zones, such as Coordinated\nUniversal Time (UTC). For example:\n\nSET time_zone = \'UTC\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nQuery OK, 1 row affected (0.002 sec)\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace 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 the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_datetime\\G\n*************************** 1. row ***************************\n Table: mariadb5312_datetime\nCreate Table: CREATE TABLE `mariadb5312_datetime` (\n `dt0` datetime /* mariadb-5.3 */ DEFAULT NULL,\n `dt6` datetime(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\n\nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t1;\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 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t2;\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 to datetime(6).\nIf you want to have a datetime without seconds, you should use\nCONVERT(..,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\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 (290,23,'TIMESTAMP','Syntax\n------\n\nTIMESTAMP [(<microsecond precision)]\n\nDescription\n-----------\n\nA timestamp in the format YYYY-MM-DD HH:MM:SS.ffffff.\n\nThe timestamp field is generally used to define at which moment in time a row\nwas added or updated and by default will automatically be assigned the current\ndatetime when a record is inserted or updated. The automatic properties only\napply to the first TIMESTAMP in the record; subsequent TIMESTAMP columns will\nnot be changed.\n\nMariaDB includes the --mysql56-temporal-format option, on by default, which\nallows MariaDB to store TIMESTAMPs using the same low-level format MySQL 5.6\nuses.\n\nFor more information, see Internal Format.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the TIMESTAMP data type as the number of\nseconds since \'1970-01-01 00:00:00\' (UTC). This means that the TIMESTAMP data\ntype can hold values between \'1970-01-01 00:00:01\' (UTC) and \'2038-01-19\n03:14:07\' (UTC).\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nAutomatic Values\n----------------\n\nMariaDB has special behavior for the first column that uses the TIMESTAMP data\ntype in a specific table. For the first column that uses the TIMESTAMP data\ntype in a specific table, MariaDB automatically assigns the following\nproperties to the column:\n\n* DEFAULT CURRENT_TIMESTAMP\n* ON UPDATE CURRENT_TIMESTAMP\n\nThis means that if the column is not explicitly assigned a value in an INSERT\nor UPDATE query, then MariaDB will automatically initialize the column\'s value\nwith the current date and time.\n\nThis automatic initialization for INSERT and UPDATE queries can also be\nexplicitly enabled for a column that uses the TIMESTAMP data type by\nspecifying the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP\nclauses for the column. In these clauses, any synonym of CURRENT_TIMESTAMP is\naccepted, including CURRENT_TIMESTAMP(), NOW(), LOCALTIME, LOCALTIME(),\nLOCALTIMESTAMP, and LOCALTIMESTAMP().\n\nThis automatic initialization for INSERT queries can also be explicitly\ndisabled for a column that uses the TIMESTAMP data type by specifying a\nconstant DEFAULT value. For example, DEFAULT 0.\n\nThis automatic initialization for UPDATE queries can also be explicitly\ndisabled for a column that uses the TIMESTAMP data type by specifying a\nDEFAULT clause for the column, but no ON UPDATE clause. If a DEFAULT clause is\nexplicitly specified for a column that uses the TIMESTAMP data type, but an ON\nUPDATE clause is not specified for the column, then the timestamp value will\nnot automatically change when an UPDATE statement is executed.\n\nMariaDB also has special behavior if NULL is assigned to column that uses the\nTIMESTAMP data type. If the column is assigned the NULL value in an INSERT or\nUPDATE query, then MariaDB will automatically initialize the column\'s value\nwith the current date and time. For details, see NULL values in MariaDB.\n\nThis automatic initialization for NULL values can also be explicitly disabled\nfor a column that uses the TIMESTAMP data type by specifying the NULL\nattribute for the column. In this case, if the column\'s value is set to NULL,\nthen the column\'s value will actually be set to NULL.\n\nTime Zones\n----------\n\nIf a column uses the TIMESTAMP data type, then any inserted values are\nconverted from the session\'s time zone to Coordinated Universal Time (UTC)\nwhen stored, and converted back to the session\'s time zone when retrieved.\n\nMariaDB does not currently store any time zone identifier with the value of\nthe TIMESTAMP data type. See MDEV-10018 for more information.\n\nMariaDB does not currently support time zone literals that contain time zone\nidentifiers. See MDEV-11829 for more information.\n\nLimitations\n-----------\n\n* Because the TIMESTAMP value is stored as Epoch Seconds, the timestamp value\n\'1970-01-01 00:00:00\' (UTC) is reserved since the second #0 is used to\nrepresent \'0000-00-00 00:00:00\'.\n* In MariaDB 5.5 and before there could only be one TIMESTAMP column per table\nthat had CURRENT_TIMESTAMP defined as its default value. This limit has no\nlonger applied since MariaDB 10.0.\n\nSQL_MODE=MAXDB\n--------------\n\nIf the SQL_MODE is set to MAXDB, TIMESTAMP fields will be silently converted\nto DATETIME.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIMESTAMP 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 TIMESTAMP;\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_timestamp\\G\n*************************** 1. row ***************************\n Table: mariadb5312_timestamp\nCreate Table: CREATE TABLE `mariadb5312_timestamp` (\n `ts0` timestamp /* mariadb-5.3 */ NOT NULL DEFAULT current_timestamp() ON\nUPDATE current_timestamp(),\n `ts6` timestamp(6) /* mariadb-5.3 */ NOT NULL DEFAULT \'0000-00-00\n00:00:00.000000\'\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nNote: Prior to MySQL 4.1 a different format for the TIMESTAMP datatype was\nused. This format is unsupported in MariaDB 5.1 and upwards.\n\nExamples\n--------\n\nCREATE TABLE t (id INT, ts TIMESTAMP);\n\nDESC t;\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n| Field | Type | Null | Key | Default | Extra \n |\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n| id | int(11) | YES | | NULL | \n |\n| ts | timestamp | NO | | CURRENT_TIMESTAMP | on update\nCURRENT_TIMESTAMP |\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n\nINSERT INTO t(id) VALUES (1),(2);\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 1 | 2013-07-22 12:50:05 |\n| 2 | 2013-07-22 12:50:05 |\n+------+---------------------+\n\nINSERT INTO t VALUES (3,NULL),(4,\'2001-07-22 12:12:12\');\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 1 | 2013-07-22 12:50:05 |\n| 2 | 2013-07-22 12:50:05 |\n| 3 | 2013-07-22 12:51:56 |\n| 4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nConverting to Unix epoch:\n\nSELECT ts, UNIX_TIMESTAMP(ts) FROM t;\n+---------------------+--------------------+\n| ts | UNIX_TIMESTAMP(ts) |\n+---------------------+--------------------+\n| 2013-07-22 12:50:05 | 1374490205 |\n| 2013-07-22 12:50:05 | 1374490205 |\n| 2013-07-22 12:51:56 | 1374490316 |\n| 2001-07-22 12:12:12 | 995796732 |\n+---------------------+--------------------+\n\nUpdate also changes the timestamp:\n\nUPDATE t set id=5 WHERE id=1;\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 5 | 2013-07-22 14:52:33 |\n| 2 | 2013-07-22 12:50:05 |\n| 3 | 2013-07-22 12:51:56 |\n| 4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nDefault NULL:\n\nCREATE TABLE t2 (id INT, ts TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP);\n\nINSERT INTO t(id) VALUES (1),(2);\n\nSELECT * FROM t2;\n\nINSERT INTO t2(id) VALUES (1),(2);\n\nSELECT * FROM t2;\n+------+------+\n| id | ts |\n+------+------+\n| 1 | NULL |\n| 2 | NULL |\n+------+------+\n\nUPDATE t2 SET id=3 WHERE id=1;\n\nSELECT * FROM t2;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 3 | 2013-07-22 15:32:22 |\n| 2 | NULL |\n+------+---------------------+\n\nOnly the first timestamp is automatically inserted and updated:\n\nCREATE TABLE t3 (id INT, ts1 TIMESTAMP, ts2 TIMESTAMP);\n\nINSERT INTO t3(id) VALUES (1),(2);\n\nSELECT * FROM t3;\n+------+---------------------+---------------------+\n| id | ts1 | ts2 |\n+------+---------------------+---------------------+\n| 1 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 2 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n+------+---------------------+---------------------+\n\nDESC t3;\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n| Field | Type | Null | Key | Default | Extra \n |\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n| id | int(11) | YES | | NULL | \n |\n| ts1 | timestamp | NO | | CURRENT_TIMESTAMP | on update\nCURRENT_TIMESTAMP |\n| ts2 | timestamp | NO | | 0000-00-00 00:00:00 | \n |\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n\nExplicitly setting a timestamp with the CURRENT_TIMESTAMP function:\n\nINSERT INTO t3(id,ts2) VALUES (3,CURRENT_TIMESTAMP());\n\nSELECT * FROM t3;\n+------+---------------------+---------------------+\n| id | ts1 | ts2 |\n+------+---------------------+---------------------+\n| 1 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 2 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 3 | 2013-07-22 15:38:52 | 2013-07-22 15:38:52 |\n+------+---------------------+---------------------+\n\nSpecifying the timestamp as NOT NULL:\n\nCREATE TABLE t4 (id INT, ts TIMESTAMP NOT NULL);\n\nINSERT INTO t4(id) VALUES (1);\nSELECT SLEEP(1);\nINSERT INTO t4(id,ts) VALUES (2,NULL);\n\nSELECT * FROM t4;\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 (291,23,'YEAR Data Type','Syntax\n------\n\nYEAR[(4)]\n\nDescription\n-----------\n\nA year in two-digit or four-digit format. The default is four-digit format.\nNote that the two-digit format has been deprecated since MariaDB 5.5.27.\n\nIn four-digit format, the allowable values are 1901 to 2155, and 0000. In\ntwo-digit format, the allowable values are 70 to 69, representing years from\n1970 to 2069. MariaDB displays YEAR values in YYYY format, but allows you to\nassign values to YEAR columns using either strings or numbers.\n\nInserting numeric zero has a different result for YEAR(4) and YEAR(2). For\nYEAR(2), the value 00 reflects the year 2000. For YEAR(4), the value 0000\nreflects the year zero. This only applies to numeric zero. String zero always\nreflects the year 2000.\n\nExamples\n--------\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\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nOut of range:\n\nINSERT INTO y VALUES (1005),(\'3080\');\nERROR 1264 (22003): Out of range value for column \'y\' at row 1\n\nINSERT INTO y VALUES (\'2013-12-12\');\nERROR 1265 (01000): Data truncated for column \'y\' at row 1\n\nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n+------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\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 row 1 |\n| Warning | 1264 | Out of range value for column \'y\' at row 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\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 numeric 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 removed in a future\nrelease. \n Please use YEAR(4) instead\n\nINSERT INTO y2 VALUES(0,0),(\'0\',\'0\');\n\nSELECT YEAR(y),YEAR(y2) FROM y2;\n+---------+----------+\n| YEAR(y) | YEAR(y2) |\n+---------+----------+\n| 0 | 2000 |\n| 2000 | 2000 |\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 (292,23,'AUTO_INCREMENT','Description\n-----------\n\nThe AUTO_INCREMENT attribute can be used to generate a unique identity for new\nrows. When you insert a new record to the table (or upon adding an\nAUTO_INCREMENT attribute with the ALTER TABLE statement), and the\nauto_increment field is NULL or DEFAULT (in the case of an INSERT), the value\nwill automatically be incremented. This also applies to 0, unless the\nNO_AUTO_VALUE_ON_ZERO SQL_MODE is enabled.\n\nAUTO_INCREMENT columns start from 1 by default. The automatically generated\nvalue can never be lower than 0.\n\nEach table can have only one AUTO_INCREMENT column. It must defined as a key\n(not necessarily the PRIMARY KEY or UNIQUE key). In some storage engines\n(including the default InnoDB), if the key consists of multiple columns, the\nAUTO_INCREMENT column must be the first column. Storage engines that permit\nthe column to be placed elsewhere are Aria, MyISAM, MERGE, Spider, TokuDB,\nBLACKHOLE, FederatedX and 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| 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 AUTO_INCREMENT UNIQUE.\n\nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n\nSHOW CREATE TABLE t \\G\n*************************** 1. row ***************************\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--------------------------------------------\n\nYou can use an ALTER TABLE statement to assign a new value to the\nauto_increment table option, or set the insert_id server system variable to\nchange the next AUTO_INCREMENT value inserted by the current session.\n\nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT value inserted by\nthe current session.\n\nALTER TABLE animals AUTO_INCREMENT=8;\n\nINSERT INTO animals (name) VALUES (\'aardvark\');\n\nSELECT * FROM animals;\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| 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\n------\n\nUntil MariaDB 10.2.3, InnoDB used an auto-increment counter that is stored in\nmemory. When the server restarts, the counter is re-initialized to the highest\nvalue used in the table, which cancels the effects of any AUTO_INCREMENT = N\noption in the table statements.\n\nFrom MariaDB 10.2.4, this restriction has been lifted and AUTO_INCREMENT is\npersistent.\n\nSee also AUTO_INCREMENT Handling in InnoDB.\n\nSetting Explicit Values\n-----------------------\n\nIt is possible to specify a value for an AUTO_INCREMENT column. If the key is\nprimary or unique, the value must not already exist in the key.\n\nIf the new value is higher than the current maximum value, the AUTO_INCREMENT\nvalue is updated, so the next value will be higher. If the new value is lower\nthan the current maximum value, the AUTO_INCREMENT value remains unchanged.\n\nThe following example demonstrates these behaviors:\n\nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE =\nInnoDB;\n\nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n+----+\n| id |\n+----+\n| 1 |\n+----+\n\nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\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| id |\n+----+\n| 1 |\n| 2 |\n| 10 |\n| 11 |\n+----+\n\nThe ARCHIVE storage engine does not allow to insert a value that is lower than\nthe current maximum.\n\nMissing Values\n--------------\n\nAn AUTO_INCREMENT column normally has missing values. This happens because if\na row is deleted, or an AUTO_INCREMENT value is explicitly updated, old values\nare never re-used. The REPLACE statement also deletes a row, and its value is\nwasted. With InnoDB, values can be reserved by a transaction; but if the\ntransaction fails (for example, because of a ROLLBACK) the reserved value will\nbe lost.\n\nThus AUTO_INCREMENT values can be used to sort results in a chronological\norder, but not to create a numeric sequence.\n\nReplication\n-----------\n\nTo make master-master or Galera safe to use AUTO_INCREMENT one should use the\nsystem variables auto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n\nCHECK Constraints, DEFAULT Values and Virtual Columns\n-----------------------------------------------------\n\nMariaDB starting with 10.2.6\n----------------------------\nFrom MariaDB 10.2.6 auto_increment columns are no longer permitted in CHECK\nconstraints, DEFAULT value expressions and virtual columns. They were\npermitted in earlier versions, but did not work correctly. See MDEV-11117.\n\nGenerating Auto_Increment Values When Adding the Attribute\n----------------------------------------------------------\n\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (0),(0),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 1 |\n| 2 |\n| 3 |\n+---+\n\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (5),(0),(8),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 5 |\n| 6 |\n| 8 |\n| 9 |\n+---+\n\nIf the NO_AUTO_VALUE_ON_ZERO SQL_MODE is set, zero values will not be\nautomatically incremented:\n\nSET SQL_MODE=\'no_auto_value_on_zero\';\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (3), (0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 0 |\n| 3 |\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 (293,24,'Using Compound Statements Outside of Stored Programs','Compound statements can also be used outside of stored programs.\n\ndelimiter |\nIF @have_innodb THEN\n CREATE TABLE IF NOT EXISTS innodb_index_stats (\n database_name VARCHAR(64) NOT NULL,\n table_name VARCHAR(64) NOT NULL,\n index_name VARCHAR(64) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE\nCURRENT_TIMESTAMP,\n stat_name VARCHAR(64) NOT NULL,\n stat_value BIGINT UNSIGNED NOT NULL,\n sample_size BIGINT UNSIGNED,\n stat_description VARCHAR(1024) NOT NULL,\n PRIMARY KEY (database_name, table_name, index_name, stat_name)\n ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;\nEND IF|\nQuery OK, 0 rows affected, 2 warnings (0.00 sec)\n\nNote, that using compound statements this way is subject to following\nlimitations:\n\n* Only BEGIN, IF, CASE, LOOP, WHILE, REPEAT statements may start a compound\nstatement outside of stored programs.\n* BEGIN must use the BEGIN NOT ATOMIC syntax (otherwise it\'ll be confused with\nBEGIN that starts a transaction).\n* A compound statement might not start with a label.\n* A compound statement is parsed completely—note \"2 warnings\" in the above\nexample, even if the condition was false (InnoDB was, indeed, disabled), and\nthe CREATE TABLE statement was not executed, it was still parsed and the\nparser produced \"Unknown storage engine\" warning.\n\nInside a compound block first three limitations do not apply, one can use\nanything that can be used inside a stored program — including labels,\ncondition handlers, variables, and so on:\n\nBEGIN NOT ATOMIC\n DECLARE foo CONDITION FOR 1146;\n DECLARE x INT DEFAULT 0;\n DECLARE CONTINUE HANDLER FOR SET x=1;\n INSERT INTO test.t1 VALUES (\"hndlr1\", val, 2);\n END|\n\nExample how to use IF:\n\nIF (1>0) THEN BEGIN NOT ATOMIC SELECT 1; END ; END IF;;\n\nExample of how to use WHILE loop:\n\nDELIMITER |\nBEGIN NOT ATOMIC\n DECLARE x INT DEFAULT 0;\n WHILE x <= 10 DO\n SET x = x + 1;\n SELECT x;\n END WHILE;\nEND|\nDELIMITER ;\n\nURL:\nhttps://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/','','https://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (294,24,'BEGIN END','Syntax\n------\n\n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n\nNOT ATOMIC is required when used outside of a stored procedure. Inside stored\nprocedures or within an anonymous block, BEGIN alone starts a new anonymous\nblock.\n\nDescription\n-----------\n\nBEGIN ... END syntax is used for writing compound statements. A compound\nstatement can contain multiple statements, enclosed by the BEGIN and END\nkeywords. statement_list represents a list of one or more statements, each\nterminated by a semicolon (i.e., ;) statement delimiter. statement_list is\noptional, which means that the empty compound statement (BEGIN END) is legal.\n\nNote that END will perform a commit. If you are running in autocommit mode,\nevery statement will be committed separately. If you are not running in\nautocommit mode, you must 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 send statement\nstrings containing the ; statement delimiter. This is handled in the mysql\ncommand-line client with the DELIMITER command. Changing the ;\nend-of-statement delimiter (for example, to //) allows ; to be used in a\nprogram body.\n\nA compound statement within a stored program can be labeled. end_label cannot\nbe given unless begin_label also is present. If both are present, they must be\nthe same.\n\nBEGIN ... END constructs can be nested. Each block can define its own\nvariables, a CONDITION, a HANDLER and a CURSOR, which don\'t exist in the outer\nblocks. The most local declarations override the outer objects which use the\nsame name (see example below).\n\nThe declarations order is the following:\n\n* DECLARE local variables;\n* DECLARE CONDITIONs;\n* DECLARE CURSORs;\n* DECLARE HANDLERs;\n\nNote that DECLARE HANDLER contains another BEGIN ... END construct.\n\nHere is an example of a very simple, anonymous block:\n\nBEGIN NOT ATOMIC\nSET @a=1;\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 BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n SELECT x, y;\n END;\n SELECT x;\nEND;\n\nIn this example, a TINYINT variable, x is declared in the outter block. But in\nthe inner block x is re-declared as a CHAR and an y variable is declared. The\ninner SELECT shows the \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned. The final SELECT\ndoesn\'t try to read y, because it doesn\'t exist in that context.\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 (295,24,'CASE Statement','Syntax\n------\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-----------\n\nThe text on this page describes the CASE statement for stored programs. See\nthe CASE OPERATOR for details on the CASE operator outside of stored programs.\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct. If a search_condition evaluates to true, the corresponding SQL\nstatement list is executed. If no search condition matches, the statement list\nin the ELSE clause is executed. Each statement_list consists of one or more\nstatements.\n\nThe CASE statement cannot have an ELSE NULL clause, and it is terminated with\nEND CASE instead of END. implements a complex conditional construct. If a\nsearch_condition evaluates to true, the corresponding SQL statement list is\nexecuted. If no search condition matches, the statement list in the ELSE\nclause is executed. Each statement_list consists of one or more statements.\n\nIf no when_value or search_condition matches the value tested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE statement error\nresults.\n\nEach statement_list consists of one or more statements; an empty\nstatement_list is not allowed. To handle situations where no value is matched\nby any WHEN clause, use an ELSE containing an empty BEGIN ... END block, as\nshown in this example:\n\nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE BEGIN END;\n END CASE;\nEND;\n|\n\nThe indentation used here in the ELSE clause is for purposes of clarity only,\nand is not otherwise significant. See Delimiters in the mysql client for more\non the use of the delimiter command.\n\nNote: The syntax of the CASE statement used inside stored programs differs\nslightly from that of the SQL CASE expression described in CASE OPERATOR. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated with END\nCASE instead of END.\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 (296,24,'DECLARE CONDITION','Syntax\n------\n\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n\nDescription\n-----------\n\nThe DECLARE ... CONDITION statement defines a named error condition. It\nspecifies a condition that needs specific handling and associates a name with\nthat condition. Later, the name can be used in a DECLARE ... HANDLER, SIGNAL\nor RESIGNAL statement (as long as the statement is located in the same BEGIN\n... END block).\n\nConditions must be declared after local variables, but before CURSORs and\nHANDLERs.\n\nA condition_value for DECLARE ... CONDITION can be an SQLSTATE value (a\n5-character string literal) or a MySQL error code (a number). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because those indicate\nsucess rather than an error condition. If you try, or if you specify an\ninvalid SQLSTATE value, an error like this is produced:\n\nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\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 (297,24,'DECLARE HANDLER','Syntax\n------\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-----------\n\nThe DECLARE ... HANDLER statement specifies handlers that each may deal with\none or more conditions. If one of these conditions occurs, the specified\nstatement is executed. statement can be a simple statement (for example, SET\nvar_name = value), or it can be a compound statement written using BEGIN and\nEND.\n\nHandlers must be declared after local variables, a CONDITION and a CURSOR.\n\nFor a CONTINUE handler, execution of the current program continues after\nexecution of the handler statement. For an EXIT handler, execution terminates\nfor the BEGIN ... END compound statement in which the handler is declared.\n(This is true even if the condition occurs in an inner block.) The UNDO\nhandler type statement is not supported.\n\nIf a condition occurs for which no handler has been declared, the default\naction is EXIT.\n\nA condition_value for DECLARE ... HANDLER can be any of the following values:\n\n* An SQLSTATE value (a 5-character string literal) or a MariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\' or MariaDB\nerror code 0, because those indicate sucess rather than an error\ncondition. For a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n* A condition name previously specified with DECLARE ... CONDITION. It must be\nin the same stored program. See DECLARE CONDITION.\n* SQLWARNING is shorthand for the class of SQLSTATE values that begin\nwith \'01\'.\n* NOT FOUND is shorthand for the class of SQLSTATE values that begin\nwith \'02\'. This is relevant only the context of cursors and is used to\ncontrol what happens when a cursor reaches the end of a data set. If\nno more rows are available, a No Data condition occurs with SQLSTATE\nvalue 02000. To detect this condition, you can set up a handler for it\n(or for a NOT FOUND condition). An example is shown in Cursor Overview. This\ncondition also occurs for SELECT ... INTO var_list statements that retrieve no\nrows.\n* SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\nnot begin with \'00\', \'01\', or \'02\'.\n\nWhen an error raises, in some cases it could be handled by multiple HANDLERs.\nFor example, there may be an handler for 1050 error, a separate handler for\nthe 42S01 SQLSTATE, and another separate handler for the SQLEXCEPTION class:\nin theory all occurrences of HANDLER may catch the 1050 error, but MariaDB\nchooses the HANDLER with the highest precedence. Here are the precedence rules:\n\n* Handlers which refer to an error code have the highest precedence.\n* Handlers which refer to a SQLSTATE come next.\n* Handlers which refer to an error class have the lowest precedence.\n\nIn some cases, a statement could produce multiple errors. If this happens, in\nsome cases multiple handlers could have the highest precedence. In such cases,\nthe choice of the handler is indeterminate.\n\nNote that if an error occurs within a CONTINUE HANDLER block, it can be\nhandled by another HANDLER. However, a HANDLER which is already in the stack\n(that is, it has been called to handle an error and its execution didn\'t\nfinish yet) cannot handle new errors—this prevents endless loops. For example,\nsuppose that a stored procedure contains a CONTINUE HANDLER for SQLWARNING and\nanother CONTINUE HANDLER for NOT FOUND. At some point, a NOT FOUND error\noccurs, and the execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the SQLWARNING HANDLER. If\nanother NOT FOUND error occurs, it cannot be handled again by the NOT FOUND\nHANDLER, because its execution is not finished.\n\nWhen a DECLARE HANDLER block can handle more than one error condition, it may\nbe useful to know which errors occurred. To do so, you can use the GET\nDIAGNOSTICS statement.\n\nAn error that is handled by a DECLARE HANDLER construct can be issued again\nusing 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 = 1;\n SET @x = 1;\n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n END;\n //\n\nDELIMITER ;\n\nCALL handlerdemo( );\n\nSELECT @x;\n+------+\n| @x |\n+------+\n| 3 |\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 (298,24,'DECLARE Variable','Syntax\n------\n\nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type [DEFAULT value]\n\nDescription\n-----------\n\nThis statement is used to declare local variables within stored programs. To\nprovide a default value for the variable, include a DEFAULT clause. The value\ncan be specified as an expression (even subqueries are permitted); it need not\nbe a constant. If the DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect to\ndata type and overflow checking. See CREATE PROCEDURE.\n\nLocal variables must be declared before CONDITIONs, CURSORs and HANDLERs.\n\nLocal variable names are not case sensitive.\n\nThe scope of a local variable is within the BEGIN ... END block where it is\ndeclared. The variable can be referred to in blocks nested within the\ndeclaring block, except those blocks that declare a variable with the same\nname.\n\nTYPE OF / ROW TYPE OF\n---------------------\n\nMariaDB starting with 10.3\n--------------------------\nTYPE OF and ROW TYPE OF anchored data types for stored routines were\nintroduced in MariaDB 10.3.\n\nAnchored data types allow a data type to be defined based on another object,\nsuch as a table row, rather than specifically set in the declaration. If the\nanchor object changes, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type in the table is\nchanged, it will automatically be changed in the routine as well.\n\nVariables declared with ROW TYPE OF will have the same features as implicit\nROW variables. It is not possible to use ROW TYPE OF variables in a LIMIT\nclause.\n\nThe real data type of TYPE OF and ROW TYPE OF table_name will become known at\nthe very beginning of the stored routine call. ALTER TABLE or DROP TABLE\nstatements performed inside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored variables, even if the\nvariable is declared after an ALTER TABLE or DROP TABLE statement.\n\nThe real data type of a ROW TYPE OF cursor_name variable will become known\nwhen execution enters into the block where the variable is declared. Data type\ninstantiation will happen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on the very first\niteration and won\'t change on further loop iterations.\n\nThe tables referenced in TYPE OF and ROW TYPE OF declarations will be checked\nfor existence at the beginning of the stored routine call. CREATE PROCEDURE or\nCREATE FUNCTION will not check the referenced tables for existence.\n\nExamples\n--------\n\nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n\nDECLARE tmp TYPE OF t1.a; -- Get the data type from the column {{a}} in the\ntable {{t1}}\n\nDECLARE rec1 ROW TYPE OF t1; -- Get the row data type from the table {{t1}}\n\nDECLARE rec2 ROW TYPE OF cur1; -- Get the row data type from the cursor\n{{cur1}}\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 (299,24,'FOR','MariaDB starting with 10.3\n--------------------------\nFOR loops were introduced in MariaDB 10.3.\n\nSyntax\n------\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 [ ( cursor_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 [ ( cursor_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-----------\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 bound and upper\nbound values, and assign the lower bound value to a counter. If REVERSE is not\nspecified, and the upper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will continue, after which\nthe loop is entered again. If the upper bound value is greater than the\ncounter, the loop will be exited.\n\nIf REVERSE is specified, the counter is decremented, and the upper bound value\nneeds to be less than or equal for the loop to continue.\n\nExamples\n--------\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\nDELIMITER ;\n\nSELECT * FROM t1;\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 4..12\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n//\nQuery OK, 9 rows affected (0.422 sec)\n\nDELIMITER ;\n\nSELECT * FROM t1;\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;\nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n END LOOP;\nEND;\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\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 (300,24,'GOTO','MariaDB starting with 10.3\n--------------------------\nThe GOTO statement was introduced in MariaDB 10.3 for Oracle compatibility.\n\nSyntax\n------\n\nGOTO label\n\nDescription\n-----------\n\nThe GOTO statement causes the code to jump to the specified label, and\ncontinue operating from there. It is only accepted when in Oracle mode.\n\nExample\n-------\n\nSET sql_mode=ORACLE;\n\nDELIMITER //\n\nCREATE OR REPLACE PROCEDURE p1 AS\n\nBEGIN\n\nSELECT 1;\n GOTO label;\n SELECT 2;\n <<label>>\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\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 (301,24,'IF','Syntax\n------\n\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF;\n\nDescription\n-----------\n\nIF implements a basic conditional construct. If the search_condition evaluates\nto true, the corresponding SQL statement list is executed. If no\nsearch_condition matches, the statement list in the ELSE clause is executed.\nEach statement_list consists of one or more statements.\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 (302,24,'ITERATE','Syntax\n------\n\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements. ITERATE\nmeans \"do the loop again\", and uses the statement\'s label to determine which\nstatements to repeat. The 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 the label is\nassociated to a construct which is not a loop, the following error will be\nproduced:\n\nERROR 1308 (42000): ITERATE with no matching label: <label_name>\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 IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND\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 (303,24,'Labels','Syntax\n------\n\nlabel: <construct>\n[label]\n\nLabels are MariaDB identifiers which can be used to identify a BEGIN ... END\nconstruct or a loop. They have a maximum length of 16 characters and can be\nquoted with backticks (i.e.., `).\n\nLabels have a start part and an end part. The start part must precede the\nportion of code it refers to, must be followed by a colon (:) and can be on\nthe same or different line. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must precede the\nconstruct\'s delimiter (;). Constructs identified by a label can be nested.\nEach construct can be identified by only one label.\n\nLabels need not be unique in the stored program they belong to. However, a\nlabel for an inner loop cannot be identical to a label for an outer loop. In\nthis case, the following error would be produced:\n\nERROR 1309 (42000): Redefining label <label_name>\n\nLEAVE and ITERATE statements can be used to exit or repeat a portion of code\nidentified by a label. They must be in the same Stored Routine, Trigger or\nEvent which contains the target label.\n\nBelow is an example using a simple label that is used to exit a LOOP:\n\nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n LEAVE `my_label`;\n END LOOP;\n SELECT \'out of loop\';\nEND;\n\nThe following label is used to exit a procedure, and has an end part:\n\nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n END IF;\n DO something();\nEND `my_label`;\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 (304,24,'LEAVE','Syntax\n------\n\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the given\nlabel. The label must be in the same stored program, not in a caller\nprocedure. LEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE). In Stored Procedures, Triggers and Events, LEAVE can refer to\nthe outmost BEGIN ... END construct; in that case, the program exits the\nprocedure. In Stored Functions, RETURN can be used instead.\n\nNote that LEAVE cannot be used to exit a DECLARE HANDLER block.\n\nIf you try to LEAVE a non-existing label, or if you try to LEAVE a HANDLER\nblock, the following error will be produced:\n\nERROR 1308 (42000): LEAVE with no matching label: <label_name>\n\nThe following example uses LEAVE to exit the procedure if a condition is true:\n\nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n IF p < 1 THEN\n LEAVE `whole_proc`;\n END IF;\n SELECT 2;\nEND;\n\nCALL proc(0);\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\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 (305,24,'LOOP','Syntax\n------\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nDescription\n-----------\n\nLOOP implements a simple loop construct, enabling repeated execution of the\nstatement list, which consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter. The statements within the loop are\nrepeated until the loop is exited; usually this is accomplished with a LEAVE\nstatement.\n\nA LOOP statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on delimiter usage in the client.\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 (306,24,'REPEAT LOOP','Syntax\n------\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 until the\nsearch_condition is true. Thus, a REPEAT always enters the loop at least once.\nstatement_list consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter.\n\nA REPEAT statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on client delimiter usage.\n\nDELIMITER //\n\nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n END\n//\n\nCALL dorepeat(1000)//\n\nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\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 (307,24,'RESIGNAL','Syntax\n------\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 = <error_property_value>\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-----------\n\nThe syntax of RESIGNAL and its semantics are very similar to SIGNAL. This\nstatement can only be used within an error HANDLER. It produces an error, like\nSIGNAL. RESIGNAL clauses are the same as SIGNAL, except that they all are\noptional, even SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error that was received\nby the error HANDLER. For a description of the clauses, see diagnostics area.\n\nNote that RESIGNAL does not empty the diagnostics area: it just appends\nanother error condition.\n\nRESIGNAL, without any clauses, produces an error which is identical to the\nerror that was received by HANDLER.\n\nIf used out of a HANDLER construct, RESIGNAL produces the following error:\n\nERROR 1645 (0K000): RESIGNAL when handler not active\n\nIn MariaDB 5.5, if a HANDLER contained a CALL to another procedure, that\nprocedure could use RESIGNAL. Since MariaDB 10.0, trying to do this raises the\nabove error.\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nThe following procedure tries to query two tables which don\'t exist, producing\na 1146 error in both cases. Those errors will trigger the HANDLER. The first\ntime the error will be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will receive 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 END IF;\n END;\n SET @hide_errors = TRUE;\n SELECT \'Next error will be ignored\' AS msg;\n SELECT `c` FROM `temptab_one`;\n SELECT \'Next error won\'\'t be ignored\' AS msg;\n SET @hide_errors = FALSE;\n SELECT `c` FROM `temptab_two`;\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 exist\n\nThe following procedure re-signals an error, modifying only the error message\nto 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 END;\n SELECT `c` FROM `temptab`;\nEND;\n\nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n\nAs explained above, this works on MariaDB 5.5, but produces a 1645 error since\n10.0.\n\nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\nEND;\nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\nEND;\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 (308,24,'RETURN','Syntax\n------\n\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and returns the\nvalue expr to the function caller. There must be at least one RETURN statement\nin a stored function. If the function has multiple exit points, all exit\npoints must have a RETURN.\n\nThis statement is not used in stored procedures, triggers, or events. LEAVE\ncan be used instead.\n\nThe following example shows that RETURN can return the result of a scalar\nsubquery:\n\nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\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 (309,24,'SELECT INTO','Syntax\n------\n\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nDescription\n-----------\n\nSELECT ... INTO enables selected columns to be stored directly into variables.\nNo resultset is produced. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and the\nvariable values remain unchanged. If the query returns multiple rows, error\n1172 occurs (Result consisted of more than one row). If it is possible that\nthe statement may retrieve multiple rows, you can use LIMIT 1 to limit the\nresult set to a single row.\n\nThe INTO clause can also be specified at the end of the statement.\n\nIn the context of such statements that occur as part of events executed by the\nEvent Scheduler, diagnostics messages (not only errors, but also warnings) are\nwritten to the error log, and, on Windows, to the application event log.\n\nThis statement can be used with both local variables and user-defined\nvariables.\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 even if SQL_CACHE is\nspecified.\n\nExamples\n--------\n\nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\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 (310,24,'SIGNAL','Syntax\n------\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 = <error_property_value>\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 error. This\nstatement can be used anywhere, but is generally useful when used inside a\nstored program. When the error is produced, it can be caught by a HANDLER. If\nnot, the current stored program, or the current statement, will terminate with\nthe specified error.\n\nSometimes an error HANDLER just needs to SIGNAL the same error it received,\noptionally with some changes. Usually the RESIGNAL statement is the most\nconvenient way to do this.\n\nerror_condition can be an SQLSTATE value or a named error condition defined\nvia DECLARE CONDITION. SQLSTATE must be a constant string consisting of five\ncharacters. These codes are standard to ODBC and ANSI SQL. For customized\nerrors, the recommended SQLSTATE is \'45000\'. For a list of SQLSTATE values\nused by MariaDB, see the MariaDB Error Codes page. The SQLSTATE can be read\nvia the API method mysql_sqlstate( ).\n\nTo specify error properties user-defined variables and local variables can be\nused, as well as character set conversions (but you can\'t set a collation).\n\nThe error properties, their type and their default values are explained in the\ndiagnostics area page.\n\nErrors\n------\n\nIf the SQLSTATE is not valid, the following error like this will be produced:\n\nERROR 1407 (42000): Bad SQLSTATE: \'123456\'\n\nIf a property is specified more than once, an error like this will be produced:\n\nERROR 1641 (42000): Duplicate condition information item \'MESSAGE_TEXT\'\n\nIf you specify a condition name which is not declared, an error like this will\nbe produced:\n\nERROR 1319 (42000): Undefined CONDITION: cond_name\n\nIf MYSQL_ERRNO is out of range, you will get an error like this:\n\nERROR 1231 (42000): Variable \'MYSQL_ERRNO\' can\'t be set to the value of \'0\'\n\nExamples\n--------\n\nHere\'s what happens if SIGNAL is used in the client to generate errors:\n\nSIGNAL SQLSTATE \'01000\';\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+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n\nSIGNAL SQLSTATE \'02000\';\nERROR 1643 (02000): Unhandled user-defined not found condition\n\nHow to specify MYSQL_ERRNO and MESSAGE_TEXT properties:\n\nSIGNAL SQLSTATE \'45000\' SET MYSQL_ERRNO=30001, MESSAGE_TEXT=\'H\nello, world!\';\n\nERROR 30001 (45000): Hello, world!\n\nThe following code shows how to use user variables, local variables and\ncharacter set conversion with SIGNAL:\n\nCREATE PROCEDURE test_error(x INT)\nBEGIN\n DECLARE errno SMALLINT UNSIGNED DEFAULT 31001;\n SET @errmsg = \'Hello, world!\';\n IF x = 1 THEN\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = @errmsg;\n ELSE\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = _utf8\'Hello, world!\';\n END IF;\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 IF n > 10 THEN\n SIGNAL `too_big`;\n END IF;\nEND;\n\nIn this example, we\'ll define a HANDLER for an error code. When the error\noccurs, we SIGNAL a more informative error which 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 init()\nprocedure?\';\n END;\n -- this will produce a 1146 error\n SELECT `c` FROM `temptab`;\nEND;\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 (311,24,'WHILE','Syntax\n------\n\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nDescription\n-----------\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition is true. statement_list consists of one or more statements.\nIf the loop must be executed at least once, REPEAT ... LOOP can be used\ninstead.\n\nA WHILE statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nExamples\n--------\n\nCREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\nWHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND\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 (312,24,'Cursor Overview','Description\n-----------\n\nA cursor is a structure that allows you to go over records sequentially, and\nperform processing based on the result.\n\nMariaDB permits cursors inside stored programs, and MariaDB cursors are\nnon-scrollable, read-only and asensitive.\n\n* Non-scrollable means that the rows can only be fetched in the order\nspecified by the SELECT statement. Rows cannot be skipped, you cannot jump to\na specific row, and you cannot fetch rows in reverse order.\n* Read-only means that data cannot be updated through the cursor.\n* Asensitive means that the cursor points to the actual underlying data. This\nkind of cursor is quicker than the alternative, an insensitive cursor, as no\ndata is copied to a temporary table. However, changes to the data being used\nby the cursor will affect the cursor data.\n\nCursors are created with a DECLARE CURSOR statement and opened with an OPEN\nstatement. Rows are read with a FETCH statement before the cursor is finally\nclosed with a CLOSE statement.\n\nWhen FETCH is issued and there are no more rows to extract, the following\nerror is produced:\n\nERROR 1329 (02000): No data - zero rows fetched, selected, or processed\n\nTo avoid problems, a DECLARE HANDLER statement is generally used. The HANDLER\nshould handler the 1329 error, or the \'02000\' SQLSTATE, or the NOT FOUND error\nclass.\n\nOnly SELECT statements are allowed for cursors, and they cannot be contained\nin a variable - so, they cannot be composed dynamically. However, it is\npossible to SELECT from a view. Since the CREATE VIEW statement can be\nexecuted as a prepared statement, it is possible to dynamically create the\nview that is queried by the cursor.\n\nFrom MariaDB 10.3.0, cursors can have parameters. Cursor parameters can appear\nin any part of the DECLARE CURSOR select_statement where a stored procedure\nvariable is allowed (select list, WHERE, HAVING, LIMIT etc). See DECLARE\nCURSOR and OPEN for syntax, and below for an example:\n\nExamples\n--------\n\nCREATE TABLE c1(i INT);\n\nCREATE TABLE c2(i INT);\n\nCREATE TABLE c3(i INT);\n\nDELIMITER //\n\nCREATE PROCEDURE p1()\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE x, y INT;\n DECLARE cur1 CURSOR FOR SELECT i FROM test.c1;\n DECLARE cur2 CURSOR FOR SELECT i FROM test.c2;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;\n\nOPEN cur1;\n OPEN cur2;\n\nread_loop: LOOP\n FETCH cur1 INTO x;\n FETCH cur2 INTO y;\n IF done THEN\n LEAVE read_loop;\n END IF;\n IF x < y THEN\n INSERT INTO test.c3 VALUES (x);\n ELSE\n INSERT INTO test.c3 VALUES (y);\n END IF;\n END LOOP;\n\nCLOSE cur1;\n CLOSE cur2;\nEND; //\n\nDELIMITER ;\n\nINSERT INTO c1 VALUES(5),(50),(500);\n\nINSERT INTO c2 VALUES(10),(20),(30);\n\nCALL p1;\n\nSELECT * FROM c3;\n+------+\n| i |\n+------+\n| 5 |\n| 20 |\n| 30 |\n+------+\n\nFrom MariaDB 10.3.0\n\nDROP PROCEDURE IF EXISTS p1;\nDROP TABLE IF EXISTS t1;\nCREATE TABLE t1 (a INT, b VARCHAR(10));\n\nINSERT INTO t1 VALUES (1,\'old\'),(2,\'old\'),(3,\'old\'),(4,\'old\'),(5,\'old\');\n\nDELIMITER //\n\nCREATE PROCEDURE p1(min INT,max INT)\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE va INT;\n DECLARE cur CURSOR(pmin INT, pmax INT) FOR SELECT a FROM t1 WHERE a BETWEEN\npmin AND pmax;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;\n OPEN cur(min,max);\n read_loop: LOOP\n FETCH cur INTO va;\n IF done THEN\n LEAVE read_loop;\n END IF;\n INSERT INTO t1 VALUES (va,\'new\');\n END LOOP;\n CLOSE cur;\nEND;\n//\n\nDELIMITER ;\n\nCALL p1(2,4);\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 1 | old |\n| 2 | old |\n| 3 | old |\n| 4 | old |\n| 5 | old |\n| 2 | new |\n| 3 | new |\n| 4 | new |\n+------+------+\n\nURL: https://mariadb.com/kb/en/cursor-overview/','','https://mariadb.com/kb/en/cursor-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,24,'DECLARE CURSOR','Syntax\n------\n\n<= MariaDB 10.2\n\nDECLARE cursor_name CURSOR FOR select_statement\n\nFrom MariaDB 10.3\n\nDECLARE cursor_name CURSOR [(cursor_formal_parameter[,...])] FOR\nselect_statement\n\ncursor_formal_parameter:\n name type [collate clause]\n\nFrom MariaDB 10.8\n\nDECLARE cursor_name CURSOR [(cursor_formal_parameter[,...])] FOR\nselect_statement\n\ncursor_formal_parameter:\n [IN] name type [collate clause]\n\nDescription\n-----------\n\nThis statement declares a cursor. Multiple cursors may be declared in a stored\nprogram, but each cursor in a given block must have a unique name.\n\nselect_statement is not executed until the OPEN statement is executed. It is\nimportant to remember this if the query produces an error, or calls functions\nwhich have side effects.\n\nA SELECT associated to a cursor can use variables, but the query itself cannot\nbe a variable, and cannot be dynamically composed. The SELECT statement cannot\nhave an INTO clause.\n\nCursors must be declared before HANDLERs, but after local variables and\nCONDITIONs.\n\nParameters\n----------\n\nMariaDB starting with 10.3.0\n----------------------------\nFrom MariaDB 10.3.0, cursors can have parameters. This is a non-standard SQL\nextension. Cursor parameters can appear in any part of the DECLARE CURSOR\nselect_statement where a stored procedure variable is allowed (select list,\nWHERE, HAVING, LIMIT etc).\n\nIN\n--\n\nMariaDB starting with 10.8.0\n----------------------------\nFrom MariaDB 10.8.0 preview release, the IN qualifier is supported in the\ncursor_format_parameter part of the syntax.\n\nSee Cursor Overview for an example.\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 (314,24,'OPEN','Syntax\n------\n\n<= MariaDB 10.2\n\nOPEN cursor_name\n\nFrom MariaDB 10.3\n\nOPEN cursor_name [expression[,...]];\n\nDescription\n-----------\n\nThis statement opens a cursor which was previously declared with DECLARE\nCURSOR.\n\nThe query associated to the DECLARE CURSOR is executed when OPEN is executed.\nIt is important to remember this if the query produces an error, or calls\nfunctions which have side effects.\n\nThis is necessary in order to FETCH rows from a cursor.\n\nSee Cursor Overview for an example.\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 (315,24,'FETCH','Syntax\n------\n\nFETCH cursor_name INTO var_name [, var_name] ...\n\nDescription\n-----------\n\nThis statement fetches the next row (if a row exists) using the specified open\ncursor, and advances the cursor pointer.\n\nvar_name can be a local variable, but not a user-defined variable.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE value\n02000. To detect this condition, you can set up a handler for it (or for a NOT\nFOUND condition).\n\nSee Cursor Overview for an example.\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 (316,24,'CLOSE','Syntax\n------\n\nCLOSE cursor_name\n\nDescription\n-----------\n\nThis statement closes a previously opened cursor. The cursor must have been\npreviously opened or else an error occurs.\n\nIf not closed explicitly, a cursor is closed at the end of the compound\nstatement in which it was declared.\n\nSee Cursor Overview for an example.\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 (317,25,'BUFFER','A synonym for ST_BUFFER.\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 (318,25,'CONVEXHULL','A synonym for ST_CONVEXHULL.\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 (319,25,'GEOMETRYCOLLECTION','Syntax\n------\n\nGeometryCollection(g1,g2,...)\n\nDescription\n-----------\n\nConstructs a WKB GeometryCollection. If any argument is not a well-formed WKB\nrepresentation of a geometry, the return value is NULL.\n\nExamples\n--------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\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 (320,25,'LINESTRING','Syntax\n------\n\nLineString(pt1,pt2,...)\n\nDescription\n-----------\n\nConstructs a WKB LineString value from a number of WKB Point arguments. If any\nargument is not a WKB Point, the return value is NULL. If the number of Point\narguments is less than two, the return value is NULL.\n\nExamples\n--------\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 10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\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 (321,25,'MULTILINESTRING','Syntax\n------\n\nMultiLineString(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiLineString value using WKB LineString arguments. If any\nargument is not a WKB LineString, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16\n48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), \n Point(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21, 7))))));\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 (322,25,'MULTIPOINT','Syntax\n------\n\nMultiPoint(pt1,pt2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPoint value using WKB Point arguments. If any argument\nis not a WKB Point, the return value is NULL.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9,\n4 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 20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\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 (323,25,'MULTIPOLYGON','Syntax\n------\n\nMultiPolygon(poly1,poly2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPolygon value from a set of WKB Polygon arguments. If\nany argument is not a WKB Polygon, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(\n Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\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 (324,25,'POINT','Syntax\n------\n\nPoint(x,y)\n\nDescription\n-----------\n\nConstructs a WKB Point using the given coordinates.\n\nExamples\n--------\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\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 (325,25,'PointOnSurface','A synonym for ST_PointOnSurface.\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 (326,25,'POLYGON','Syntax\n------\n\nPolygon(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB Polygon value from a number of WKB LineString arguments. If\nany argument does not represent the WKB of a LinearRing (that is, not a closed\nand simple LineString) the return value is NULL.\n\nNote that according to the OpenGIS standard, a POLYGON should have exactly one\nExteriorRing and all other rings should lie within that ExteriorRing and thus\nbe the InteriorRings. Practically, however, some systems, including MariaDB\'s,\npermit polygons to have several \'ExteriorRings\'. In the case of there being\nmultiple, non-overlapping exterior rings ST_NUMINTERIORRINGS() will return 1.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,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 10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30,\n30), Point(0, 0))))));\n\nNon-overlapping \'polygon\':\n\nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10 0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\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 (327,25,'ST_BUFFER','Syntax\n------\n\nST_BUFFER(g1,r)\nBUFFER(g1,r)\n\nDescription\n-----------\n\nReturns a geometry that represents all points whose distance from geometry g1\nis less than or equal to distance, or radius, r.\n\nUses for this function could include creating for example a new geometry\nrepresenting a buffer zone around an island.\n\nBUFFER() is a synonym.\n\nExamples\n--------\n\nDetermining whether a point is within a buffer zone:\n\nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((10 10, 10 20, 20 20, 20 10, 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\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 (328,25,'ST_CONVEXHULL','MariaDB starting with 10.1.2\n----------------------------\nST_ConvexHull() was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_ConvexHull(g)\nConvexHull(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a geometry that is the minimum convex geometry\nenclosing all geometries within the set. Returns NULL if the geometry value is\nNULL or an empty value.\n\nST_ConvexHull() and ConvexHull() are synonyms.\n\nExamples\n--------\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 3, 8 4, 6 6, 6 9,\n4 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\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 (329,25,'ST_INTERSECTION','Syntax\n------\n\nST_INTERSECTION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the intersection, or shared portion, of geometry g1\nand geometry g2.\n\nExamples\n--------\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\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 (330,25,'ST_POINTONSURFACE','MariaDB starting with 10.1.2\n----------------------------\nST_POINTONSURFACE() was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_PointOnSurface(g)\nPointOnSurface(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a POINT guaranteed to intersect a surface. However,\nsee MDEV-7514.\n\nST_PointOnSurface() and PointOnSurface() are synonyms.\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 (331,25,'ST_SYMDIFFERENCE','Syntax\n------\n\nST_SYMDIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that represents the portions of geometry g1 and geometry g2\nthat don\'t intersect.\n\nExamples\n--------\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\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 (332,25,'ST_UNION','Syntax\n------\n\nST_UNION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the union of the geometry g1 and geometry g2.\n\nExamples\n--------\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\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 (333,26,'SHOW GRANTS','Syntax\n------\n\nSHOW GRANTS [FOR user|role]\n\nDescription\n-----------\n\nThe SHOW GRANTS statement lists privileges granted to a particular user or\nrole.\n\nUsers\n-----\n\nThe statement lists the GRANT statement or statements that must be issued to\nduplicate the privileges that are granted to a MariaDB user account. The\naccount is named using the same format as for the GRANT statement; for\nexample, \'jeffrey\'@\'localhost\'. If you specify only the user name part of the\naccount name, a host name part of \'%\' is used. For additional information\nabout specifying account names, see GRANT.\n\nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to connect to\nthe server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in\nDEFINER context (such as within a stored procedure that is defined with SQL\nSECURITY DEFINER), the grants displayed are those of the definer and not the\ninvoker.\n\nNote that the DELETE HISTORY privilege, introduced in MariaDB 10.3.4, was\ndisplayed as DELETE VERSIONING ROWS when running SHOW GRANTS until MariaDB\n10.3.15 (MDEV-17655).\n\nRoles\n-----\n\nSHOW GRANTS can also be used to view the privileges granted to a role.\n\nExample\n-------\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\nFOR PUBLIC\n----------\n\nMariaDB starting with 10.11\n---------------------------\nGRANT ... TO PUBLIC was introduced in MariaDB 10.11 to grant privileges to all\nusers. SHOW GRANTS FOR PUBLIC shows all these grants.\n\nSHOW GRANTS FOR public;\n+------------------------------------------------+\n| Grants for PUBLIC |\n+------------------------------------------------+\n| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |\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 (334,26,'SHOW CREATE USER','Syntax\n------\n\nSHOW CREATE USER user_name\n\nDescription\n-----------\n\nShows the CREATE USER statement that created the given user. The statement\nrequires the SELECT privilege for the mysql database, except for the current\nuser.\n\nExamples\n--------\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 ***************************\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 120 DAY;\n\nSHOW CREATE USER \'monty\'@\'localhost\';\n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY |\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 (335,26,'SHOW COLUMNS','Syntax\n------\n\nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW COLUMNS displays information about the columns in a given table. It also\nworks for views. The LIKE clause, if present on its own, indicates which\ncolumn names to match. The WHERE and LIKE clauses can be given to select rows\nusing more general conditions, as discussed in Extended SHOW.\n\nIf the data types differ from what you expect them to be based on a CREATE\nTABLE statement, note that MariaDB sometimes changes data types when you\ncreate or alter a table. The conditions under which this occurs are described\nin the Silent Column Changes article.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. In other words, these two statements are equivalent:\n\nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for non-binary string columns, or NULL for\nother columns. This value is displayed only if you use the FULL keyword.\n\nThe Null field contains YES if NULL values can be stored in the column, NO if\nnot.\n\nThe Key field indicates whether the column is indexed:\n\n* If Key is empty, the column either is not indexed or is indexed only as a\n secondary column in a multiple-column, non-unique index.\n* If Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\n* If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n* If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a non-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 of a table, Key\ndisplays the one with the highest priority, in the order PRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values and\nthere is no PRIMARY KEY in the table. A UNIQUE index may display as MUL if\nseveral columns form a composite UNIQUE index; although the combination of the\ncolumns is unique, each column can still hold multiple occurrences of a given\nvalue.\n\nThe Default field indicates the default value that is assigned to the column.\n\nThe Extra field contains any additional information that is available about a\ngiven column.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| AUTO_INCREMENT | The column was created with the AUTO_INCREMENT |\n| | keyword. |\n+------------------------+---------------------------------------------------+\n| PERSISTENT | The column was created with the PERSISTENT |\n| | keyword. (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| VIRTUAL | The column was created with the VIRTUAL keyword. |\n| | (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| on update | The column is a TIMESTAMP column that is |\n| CURRENT_TIMESTAMP | automatically updated on INSERT and UPDATE. |\n+------------------------+---------------------------------------------------+\n\nPrivileges indicates the privileges you have for the column. This value is\ndisplayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed only if\nyou use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. Also DESCRIBE and EXPLAIN can be\nused as shortcuts.\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 COLUMNS. The\ninformation_schema.COLUMNS table provides similar, but more complete,\ninformation.\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also\nprovide information about tables.\n\nExamples\n--------\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\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 (336,26,'SHOW CREATE TABLE','Syntax\n------\n\nSHOW CREATE TABLE tbl_name\n\nDescription\n-----------\n\nShows the CREATE TABLE statement that created the given table. The statement\nrequires the SELECT privilege for the table. This statement also works with\nviews and SEQUENCE.\n\nSHOW CREATE TABLE quotes table and column names according to the value of the\nsql_quote_show_create server system variable.\n\nCertain SQL_MODE values can result in parts of the original CREATE statement\nnot being included in the output. MariaDB-specific table options, column\noptions, and index options are not included in the output of this statement if\nthe NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are\nused. All MariaDB-specific table attributes are also not shown when a\nnon-MariaDB/MySQL emulation mode is used, which includes ANSI, DB2,\nPOSTGRESQL, MSSQL, MAXDB or ORACLE.\n\nInvalid table options, column options and index options are normally commented\nout (note, that it is possible to create a table with invalid options, by\naltering a table of a different engine, where these options were valid). To\nhave them uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember\nthat replaying a CREATE TABLE statement with uncommented invalid options will\nfail with an error, unless the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n\nNote that SHOW CREATE TABLE is not meant to provide metadata about a table. It\nprovides information about how the table was declared, but the real table\nstructure could differ a bit. For example, if an index has been declared as\nHASH, the CREATE TABLE statement returned by SHOW CREATE TABLE will declare\nthat index as HASH; however, it is possible that the index is in fact a BTREE,\nbecause the storage engine does not support HASH.\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 permits TEXT and BLOB data types to be assigned a DEFAULT\nvalue. As a result, from MariaDB 10.2.1, SHOW CREATE TABLE will append a\nDEFAULT NULL to nullable TEXT or BLOB fields if no specific default is\nprovided.\n\nMariaDB starting with 10.2.2\n----------------------------\nFrom MariaDB 10.2.2, numbers are no longer quoted in the DEFAULT clause in\nSHOW CREATE statement. Previously, MariaDB quoted numbers.\n\nIndex Order\n-----------\n\nIndexes are sorted and displayed in the following order, which may differ from\nthe order of the CREATE TABLE statement.\n\n* PRIMARY KEY\n* UNIQUE keys where all column are NOT NULL\n* UNIQUE keys that don\'t contain partial segments\n* Other UNIQUE keys\n* LONG UNIQUE keys\n* Normal keys\n* Fulltext keys\n\nSee sql/sql_table.cc for details.\n\nExamples\n--------\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\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 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 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 Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSQL_MODE impacting the output:\n\nSELECT @@sql_mode;\n+------------------------------------------------------------------------------\n------------+\n| @@sql_mode \n |\n+------------------------------------------------------------------------------\n------------+\n|\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SU\nSTITUTION |\n+------------------------------------------------------------------------------\n------------+\n\nCREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=latin1\n;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSET SQL_MODE=ORACLE;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE \"t1\" (\n \"id\" int(11) NOT NULL,\n \"msg\" varchar(100) DEFAULT NULL,\n PRIMARY KEY (\"id\")\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 (337,26,'SHOW INDEX','Syntax\n------\n\nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n\nDescription\n-----------\n\nSHOW INDEX returns table index information. The format resembles that of the\nSQLStatistics call in ODBC.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. These two statements are 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 mariadb-show/mysqlshow command:\n\nmysqlshow -k db_name tbl_name\n\nThe information_schema.STATISTICS table stores similar information.\n\nThe following fields are returned by SHOW INDEX.\n\n+------------------------+---------------------------------------------------+\n| Field | Description |\n+------------------------+---------------------------------------------------+\n| Table | Table name |\n+------------------------+---------------------------------------------------+\n| Non_unique | 1 if the index permits duplicate values, 0 if |\n| | values must be unique. |\n+------------------------+---------------------------------------------------+\n| Key_name | Index name. The primary key is always named |\n| | PRIMARY. |\n+------------------------+---------------------------------------------------+\n| Seq_in_index | The column\'s sequence in the index, beginning |\n| | with 1. |\n+------------------------+---------------------------------------------------+\n| Column_name | Column name. |\n+------------------------+---------------------------------------------------+\n| Collation | Either A, if the column is sorted in ascending |\n| | order in the index, or NULL if it\'s not sorted. |\n+------------------------+---------------------------------------------------+\n| Cardinality | Estimated number of unique values in the index. |\n| | The cardinality statistics are calculated at |\n| | various times, and can help the optimizer make |\n| | improved decisions. |\n+------------------------+---------------------------------------------------+\n| Sub_part | NULL if the entire column is included in the |\n| | index, or the number of included characters if |\n| | not. |\n+------------------------+---------------------------------------------------+\n| Packed | NULL if the index is not packed, otherwise how |\n| | the index is packed. |\n+------------------------+---------------------------------------------------+\n| Null | NULL if NULL values are permitted in the column, |\n| | an empty string if NULLs are not permitted. |\n+------------------------+---------------------------------------------------+\n| Index_type | The index type, which can be BTREE, FULLTEXT, |\n| | HASH or RTREE. See Storage Engine Index Types. |\n+------------------------+---------------------------------------------------+\n| Comment | Other information, such as whether the index is |\n| | disabled. |\n+------------------------+---------------------------------------------------+\n| Index_comment | Contents of the COMMENT attribute when the index |\n| | was created. |\n+------------------------+---------------------------------------------------+\n| Ignored | Whether or not an index will be ignored by the |\n| | optimizer. See Ignored Indexes. From MariaDB |\n| | 10.6.0. |\n+------------------------+---------------------------------------------------+\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example\\G\n*************************** 1. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: PRIMARY\n Seq_in_index: 1\n Column_name: id\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 2. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: employee_code\n Seq_in_index: 1\n Column_name: employee_code\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 3. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 1\n Column_name: first_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 4. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 2\n Column_name: last_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\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 (338,26,'SHOW EXPLAIN','Syntax\n------\n\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id>;\nEXPLAIN [FORMAT=JSON] FOR CONNECTION <connection_id>;\n\nDescription\n-----------\n\nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that is, a description\nof a query plan) of a query running in a certain connection.\n\nSHOW EXPLAIN FOR <connection_id>;\n\nwill produce an EXPLAIN output for the query that connection number\nconnection_id is running. The connection id can be obtained with SHOW\nPROCESSLIST.\n\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len | ref |\nrows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL |\n1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nThe output is always accompanied with a warning which shows the query the\ntarget connection is running (this shows what the EXPLAIN is for):\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n\nEXPLAIN FOR CONNECTION\n----------------------\n\nMariaDB starting with 10.9\n--------------------------\nThe EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.\n\nFORMAT=JSON\n-----------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id> extends SHOW EXPLAIN to return\nmore detailed JSON output.\n\nPossible Errors\n---------------\n\nThe output can be only produced if the target connection is currently running\na query, which has a ready query plan. If this is not the case, the output\nwill be:\n\nSHOW EXPLAIN FOR 2;\nERROR 1932 (HY000): Target is not running an EXPLAINable command\n\nYou will get this error when:\n\n* the target connection is not running a command for which one can run EXPLAIN\n* the target connection is running a command for which one can run EXPLAIN, but\nthere is no query plan yet (for example, tables are open and locks are\n acquired before the query plan is produced)\n\nDifferences Between SHOW EXPLAIN and EXPLAIN Outputs\n----------------------------------------------------\n\nBackground\n----------\n\nIn MySQL, EXPLAIN execution takes a slightly different route from the way the\nreal query (typically the SELECT) is optimized. This is unfortunate, and has\ncaused a number of bugs in EXPLAIN. (For example, see MDEV-326, MDEV-410, and\nlp:1013343. lp:992942 is not directly about EXPLAIN, but it also would not\nhave existed if MySQL didn\'t try to delete parts of a query plan in the middle\nof the query)\n\nSHOW EXPLAIN examines a running SELECT, and hence its output may be slightly\ndifferent from what EXPLAIN SELECT would produce. We did our best to make sure\nthat either the difference is negligible, or SHOW EXPLAIN\'s output is closer\nto reality than EXPLAIN\'s output.\n\nList of Recorded Differences\n----------------------------\n\n* SHOW EXPLAIN may have Extra=\'no matching row in const table\', where EXPLAIN\nwould produce Extra=\'Impossible WHERE ...\'\n* For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY\nwhere regular EXPLAIN used to print select_type==SIMPLE, or vice versa.\n\nRequired Permissions\n--------------------\n\nRunning SHOW EXPLAIN requires the same permissions as running SHOW PROCESSLIST\nwould.\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 (339,26,'BACKUP STAGE','MariaDB starting with 10.4.1\n----------------------------\nThe BACKUP STAGE commands were introduced in MariaDB 10.4.1.\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool.\n\nSyntax\n------\n\nBACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END ]\n\nIn the following text, a transactional table means InnoDB or \"InnoDB-like\nengine with redo log that can lock redo purges and can be copied without locks\nby an outside process\".\n\nGoals with BACKUP STAGE Commands\n--------------------------------\n\n* To be able to do a majority of the backup with the minimum possible server\nlocks. Especially for transactional tables (InnoDB, MyRocks etc) there is only\nneed for a very short block of new commits while copying statistics and log\ntables.\n* DDL are only needed to be blocked for a very short duration of the backup\nwhile mariabackup is copying the tables affected by DDL during the initial\npart of the backup.\n* Most non transactional tables (those that are not in use) will be copied\nduring BACKUP STAGE START. The exceptions are system statistic and log tables\nthat are not blocked during the backup until BLOCK_COMMIT.\n* Should work efficiently with backup tools that use disk snapshots.\n* Should work as efficiently as possible for all table types that store data\non the local disks.\n* As little copying as possible under higher level stages/locks. For example,\n.frm (dictionary) and .trn (trigger) files should be copying while copying the\ntable data.\n\nBACKUP STAGE Commands\n---------------------\n\nBACKUP STAGE START\n------------------\n\nThe START stage is designed for the following tasks:\n\n* Blocks purge of redo files for storage engines that needs this (Aria)\n* Start logging of DDL commands into \'datadir\'/ddl.log. This may take a short\ntime as the command has to wait until there are no active DDL commands.\n\nBACKUP STAGE FLUSH\n------------------\n\nThe FLUSH stage is designed for the following tasks:\n\n* FLUSH all changes for inactive non-transactional tables, except for\nstatistics and log tables.\n* Close all tables that are not in use, to ensure they are marked as closed\nfor the backup.\n* BLOCK all new write locks for all non transactional tables (except\nstatistics and log tables). The command will not wait for tables that are in\nuse by read-only transactions.\n\nDDLs don\'t have to be blocked at this stage as they can\'t cause the table to\nbe in an inconsistent state. This is true also for non-transactional tables.\n\nBACKUP STAGE BLOCK_DDL\n----------------------\n\nThe BLOCK_DDL stage is designed for the following tasks:\n\n* Wait for all statements using write locked non-transactional tables to end.\n* Blocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE.\n* Blocks also start off a new ALTER TABLE and the final rename phase of ALTER\nTABLE. Running ALTER TABLES are not blocked.\n\nBACKUP STAGE BLOCK_COMMIT\n-------------------------\n\nThe BLOCK_COMMIT stage is designed for the following tasks:\n\n* Lock the binary log and commit/rollback to ensure that no changes are\ncommitted to any tables. If there are active commits or data to be copied to\nthe binary log this will be allowed to finish. Active transactions will not\naffect BLOCK_COMMIT.\n* This doesn\'t lock temporary tables that are not used by replication. However\nthese will be blocked when it\'s time to write to the binary log.\n* Lock system log tables and statistics tables, flush them and mark them\nclosed.\n\nWhen the BLOCK_COMMIT\'s stages return, this is the \'backup time\'. Everything\ncommitted will be in the backup and everything not committed will roll back.\n\nTransactional engines will continue to do changes to the redo log during the\nBLOCK COMMIT stage, but this is not important as all of these will roll back\nlater as the changes will not be committed.\n\nBACKUP STAGE END\n----------------\n\nThe END stage is designed for the following tasks:\n\n* End DDL logging\n* Free resources\n\nUsing BACKUP STAGE Commands with Backup Tools\n---------------------------------------------\n\nUsing BACKUP STAGE Commands with Mariabackup\n--------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. How Mariabackup uses these commands depends on\nwhether you are using the version that is bundled with MariaDB Community\nServer or the version that is bundled with MariaDB Enterprise Server. See\nMariabackup and BACKUP STAGE Commands for some examples on how Mariabackup\nuses these commands.\n\nIf you would like to use a version of Mariabackup that uses the BACKUP STAGE\ncommands in an efficient way, then one option is to use MariaDB Enterprise\nBackup that is bundled with MariaDB Enterprise Server.\n\nUsing BACKUP STAGE Commands with Storage Snapshots\n--------------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. These commands could even be used by tools\nthat perform backups by taking a snapshot of a file system, SAN, or some other\nkind of storage device. See Storage Snapshots and BACKUP STAGE Commands for\nsome examples on how to use each BACKUP STAGE command in an efficient way.\n\nPrivileges\n----------\n\nBACKUP STAGE requires the RELOAD privilege.\n\nNotes\n-----\n\n* Only one connection can run BACKUP STAGE START. If a second connection\ntries, it will wait until the first one has executed BACKUP STAGE END.\n* If the user skips a BACKUP STAGE, then all intermediate backup stages will\nautomatically be run. This will allow us to add new stages within the BACKUP\nSTAGE hierarchy in the future with even more precise locks without causing\nproblems for tools using an earlier version of the BACKUP STAGE implementation.\n* One can use the max_statement_time or lock_wait_timeout system variables to\nensure that a BACKUP STAGE command doesn\'t block the server too long.\n* DDL logging will only be available in MariaDB Enterprise Server 10.2 and\nlater.\n* A disconnect will automatically release backup stages.\n* There is no easy way to see which is the current stage.\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 (340,26,'BACKUP LOCK','MariaDB starting with 10.4.2\n----------------------------\nThe BACKUP LOCK command was introduced in MariaDB 10.4.2.\n\nBACKUP LOCK blocks a table from DDL statements. This is mainly intended to be\nused by tools like mariabackup that need to ensure there are no DDLs on a\ntable while the table files are opened. For example, for an Aria table that\nstores data in 3 files with extensions .frm, .MAI and .MAD. Normal read/write\noperations can continue as normal.\n\nSyntax\n------\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----------------------\n\nBACKUP LOCK [database.]table_name;\n - Open all files related to a table (for example, t.frm, t.MAI and t.MYD)\nBACKUP UNLOCK;\n- Copy data\n- Close files\n\nThis ensures that all files are from the same generation, that is created at\nthe same time by the MariaDB server. This works, because the open files will\npoint to the original table files which will not be affected if there is any\nALTER TABLE while copying the files.\n\nPrivileges\n----------\n\nBACKUP LOCK requires the RELOAD privilege.\n\nNotes\n-----\n\n* The idea is that the BACKUP LOCK should be held for as short a time as\npossible by the backup tool. The time to take an uncontested lock is very\nshort! One can easily do 50,000 locks/unlocks per second on low end hardware.\n* One should use different connections for BACKUP STAGE commands and BACKUP\nLOCK.\n\nImplementation\n--------------\n\n* Internally, BACKUP LOCK is implemented by taking an MDLSHARED_HIGH_PRIO MDL\nlock on the table object, which protects the table from any DDL operations.\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 (341,26,'FLUSH','Syntax\n------\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] [table_flush_option]\n\nwhere table_list is a list of tables separated by , (comma).\n\nDescription\n-----------\n\nThe FLUSH statement clears or reloads various internal caches used by MariaDB.\nTo execute FLUSH, you must have the RELOAD privilege. See GRANT.\n\nThe RESET statement is similar to FLUSH. See RESET.\n\nYou cannot issue a FLUSH statement from within a stored function or a trigger.\nDoing so within a stored procedure is permitted, as long as it is not called\nby a stored function or trigger. See Stored Routine Limitations, Stored\nFunction Limitations and Trigger Limitations.\n\nIf a listed table is a view, an error like the following will be produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nBy default, FLUSH statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nThe different flush options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| CHANGED_PAGE_BITMAPS | XtraDB only. Internal command used for backup |\n| | purposes. See the Information Schema |\n| | CHANGED_PAGE_BITMAPS Table. |\n+---------------------------+------------------------------------------------+\n| CLIENT_STATISTICS | Reset client statistics (see SHOW |\n| | CLIENT_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| DES_KEY_FILE | Reloads the DES key file (Specified with the |\n| | --des-key-file startup option). |\n+---------------------------+------------------------------------------------+\n| HOSTS | Flush the hostname cache (used for converting |\n| | ip to host names and for unblocking blocked |\n| | hosts. See max_connect_errors) |\n+---------------------------+------------------------------------------------+\n| INDEX_STATISTICS | Reset index statistics (see SHOW |\n| | INDEX_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| [ERROR | ENGINE | | Close and reopen the specified log type, or |\n| GENERAL | SLOW | BINARY | all log types if none are specified. FLUSH |\n| | RELAY] LOGS | RELAY LOGS [connection-name] can be used to |\n| | flush the relay logs for a specific |\n| | connection. Only one connection can be |\n| | specified per FLUSH command. See Multi-source |\n| | replication. FLUSH ENGINE LOGS will delete |\n| | all unneeded Aria redo logs. Since MariaDB |\n| | 10.1.30 and MariaDB 10.2.11, FLUSH BINARY |\n| | LOGS DELETE_DOMAIN_ID=(list-of-domains) can |\n| | be used to discard obsolete GTID domains from |\n| | the server\'s binary log state. In order for |\n| | this to be successful, no event group from |\n| | the listed GTID domains can be present in |\n| | existing binary log files. If some still |\n| | exist, then they must be purged prior to |\n| | executing this command. If the command |\n| | completes successfully, then it also rotates |\n| | the binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deprecated option, use RESET MASTER instead. |\n+---------------------------+------------------------------------------------+\n| PRIVILEGES | Reload all privileges from the privilege |\n| | tables in the mysql database. If the server |\n| | is started with --skip-grant-table option, |\n| | this will activate the privilege tables again. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Defragment the query cache to better utilize |\n| | its memory. If you want to reset the query |\n| | cache, you can do it with RESET QUERY CACHE. |\n+---------------------------+------------------------------------------------+\n| QUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deprecated option, use RESET REPLICA or RESET |\n| | SLAVE instead. |\n+---------------------------+------------------------------------------------+\n| SSL | Used to dynamically reinitialize the server\'s |\n| | TLS context by reloading the files defined by |\n| | several TLS system variables. See FLUSH SSL |\n| | for more information. This command was first |\n| | added in MariaDB 10.4.1. |\n+---------------------------+------------------------------------------------+\n| STATUS | Resets all server status variables that can |\n| | be reset to 0. Not all global status |\n| | variables support this, so not all global |\n| | values are reset. See FLUSH STATUS for more |\n| | information. |\n+---------------------------+------------------------------------------------+\n| TABLE | Close tables given as options or all open |\n| | tables if no table list was used. From |\n| | MariaDB 10.4.1, using without any table list |\n| | will only close tables not in use, and tables |\n| | not locked by the FLUSH TABLES connection. If |\n| | there are no locked tables, FLUSH TABLES will |\n| | be instant and will not cause any waits, as |\n| | it no longer waits for tables in use. When a |\n| | table list is provided, from MariaDB 10.4.1, |\n| | the server will wait for the end of any |\n| | transactions that are using the tables. |\n| | Previously, FLUSH TABLES only waited for the |\n| | statements to complete. |\n+---------------------------+------------------------------------------------+\n| TABLES | Same as FLUSH TABLE. |\n+---------------------------+------------------------------------------------+\n| TABLES ... FOR EXPORT | For InnoDB tables, flushes table changes to |\n| | disk to permit binary table copies while the |\n| | server is running. See FLUSH TABLES ... FOR |\n| | EXPORT for more. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | Closes all open tables. New tables are only |\n| | allowed to be opened with read locks until an |\n| | UNLOCK TABLES is given. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | As TABLES WITH READ LOCK but also disable all |\n| AND DISABLE CHECKPOINT | checkpoint writes by transactional table |\n| | engines. This is useful when doing a disk |\n| | snapshot of all tables. |\n+---------------------------+------------------------------------------------+\n| TABLE_STATISTICS | Reset table statistics (see SHOW |\n| | TABLE_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_RESOURCES | Resets all per hour user resources. This |\n| | enables clients that have exhausted their |\n| | resources to connect again. |\n+---------------------------+------------------------------------------------+\n| USER_STATISTICS | Reset user statistics (see SHOW |\n| | USER_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_VARIABLES | Reset user variables (see User-defined |\n| | variables). |\n+---------------------------+------------------------------------------------+\n\nYou can also use the mysqladmin client to flush things. Use mysqladmin --help\nto examine what flush commands it supports.\n\nFLUSH RELAY LOGS\n----------------\n\nFLUSH RELAY LOGS \'connection_name\';\n\nCompatibility with MySQL\n------------------------\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after the FLUSH command.\n\nFor example, one can now use:\n\nFLUSH RELAY LOGS FOR CHANNEL \'connection_name\';\n\nFLUSH STATUS\n------------\n\nServer status variables can be reset by executing the following:\n\nFLUSH STATUS;\n\nGlobal Status Variables that Support FLUSH STATUS\n-------------------------------------------------\n\nNot all global status variables support being reset by FLUSH STATUS.\nCurrently, the following status variables are reset by FLUSH STATUS:\n\n* Aborted_clients\n* Aborted_connects\n* Binlog_cache_disk_use\n* Binlog_cache_use\n* Binlog_stmt_cache_disk_use\n* Binlog_stmt_cache_use\n* Connection_errors_accept\n* Connection_errors_internal\n* Connection_errors_max_connections\n* Connection_errors_peer_address\n* Connection_errors_select\n* Connection_errors_tcpwrap\n* Created_tmp_files\n* Delayed_errors\n* Delayed_writes\n* Feature_check_constraint\n* Feature_delay_key_write\n* Max_used_connections\n* Opened_plugin_libraries\n* Performance_schema_accounts_lost\n* Performance_schema_cond_instances_lost\n* Performance_schema_digest_lost\n* Performance_schema_file_handles_lost\n* Performance_schema_file_instances_lost\n* Performance_schema_hosts_lost\n* Performance_schema_locker_lost\n* Performance_schema_mutex_instances_lost\n* Performance_schema_rwlock_instances_lost\n* Performance_schema_session_connect_attrs_lost\n* Performance_schema_socket_instances_lost\n* Performance_schema_stage_classes_lost\n* Performance_schema_statement_classes_lost\n* Performance_schema_table_handles_lost\n* Performance_schema_table_instances_lost\n* Performance_schema_thread_instances_lost\n* Performance_schema_users_lost\n* Qcache_hits\n* Qcache_inserts\n* Qcache_lowmem_prunes\n* Qcache_not_cached\n* Rpl_semi_sync_master_no_times\n* Rpl_semi_sync_master_no_tx\n* Rpl_semi_sync_master_timefunc_failures\n* Rpl_semi_sync_master_wait_pos_backtraverse\n* Rpl_semi_sync_master_yes_tx\n* Rpl_transactions_multi_engine\n* Server_audit_writes_failed\n* Slave_retried_transactions\n* Slow_launch_threads\n* Ssl_accept_renegotiates\n* Ssl_accepts\n* Ssl_callback_cache_hits\n* Ssl_client_connects\n* Ssl_connect_renegotiates\n* Ssl_ctx_verify_depth\n* Ssl_ctx_verify_mode\n* Ssl_finished_accepts\n* Ssl_finished_connects\n* Ssl_session_cache_hits\n* Ssl_session_cache_misses\n* Ssl_session_cache_overflows\n* Ssl_session_cache_size\n* Ssl_session_cache_timeouts\n* Ssl_sessions_reused\n* Ssl_used_session_cache_entries\n* Subquery_cache_hit\n* Subquery_cache_miss\n* Table_locks_immediate\n* Table_locks_waited\n* Tc_log_max_pages_used\n* Tc_log_page_waits\n* Transactions_gtid_foreign_engine\n* Transactions_multi_engine\n\nThe different usage of FLUSH TABLES\n-----------------------------------\n\nThe purpose of FLUSH TABLES\n---------------------------\n\nThe purpose of FLUSH TABLES is to clean up the open table cache and table\ndefinition cache from not in use tables. This frees up memory and file\ndescriptors. Normally this is not needed as the caches works on a FIFO bases,\nbut can be useful if the server seams to use up to much memory for some reason.\n\nThe purpose of FLUSH TABLES WITH READ LOCK \n-------------------------------------------\n\nFLUSH TABLES WITH READ LOCK is useful if you want to take a backup of some\ntables. When FLUSH TABLES WITH READ LOCK returns, all write access to tables\nare blocked and all tables are marked as \'properly closed\' on disk. The tables\ncan still be used for read operations.\n\nThe purpose of FLUSH TABLES table_list\n--------------------------------------\n\nFLUSH TABLES table_list is useful if you want to copy a table object/files to\nor from the server. This command puts a lock that stops new users of the table\nand will wait until everyone has stopped using the table. The table is then\nremoved from the table definition and table cache.\n\nNote that it\'s up to the user to ensure that no one is accessing the table\nbetween FLUSH TABLES and the table is copied to or from the server. This can\nbe secured by using LOCK TABLES.\n\nIf there are any tables locked by the connection that is using FLUSH TABLES','','https://mariadb.com/kb/en/flush/');
-update help_topic set description = CONCAT(description, '\nall the locked tables will be closed as part of the flush and reopened and\nrelocked before FLUSH TABLES returns. This allows one to copy the table after\nFLUSH TABLES returns without having any writes on the table. For now this\nworks works with most tables, except InnoDB as InnoDB may do background purges\non the table even while it\'s write locked.\n\nThe purpose of FLUSH TABLES table_list WITH READ LOCK\n-----------------------------------------------------\n\nFLUSH TABLES table_list WITH READ LOCK should work as FLUSH TABLES WITH READ\nLOCK, but only those tables that are listed will be properly closed. However\nin practice this works exactly like FLUSH TABLES WITH READ LOCK as the FLUSH\ncommand has anyway to wait for all WRITE operations to end because we are\ndepending on a global read lock for this code. In the future we should\nconsider fixing this to instead use meta data locks.\n\nImplementation of FLUSH TABLES commands in MariaDB 10.4.8 and above\n-------------------------------------------------------------------\n\nImplementation of FLUSH TABLES\n------------------------------\n\n* Free memory and file descriptors not in use\n\nImplementation of FLUSH TABLES WITH READ LOCK\n---------------------------------------------\n\n* Lock all tables read only for simple old style backup.\n* All background writes are suspended and tables are marked as closed.\n* No statement requiring table changes are allowed for any user until UNLOCK\nTABLES.\n\nInstead of using FLUSH TABLE WITH READ LOCK one should in most cases instead\nuse BACKUP STAGE BLOCK_COMMIT.\n\nImplementation of FLUSH TABLES table_list\n-----------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list.\n* Lock given tables as read only.\n* Wait until all translations has ended that uses any of the given tables.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n\nImplementation of FLUSH TABLES table_list FOR EXPORT\n----------------------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list\n* Lock given tables as read.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n* Check that all tables supports FOR EXPORT\n* No changes to these tables allowed until UNLOCK TABLES\n\nThis is basically the same behavior as in old MariaDB version if one first\nlock the tables, then do FLUSH TABLES. The tables will be copyable until\nUNLOCK TABLES.\n\nFLUSH SSL\n---------\n\nMariaDB starting with 10.4\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 to dynamically\nreinitialize the server\'s TLS context. This is most useful if you need to\nreplace a certificate that is about to expire without restarting the server.\n\nThis operation is performed by reloading the files defined by the following\nTLS system variables:\n\n* ssl_cert\n* ssl_key\n* ssl_ca\n* ssl_capath\n* ssl_crl\n* ssl_crlpath\n\nThese TLS system variables are not dynamic, so their values can not be changed\nwithout restarting the server.\n\nIf you want to dynamically reinitialize the server\'s TLS context, then you\nneed to change the certificate and key files at the relevant paths defined by\nthese TLS system variables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n\nReducing Memory Usage\n---------------------\n\nTo flush some of the global caches that take up memory, you could execute the\nfollowing command:\n\nFLUSH LOCAL HOSTS,\n QUERY CACHE,\n TABLE_STATISTICS,\n INDEX_STATISTICS,\n USER_STATISTICS;\n\nURL: https://mariadb.com/kb/en/flush/') WHERE help_topic_id = 341;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,26,'FLUSH QUERY CACHE','Description\n-----------\n\nYou can defragment the query cache to better utilize its memory with the FLUSH\nQUERY CACHE statement. The statement does not remove any queries from the\ncache.\n\nThe RESET QUERY CACHE statement removes all query results from the query\ncache. The FLUSH TABLES statement also does this.\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 (343,26,'FLUSH TABLES FOR EXPORT','Syntax\n------\n\nFLUSH TABLES table_name [, table_name] FOR EXPORT\n\nDescription\n-----------\n\nFLUSH TABLES ... FOR EXPORT flushes changes to the specified tables to disk so\nthat binary copies can be made while the server is still running. This works\nfor Archive, Aria, CSV, InnoDB, 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 EXPORT, a 1031 error\n(SQLSTATE \'HY000\') is produced.\n\nIf FLUSH TABLES ... FOR EXPORT is in effect in the session, the following\nstatements will produce an error if attempted:\n\n* FLUSH TABLES WITH READ LOCK\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* Any statement trying to update any table\n\nIf any of the following statements is in effect in the session, attempting\nFLUSH TABLES ... FOR EXPORT will produce an error.\n\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* LOCK TABLES ... READ\n* LOCK TABLES ... WRITE\n\nFLUSH FOR EXPORT is not written to the binary log.\n\nThis statement requires the RELOAD and the LOCK TABLES privileges.\n\nIf one of the specified tables cannot be locked, none of the tables will be\nlocked.\n\nIf a table does not exist, an error like the following will be 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 produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nExample\n-------\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\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 (344,26,'SHOW RELAYLOG EVENTS','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n [ FOR CHANNEL \'channel_name\']\n\nDescription\n-----------\n\nOn replicas, this command shows the events in the relay log. If \'log_name\' is\nnot specified, the first relay log is shown.\n\nSyntax for the LIMIT clause is the same as for SELECT ... LIMIT.\n\nUsing the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS\ncommand returns the complete contents of the relay log, which can be quite\nlarge.\n\nThis command does not return events related to setting user and system\nvariables. If you need those, use mariadb-binlog/mysqlbinlog.\n\nOn the primary, this command does nothing.\n\nRequires the REPLICA MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION\nSLAVE ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege\n(<= MariaDB 10.5.1).\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the SHOW RELAYLOG statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW RELAYLOG.\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 (345,26,'SHOW SLAVE STATUS','Syntax\n------\n\nSHOW SLAVE [\"connection_name\"] STATUS [FOR CHANNEL \"connection_name\"]\nSHOW REPLICA [\"connection_name\"] STATUS -- From MariaDB 10.5.1\n\nor\n\nSHOW ALL SLAVES STATUS\nSHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1\n\nDescription\n-----------\n\nThis statement is to be run on a replica and provides status information on\nessential parameters of the replica threads.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege, or, from\nMariaDB 10.5.9, the REPLICA MONITOR privilege.\n\nMulti-Source\n------------\n\nThe ALL and \"connection_name\" options allow you to connect to many primaries\nat the same time.\n\nALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all\nconnections to the primary nodes.\n\nThe rows will be sorted according to Connection_name.\n\nIf you specify a connection_name, you only get the information about that\nconnection. If connection_name is not used, then the name set by\ndefault_master_connection is used. If the connection name doesn\'t exist you\nwill get an error: There is no master connection for \'xxx\'.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW SLAVE.\n\nColumn Descriptions\n-------------------\n\n+---------------+---------------------------------------+-------------------+\n| Name | Description | Added |\n+---------------+---------------------------------------+-------------------+\n| Connection_na | Name of the primary connection. | |\n| e | Returned with SHOW ALL SLAVES STATUS | |\n| | (or SHOW ALL REPLICAS STATUS from | |\n| | MariaDB 10.5.1) only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Sta | State of SQL thread. Returned with | |\n| e | SHOW ALL SLAVES STATUS (or SHOW ALL | |\n| | REPLICAS STATUS from MariaDB 10.5.1) | |\n| | only. See Slave SQL Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Stat | State of I/O thread. See Slave I/O | |\n| | Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Master_host | Master host that the replica is | |\n| | connected to. | |\n+---------------+---------------------------------------+-------------------+\n| Master_user | Account user name being used to | |\n| | connect to the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Master_port | The port being used to connect to | |\n| | the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Connect_Retry | Time in seconds between retries to | |\n| | connect. The default is 60. The | |\n| | CHANGE MASTER TO statement can set | |\n| | this. The master-retry-count option | |\n| | determines the maximum number of | |\n| | reconnection attempts. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Log_Fi | Name of the primary binary log file | |\n| e | that the I/O thread is currently | |\n| | reading from. | |\n+---------------+---------------------------------------+-------------------+\n| Read_Master_L | Position up to which the I/O thread | |\n| g_Pos | has read in the current primary | |\n| | binary log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Fil | Name of the relay log file that the | |\n| | SQL thread is currently processing. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Pos | Position up to which the SQL thread | |\n| | has finished processing in the | |\n| | current relay log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Master_ | Name of the primary binary log file | |\n| og_File | that contains the most recent event | |\n| | executed by the SQL thread. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Runn | Whether the replica I/O thread is | |\n| ng | running and connected (Yes), running | |\n| | but not connected to a primary | |\n| | (Connecting) or not running (No). | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | Whether or not the SQL thread is | |\n| ing | running. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Databases specified for replicating | |\n| B | with the replicate_do_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Databases specified for ignoring | |\n| re_DB | with the replicate_ignore_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Tables specified for replicating | |\n| able | with the replicate_do_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Tables specified for ignoring with | |\n| re_Table | the replicate_ignore_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for replicating | |\n| _Do_Table | with the replicate_wild_do_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for ignoring with | |\n| _Ignore_Table | the replicate_wild_ignore_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Last_Errno | Alias for Last_SQL_Errno (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Last Error | Alias for Last_SQL_Error (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Skip_Counter | Number of events that a replica | |\n| | skips from the master, as recorded | |\n| | in the sql_slave_skip_counter system | |\n| | variable. | |\n+---------------+---------------------------------------+-------------------+\n| Exec_Master_L | Position up to which the SQL thread | |\n| g_Pos | has processed in the current master | |\n| | binary log file. Can be used to | |\n| | start a new replica from a current | |\n| | replica with the CHANGE MASTER TO | |\n| | ... MASTER_LOG_POS option. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Spa | Total size of all relay log files | |\n| e | combined. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Conditi | | |\n| n | | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Fil | The MASTER_LOG_FILE value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Pos | The MASTER_LOG_POS value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Al | Whether an SSL connection is | |\n| owed | permitted (Yes), not permitted (No) | |\n| | or permitted but without the replica | |\n| | having SSL support enabled (Ignored) | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CA option of the | |\n| File | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CAPATH option of the | |\n| Path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ce | The MASTER_SSL_CERT option of the | |\n| t | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ci | The MASTER_SSL_CIPHER option of the | |\n| her | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ke | The MASTER_SSL_KEY option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Seconds_Behin | Difference between the timestamp | |\n| _Master | logged on the master for the event | |\n| | that the replica is currently | |\n| | processing, and the current | |\n| | timestamp on the replica. Zero if | |\n| | the replica is not currently | |\n| | processing an event. With parallel | |\n| | replication, seconds_behind_master | |\n| | is updated only after transactions | |\n| | commit. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ve | The MASTER_SSL_VERIFY_SERVER_CERT | |\n| ify_Server_Ce | option of the CHANGE MASTER TO | |\n| t | statement. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Errno | Error code of the most recent error | |\n| | that caused the I/O thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Error | Error message of the most recent | |\n| | error that caused the I/O thread to | |\n| | stop (also recorded in the replica\'s | |\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Errn | Error code of the most recent error | |\n| | that caused the SQL thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Erro | Error message of the most recent | |\n| | error that caused the SQL thread to | |\n| | stop (also recorded in the replica\'s | |','','https://mariadb.com/kb/en/show-replica-status/');
-update help_topic set description = CONCAT(description, '\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | List of server_ids that are | |\n| re_Server_Ids | currently being ignored for | |\n| | replication purposes, or an empty | |\n| | string for none, as specified in the | |\n| | IGNORE_SERVER_IDS option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Server | The master\'s server_id value. | |\n| Id | | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRL option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRLPATH option of the | |\n| path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Using_Gtid | Whether or not global transaction | |\n| | ID\'s are being used for replication | |\n| | (can be No, Slave_Pos, or | |\n| | Current_Pos). | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_IO_Pos | Current global transaction ID value. | |\n+---------------+---------------------------------------+-------------------+\n| Retried_trans | Number of retried transactions for | |\n| ctions | this connection. Returned with SHOW | |\n| | ALL SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Max_relay_log | Max relay log size for this | |\n| size | connection. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Executed_log_ | How many log entries the replica has | |\n| ntries | executed. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_receive | How many heartbeats we have got from | |\n| _heartbeats | the master. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_heartbe | How often to request a heartbeat | |\n| t_period | packet from the master (in seconds). | |\n| | Returned with SHOW ALL SLAVES STATUS | |\n| | only. | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_Slave_Po | GTID of the last event group | |\n| | replicated on a replica server, for | |\n| | each replication domain, as stored | |\n| | in the gtid_slave_pos system | |\n| | variable. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Delay | Value specified by MASTER_DELAY in | MariaDB 10.2.3 |\n| | CHANGE MASTER (or 0 if none). | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Remaining | When the replica is delaying the | MariaDB 10.2.3 |\n| Delay | execution of an event due to | |\n| | MASTER_DELAY, this is the number of | |\n| | seconds of delay remaining before | |\n| | the event will be applied. | |\n| | Otherwise, the value is NULL. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | The state of the SQL driver threads, | MariaDB 10.2.3 |\n| ing_State | same as in SHOW PROCESSLIST. When | |\n| | the replica is delaying the | |\n| | execution of an event due to | |\n| | MASTER_DELAY, this field displays: | |\n| | \"Waiting until MASTER_DELAY seconds | |\n| | after master executed event\". | |\n+---------------+---------------------------------------+-------------------+\n| Slave_DDL_Gro | This status variable counts the | MariaDB 10.3.7 |\n| ps | occurrence of DDL statements. This | |\n| | is a replica-side counter for | |\n| | optimistic parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Non_Tra | This status variable counts the | MariaDB 10.3.7 |\n| sactional_Gro | occurrence of non-transactional | |\n| ps | event groups. This is a | |\n| | replica-side counter for optimistic | |\n| | parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Transac | This status variable counts the | MariaDB 10.3.7 |\n| ional_Groups | occurrence of transactional event | |\n| | groups. This is a replica-side | |\n| | counter for optimistic parallel | |\n| | replication. | |\n+---------------+---------------------------------------+-------------------+\n\nSHOW REPLICA STATUS\n-------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA STATUS is an alias for SHOW SLAVE STATUS from MariaDB 10.5.1.\n\nExamples\n--------\n\nIf you issue this statement using the mysql client, you can use a \\G statement\nterminator rather than a semicolon to obtain a more readable vertical layout.\n\nSHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\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\nSHOW ALL SLAVES STATUS\\G\n*************************** 1. row ***************************\n Connection_name:\n Slave_SQL_State: Slave has read all relay log; waiting for the\nslave 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 status 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\nURL: https://mariadb.com/kb/en/show-replica-status/') WHERE help_topic_id = 345;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,26,'SHOW MASTER STATUS','Syntax\n------\n\nSHOW MASTER STATUS\nSHOW BINLOG STATUS -- From MariaDB 10.5.2\n\nDescription\n-----------\n\nProvides status information about the binary log files of the primary.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the BINLOG MONITOR privilege.\n\nTo see information about the current GTIDs in the binary log, use the\ngtid_binlog_pos variable.\n\nSHOW MASTER STATUS was renamed to SHOW BINLOG STATUS in MariaDB 10.5.2, but\nthe old name remains an alias for compatibility purposes.\n\nExample\n-------\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\nURL: https://mariadb.com/kb/en/show-binlog-status/','','https://mariadb.com/kb/en/show-binlog-status/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SHOW SLAVE HOSTS','Syntax\n------\n\nSHOW SLAVE HOSTS\nSHOW REPLICA HOSTS -- from MariaDB 10.5.1\n\nDescription\n-----------\n\nThis command is run on the primary and displays a list of replicas that are\ncurrently registered with it. Only replicas started with the\n--report-host=host_name option are visible in this list.\n\nThe list is displayed on any server (not just the primary server). 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+------------+-----------+------+-----------+\n\n* Server_id: The unique server ID of the replica server, as configured in the\nserver\'s option file, or on the command line with --server-id=value.\n* Host: The host name of the replica server, as configured in the server\'s\noption file, or on the command line with --report-host=host_name. Note that\nthis can differ from the machine name as configured in the operating system.\n* Port: The port the replica server is listening on.\n* Master_id: The unique server ID of the primary server that the replica\nserver is replicating from.\n\nSome MariaDB and MySQL versions report another variable, rpl_recovery_rank.\nThis variable was never used, and was eventually removed in MariaDB 10.1.2 .\n\nRequires the REPLICATION MASTER ADMIN privilege (>= MariaDB 10.5.2) or the\nREPLICATION SLAVE privilege (<= MariaDB 10.5.1).\n\nSHOW REPLICA HOSTS\n------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/show-replica-hosts/','','https://mariadb.com/kb/en/show-replica-hosts/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'SHOW PLUGINS','Syntax\n------\n\nSHOW PLUGINS;\n\nDescription\n-----------\n\nSHOW PLUGINS displays information about installed plugins. The Library column\nindicates the plugin library - if it is NULL, the plugin is built-in and\ncannot be uninstalled.\n\nThe PLUGINS table in the information_schema database contains more detailed\ninformation.\n\nFor specific information about storage engines (a particular type of plugin),\nsee the information_schema.ENGINES table and the SHOW ENGINES statement.\n\nExamples\n--------\n\nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| Name | Status | Type | Library |\nLicense |\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| binlog | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| Aria | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL |\nGPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so |\nGPL |\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 (349,26,'SHOW PLUGINS SONAME','Syntax\n------\n\nSHOW PLUGINS SONAME { library | LIKE \'pattern\' | WHERE expr };\n\nDescription\n-----------\n\nSHOW PLUGINS SONAME displays information about compiled-in and all server\nplugins in the plugin_dir directory, including plugins that haven\'t been\ninstalled.\n\nExamples\n--------\n\nSHOW PLUGINS SONAME \'ha_example.so\';\n+----------+---------------+----------------+---------------+---------+\n| Name | Status | Type | Library | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so | GPL |\n| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |\n+----------+---------------+----------------+---------------+---------+\n\nThere is also a corresponding information_schema table, called ALL_PLUGINS,\nwhich contains more complete information.\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 (350,26,'SET','Syntax\n------\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 syntax:\n\nuser_var_name:= expr\n\nDescription\n-----------\n\nThe SET statement assigns values to different types of variables that affect\nthe operation of the server or your client. Older versions of MySQL employed\nSET OPTION, but this syntax was deprecated in favor of SET without OPTION, and\nwas removed in MariaDB 10.0.\n\nChanging a system variable by using the SET statement does not make the change\npermanently. To do so, the change must be made in a configuration file.\n\nFor setting variables on a per-query basis, see SET STATEMENT.\n\nSee SHOW VARIABLES for documentation on viewing server system variables.\n\nSee Server System Variables for a list of all the system variables.\n\nGLOBAL / SESSION\n----------------\n\nWhen setting a system variable, the scope can be specified as either GLOBAL or\nSESSION.\n\nA global variable change affects all new sessions. It does not affect any\ncurrently open sessions, including the one that made the change.\n\nA session variable change affects the current session only.\n\nIf the variable has a session value, not specifying either GLOBAL or SESSION\nwill be the same as specifying SESSION. If the variable only has a global\nvalue, not specifying GLOBAL or SESSION will apply to the change to the global\nvalue.\n\nDEFAULT\n-------\n\nSetting a global variable to DEFAULT will restore it to the server default,\nand setting a session variable to DEFAULT will restore it to the current\nglobal value.\n\nExamples\n--------\n\n* innodb_sync_spin_loops is a global variable.\n* skip_parallel_replication is a session variable.\n* max_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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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;Query OK, 0 rows affected (0.000 sec)\n\nSET skip_parallel_replication=ON;Query OK, 0 rows affected (0.000 sec)\n\nSET innodb_sync_spin_loops=60;\nERROR 1229 (HY000): Variable \'innodb_sync_spin_loops\' is a GLOBAL 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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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;\nERROR 1228 (HY000): Variable \'skip_parallel_replication\' is 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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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 unless the variable is\nglobal only.\n\nSHOW VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nSHOW VARIABLES LIKE \'skip_parallel_replication\';\n+---------------------------+-------+\n| Variable_name | Value |\n+---------------------------+-------+\n| skip_parallel_replication | ON |\n+---------------------------+-------+\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\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| @a |\n+------+\n| 1 |\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 (351,26,'SET CHARACTER SET','Syntax\n------\n\nSET {CHARACTER SET | CHARSET}\n {charset_name | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client and character_set_results session system\nvariables to the specified character set and collation_connection to the value\nof collation_database, which implicitly sets character_set_connection to the\nvalue of character_set_database.\n\nThis maps all strings sent between the current client and the server with the\ngiven mapping.\n\nExample\n-------\n\nSHOW VARIABLES LIKE \'character_set\\_%\';\n+--------------------------+--------+\n| Variable_name | Value |\n+--------------------------+--------+\n| character_set_client | utf8 |\n| character_set_connection | utf8 |\n| character_set_database | latin1 |\n| character_set_filesystem | binary |\n| character_set_results | utf8 |\n| character_set_server | latin1 |\n| character_set_system | utf8 |\n+--------------------------+--------+\n\nSHOW VARIABLES LIKE \'collation%\';\n+----------------------+-------------------+\n| Variable_name | Value |\n+----------------------+-------------------+\n| collation_connection | utf8_general_ci |\n| collation_database | latin1_swedish_ci |\n| collation_server | latin1_swedish_ci |\n+----------------------+-------------------+\n\nSET CHARACTER SET utf8mb4;\n\nSHOW VARIABLES LIKE \'character_set\\_%\';\n+--------------------------+---------+\n| Variable_name | Value |\n+--------------------------+---------+\n| character_set_client | utf8mb4 |\n| character_set_connection | latin1 |\n| character_set_database | latin1 |\n| character_set_filesystem | binary |\n| character_set_results | utf8mb4 |\n| character_set_server | latin1 |\n| character_set_system | utf8 |\n+--------------------------+---------+\n\nSHOW VARIABLES LIKE \'collation%\';\n+----------------------+-------------------+\n| Variable_name | Value |\n+----------------------+-------------------+\n| collation_connection | latin1_swedish_ci |\n| collation_database | latin1_swedish_ci |\n| collation_server | latin1_swedish_ci |\n+----------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/set-character-set/','','https://mariadb.com/kb/en/set-character-set/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,26,'SET NAMES','Syntax\n------\n\nSET NAMES {\'charset_name\'\n [COLLATE \'collation_name\'] | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client, character_set_connection, character_set_results\nand, implicitly, the collation_connection session system variables to the\nspecified character set and collation.\n\nThis determines which character set the client will use to send statements to\nthe server, and the server will use for sending results back to the client.\n\nucs2, utf16, and utf32 are not valid character sets for SET NAMES, as they\ncannot be used as client character sets.\n\nThe collation clause is optional. If not defined (or if DEFAULT is specified),\nthe default collation for the character set will be used.\n\nQuotes are optional for the character set or collation clauses.\n\nExamples\n--------\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-----------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-----------------+\n| CHARACTER_SET_RESULTS | utf8 |\n| CHARACTER_SET_CONNECTION | utf8 |\n| CHARACTER_SET_CLIENT | utf8 |\n| COLLATION_CONNECTION | utf8_general_ci |\n+--------------------------+-----------------+\n\nSET NAMES big5;\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-----------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-----------------+\n| CHARACTER_SET_RESULTS | big5 |\n| CHARACTER_SET_CONNECTION | big5 |\n| CHARACTER_SET_CLIENT | big5 |\n| COLLATION_CONNECTION | big5_chinese_ci |\n+--------------------------+-----------------+\n\nSET NAMES \'latin1\' COLLATE \'latin1_bin\';\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+---------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+---------------+\n| CHARACTER_SET_RESULTS | latin1 |\n| CHARACTER_SET_CONNECTION | latin1 |\n| CHARACTER_SET_CLIENT | latin1 |\n| COLLATION_CONNECTION | latin1_bin |\n+--------------------------+---------------+\n\nSET NAMES DEFAULT;\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-------------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-------------------+\n| CHARACTER_SET_RESULTS | latin1 |\n| CHARACTER_SET_CONNECTION | latin1 |\n| CHARACTER_SET_CLIENT | latin1 |\n| COLLATION_CONNECTION | latin1_swedish_ci |\n+--------------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/set-names/','','https://mariadb.com/kb/en/set-names/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SET SQL_LOG_BIN','Syntax\n------\n\nSET [SESSION] sql_log_bin = {0|1}\n\nDescription\n-----------\n\nSets the sql_log_bin system variable, which disables or enables binary logging\nfor the current connection, if the client has the SUPER privilege. The\nstatement is refused with an error if the client does not have that privilege.\n\nBefore MariaDB 5.5 and before MySQL 5.6 one could also set sql_log_bin as a\nglobal variable. This was disabled as this was too dangerous as it could\ndamage replication.\n\nURL: https://mariadb.com/kb/en/set-sql_log_bin/','','https://mariadb.com/kb/en/set-sql_log_bin/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,26,'SET STATEMENT','MariaDB starting with 10.1.2\n----------------------------\nPer-query variables were introduced in MariaDB 10.1.2\n\nSET STATEMENT can be used to set the value of a system variable for the\nduration of the statement. It is also possible to set multiple variables.\n\nSyntax\n------\n\nSET STATEMENT var1=value1 [, var2=value2, ...] \n FOR <statement>\n\nwhere varN is a system variable (list of allowed variables is provided below),\nand valueN is a constant literal.\n\nDescription\n-----------\n\nSET STATEMENT var1=value1 FOR stmt\n\nis roughly equivalent to\n\nSET @save_value=@@var1;\nSET SESSION var1=value1;\nstmt;\nSET SESSION var1=@save_value;\n\nThe server parses the whole statement before executing it, so any variables\nset in this fashion that affect the parser may not have the expected effect.\nExamples include the charset variables, sql_mode=ansi_quotes, etc.\n\nExamples\n--------\n\nOne can limit statement execution time max_statement_time:\n\nSET STATEMENT max_statement_time=1000 FOR SELECT ... ;\n\nOne can switch on/off individual optimizations:\n\nSET STATEMENT optimizer_switch=\'materialization=off\' FOR SELECT ....;\n\nIt is possible to enable MRR/BKA for a query:\n\nSET STATEMENT join_cache_level=6, optimizer_switch=\'mrr=on\' FOR SELECT ...\n\nNote that it makes no sense to try to set a session variable inside a SET\nSTATEMENT:\n\n#USELESS STATEMENT\nSET STATEMENT sort_buffer_size = 100000 for SET SESSION sort_buffer_size =\n200000;\n\nFor the above, after setting sort_buffer_size to 200000 it will be reset to\nits original state (the state before the SET STATEMENT started) after the\nstatement execution.\n\nLimitations\n-----------\n\nThere are a number of variables that cannot be set on per-query basis. These\ninclude:\n\n* autocommit\n* character_set_client\n* character_set_connection\n* character_set_filesystem\n* collation_connection\n* default_master_connection\n* debug_sync\n* interactive_timeout\n* gtid_domain_id\n* last_insert_id\n* log_slow_filter\n* log_slow_rate_limit\n* log_slow_verbosity\n* long_query_time\n* min_examined_row_limit\n* profiling\n* profiling_history_size\n* query_cache_type\n* rand_seed1\n* rand_seed2\n* skip_replication\n* slow_query_log\n* sql_log_off\n* tx_isolation\n* wait_timeout\n\nSource\n------\n\n* The feature was originally implemented as a Google Summer of Code 2009\nproject by Joseph Lukas. \n* Percona Server 5.6 included it as Per-query variable statement\n* MariaDB ported the patch and fixed many bugs. The task in MariaDB Jira is\nMDEV-5231.\n\nURL: https://mariadb.com/kb/en/set-statement/','','https://mariadb.com/kb/en/set-statement/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,26,'SET Variable','Syntax\n------\n\nSET var_name = expr [, var_name = expr] ...\n\nDescription\n-----------\n\nThe SET statement in stored programs is an extended version of the general SET\nstatement. Referenced variables may be ones declared inside a stored program,\nglobal system variables, or user-defined variables.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x, b=y, ...\nwhere different variable types (locally declared variables, global and session\nserver variables, user-defined variables) can be mixed. This also allows\ncombinations of local variables and some options that make sense only for\nsystem variables; in that case, the options are recognized but ignored.\n\nSET can be used with both local variables and user-defined variables.\n\nWhen setting several variables using the columns returned by a query, SELECT\nINTO should be preferred.\n\nTo set many variables to the same value, the LAST_VALUE( ) function can be\nused.\n\nBelow is an example of how a user-defined variable may be set:\n\nSET @x = 1;\n\nURL: https://mariadb.com/kb/en/set-variable/','','https://mariadb.com/kb/en/set-variable/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,26,'About SHOW','SHOW has many forms that provide information about databases, tables, columns,\nor status information about the server. These include:\n\n* SHOW AUTHORS\n* SHOW CHARACTER SET [like_or_where]\n* SHOW COLLATION [like_or_where]\n* SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\n* SHOW CONTRIBUTORS\n* SHOW CREATE DATABASE db_name\n* SHOW CREATE EVENT event_name\n* SHOW CREATE PACKAGE package_name\n* SHOW CREATE PACKAGE BODY package_name\n* SHOW CREATE PROCEDURE proc_name\n* SHOW CREATE TABLE tbl_name\n* SHOW CREATE TRIGGER trigger_name\n* SHOW CREATE VIEW view_name\n* SHOW DATABASES [like_or_where]\n* SHOW ENGINE engine_name {STATUS | MUTEX}\n* SHOW [STORAGE] ENGINES\n* SHOW ERRORS [LIMIT [offset,] row_count]\n* SHOW [FULL] EVENTS\n* SHOW FUNCTION CODE func_name\n* SHOW FUNCTION STATUS [like_or_where]\n* SHOW GRANTS FOR user\n* SHOW INDEX FROM tbl_name [FROM db_name]\n* SHOW INNODB STATUS\n* SHOW OPEN TABLES [FROM db_name] [like_or_where]\n* SHOW PLUGINS\n* SHOW PROCEDURE CODE proc_name\n* SHOW PROCEDURE STATUS [like_or_where]\n* SHOW PRIVILEGES\n* SHOW [FULL] PROCESSLIST\n* SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\n* SHOW PROFILES\n* SHOW [GLOBAL | SESSION] STATUS [like_or_where]\n* SHOW TABLE STATUS [FROM db_name] [like_or_where]\n* SHOW TABLES [FROM db_name] [like_or_where]\n* SHOW TRIGGERS [FROM db_name] [like_or_where]\n* SHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\n* SHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\' part,\n\'pattern\' is a string that can contain the SQL \"%\" and \"_\" wildcard\ncharacters. The pattern is useful for restricting statement output to matching\nvalues.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See Extended Show.\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 (357,26,'Extended Show','The following SHOW statements can be extended by using a WHERE clause and a\nLIKE clause to refine the results:\n\n* SHOW CHARACTER SET\n* SHOW COLLATION\n* SHOW COLUMNS\n* SHOW DATABASES\n* SHOW FUNCTION STATUS\n* SHOW INDEX\n* SHOW OPEN TABLES\n* SHOW PACKAGE STATUS\n* SHOW PACKAGE BODY STATUS\n* SHOW INDEX\n* SHOW PROCEDURE STATUS\n* SHOW STATUS\n* SHOW TABLE STATUS\n* SHOW TABLES\n* SHOW TRIGGERS\n* SHOW VARIABLES\n\nAs with a regular SELECT, the WHERE clause can be used for the specific\ncolumns returned, and the LIKE clause with the regular wildcards.\n\nExamples\n--------\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\nVariables whose name starts with aria and with a valued of greater than 8192:\n\nSHOW VARIABLES WHERE Variable_name LIKE \'aria%\' AND Value >8192;\n+------------------------------+---------------------+\n| Variable_name | Value |\n+------------------------------+---------------------+\n| aria_checkpoint_log_activity | 1048576 |\n| aria_log_file_size | 1073741824 |\n| aria_max_sort_file_size | 9223372036853727232 |\n| aria_pagecache_buffer_size | 134217728 |\n| aria_sort_buffer_size | 134217728 |\n+------------------------------+---------------------+\n\nShortcut, just returning variables whose name begins with aria.\n\nSHOW VARIABLES LIKE \'aria%\';\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\nURL: https://mariadb.com/kb/en/extended-show/','','https://mariadb.com/kb/en/extended-show/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (358,26,'SHOW AUTHORS','Syntax\n------\n\nSHOW AUTHORS\n\nDescription\n-----------\n\nThe SHOW AUTHORS statement displays information about the people who work on\nMariaDB. For each author, it displays Name, Location, and Comment values. All\ncolumns are encoded as latin1.\n\nThese include:\n\n* First the active people in MariaDB are listed.\n* Then the active people in MySQL.\n* Last the people that have contributed to MariaDB/MySQL in the past.\n\nThe order is somewhat related to importance of the contribution given to the\nMariaDB project, but this is not 100% accurate. There is still room for\nimprovement and debate...\n\nExample\n-------\n\nSHOW AUTHORS\\G\n*************************** 1. row ***************************\n Name: Michael (Monty) Widenius\nLocation: Tusby, Finland\n Comment: Lead developer and main author\n*************************** 2. row ***************************\n Name: Sergei Golubchik\nLocation: Kerpen, Germany\n Comment: Architect, Full-text search, precision math, plugin framework,\nmerges etc\n*************************** 3. row ***************************\n Name: Igor Babaev\nLocation: Bellevue, USA\n Comment: Optimizer, keycache, core work\n*************************** 4. row ***************************\n Name: Sergey Petrunia\nLocation: St. Petersburg, Russia\n Comment: Optimizer\n*************************** 5. row ***************************\n Name: Oleksandr Byelkin\nLocation: Lugansk, Ukraine\n Comment: Query Cache (4.0), Subqueries (4.1), Views (5.0)\n*************************** 6. row ***************************\n Name: Timour Katchaounov\nLocation: Sofia , Bulgaria\n Comment: Optimizer\n*************************** 7. row ***************************\n Name: Kristian Nielsen\nLocation: Copenhagen, Denmark\n Comment: Replication, Async client prototocol, General buildbot stuff\n*************************** 8. row ***************************\n Name: Alexander (Bar) Barkov\nLocation: Izhevsk, Russia\n Comment: Unicode and character sets\n*************************** 9. row ***************************\n Name: Alexey Botchkov (Holyfoot)\nLocation: Izhevsk, Russia\n Comment: GIS extensions, embedded server, precision math\n*************************** 10. row ***************************\n Name: Daniel Bartholomew\nLocation: Raleigh, USA\n Comment: MariaDB documentation, Buildbot, releases\n*************************** 11. row ***************************\n Name: Colin Charles\nLocation: Selangor, Malesia\n Comment: MariaDB documentation, talks at a LOT of conferences\n*************************** 12. row ***************************\n Name: Sergey Vojtovich\nLocation: Izhevsk, Russia\n Comment: initial implementation of plugin architecture, maintained native\nstorage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of table cache\n*************************** 13. row ***************************\n Name: Vladislav Vaintroub\nLocation: Mannheim, Germany\n Comment: MariaDB Java connector, new thread pool, Windows optimizations\n*************************** 14. row ***************************\n Name: Elena Stepanova\nLocation: Sankt Petersburg, Russia\n Comment: QA, test cases\n*************************** 15. row ***************************\n Name: Georg Richter\nLocation: Heidelberg, Germany\n Comment: New LGPL C connector, PHP connector\n*************************** 16. row ***************************\n Name: Jan Lindström\nLocation: Ylämylly, Finland\n Comment: Working on InnoDB\n*************************** 17. row ***************************\n Name: Lixun Peng\nLocation: Hangzhou, China\n Comment: Multi Source replication\n*************************** 18. row ***************************\n Name: Olivier Bertrand\nLocation: Paris, France\n Comment: CONNECT storage engine\n*************************** 19. row ***************************\n Name: Kentoku Shiba\nLocation: Tokyo, Japan\n Comment: Spider storage engine, metadata_lock_info Information schema\n*************************** 20. row ***************************\n Name: Percona\nLocation: CA, USA\n Comment: XtraDB, microslow patches, extensions to slow log\n*************************** 21. row ***************************\n Name: Vicentiu Ciorbaru\nLocation: Bucharest, Romania\n Comment: Roles\n*************************** 22. row ***************************\n Name: Sudheera Palihakkara\nLocation: \n Comment: PCRE Regular Expressions\n*************************** 23. row ***************************\n Name: Pavel Ivanov\nLocation: USA\n Comment: Some patches and bug fixes\n*************************** 24. row ***************************\n Name: Konstantin Osipov\nLocation: Moscow, Russia\n Comment: Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)\n*************************** 25. row ***************************\n Name: Ian Gilfillan\nLocation: South Africa\n Comment: MariaDB documentation\n*************************** 26. row ***************************\n Name: Federico Razolli\nLocation: Italy\n Comment: MariaDB documentation Italian translation\n*************************** 27. row ***************************\n Name: Guilhem Bichot\nLocation: Bordeaux, France\n Comment: Replication (since 4.0)\n*************************** 28. row ***************************\n Name: Andrei Elkin\nLocation: Espoo, Finland\n Comment: Replication\n*************************** 29. row ***************************\n Name: Dmitri Lenev\nLocation: Moscow, Russia\n Comment: Time zones support (4.1), Triggers (5.0)\n*************************** 30. row ***************************\n Name: Marc Alff\nLocation: Denver, CO, USA\n Comment: Signal, Resignal, Performance schema\n*************************** 31. row ***************************\n Name: Mikael Ronström\nLocation: Stockholm, Sweden\n Comment: NDB Cluster, Partitioning, online alter table\n*************************** 32. row ***************************\n Name: Ingo Strüwing\nLocation: Berlin, Germany\n Comment: Bug fixing in MyISAM, Merge tables etc\n*************************** 33. row ***************************\n Name: Marko Mäkelä\nLocation: Helsinki, Finland\n Comment: InnoDB core developer\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 (359,26,'SHOW BINARY LOGS','Syntax\n------\n\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nDescription\n-----------\n\nLists the binary log files on the server. This statement is used as part of\nthe procedure described in PURGE BINARY LOGS, that shows how to determine\nwhich logs can be purged.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the BINLOG MONITOR privilege.\n\nExamples\n--------\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\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 (360,26,'SHOW BINLOG EVENTS','Syntax\n------\n\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nDescription\n-----------\n\nShows the events in the binary log. If you do not specify \'log_name\', the\nfirst binary log is displayed.\n\nRequires the BINLOG MONITOR privilege (>= MariaDB 10.5.2) or the REPLICATION\nSLAVE privilege (<= MariaDB 10.5.1).\n\nExample\n-------\n\nSHOW BINLOG EVENTS IN \'mysql_sandbox10019-bin.000002\';\n+-------------------------------+-----+-------------------+-----------+--------\n----+------------------------------------------------+\n| Log_name | Pos | Event_type | Server_id |\nEnd_log_pos | Info |\n+-------------------------------+-----+-------------------+-----------+--------\n----+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | \n 248 | Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | \n 273 | [] |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint | 1 | \n 325 | mysql_sandbox10019-bin.000002 |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | \n 363 | GTID 0-1-1 |\n| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | \n 446 | CREATE DATABASE blog |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | \n 484 | GTID 0-1-2 |\n| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | \n 571 | use `blog`; CREATE TABLE bb (id INT) |\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 (361,26,'SHOW CHARACTER SET','Syntax\n------\n\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW CHARACTER SET statement shows all available character sets. The LIKE\nclause, if present on its own, indicates which character set names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema CHARACTER_SETS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncharacter set at the server, database, table and column levels.\n\nExamples\n--------\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 | 1 |\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| 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\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 (362,26,'SHOW CLIENT_STATISTICS','Syntax\n------\n\nSHOW CLIENT_STATISTICS\n\nDescription\n-----------\n\nThe SHOW CLIENT_STATISTICS statement is part of the User Statistics feature.\nIt was removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.CLIENT_STATISTICS table holds statistics about client\nconnections.\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.CLIENT_STATISTICS articles for more\ninformation.\n\nExample\n-------\n\nSHOW CLIENT_STATISTICS\\G\n*************************** 1. row ***************************\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\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 (363,26,'SHOW CONTRIBUTORS','Syntax\n------\n\nSHOW CONTRIBUTORS\n\nDescription\n-----------\n\nThe SHOW CONTRIBUTORS statement displays information about the companies and\npeople who financially contribute to MariaDB. For each contributor, it\ndisplays Name, Location, and Comment values. All columns are encoded as latin1.\n\nIt displays all members and sponsors of the MariaDB Foundation as well as\nother financial contributors.\n\nExample\n-------\n\nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+------------------------\n------------------------------------+\n| Name | Location | Comment \n |\n+---------------------+-------------------------------+------------------------\n------------------------------------+\n| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| Tencent Cloud | https://cloud.tencent.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| Microsoft | https://microsoft.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| MariaDB Corporation | https://mariadb.com | Founding member,\nPlatinum Sponsor of the MariaDB Foundation |\n| ServiceNow | https://servicenow.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| Intel | https://www.intel.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| SIT | https://sit.org | Platinum Sponsor of\nthe MariaDB Foundation |\n| Visma | https://visma.com | Gold Sponsor of the\nMariaDB Foundation |\n| DBS | https://dbs.com | Gold Sponsor of the\nMariaDB Foundation |\n| IBM | https://www.ibm.com | Gold Sponsor of the\nMariaDB Foundation |\n| Automattic | https://automattic.com | Silver Sponsor of the\nMariaDB Foundation |\n| Percona | https://www.percona.com/ | Sponsor of the MariaDB\nFoundation |\n| Galera Cluster | https://galeracluster.com | Sponsor of the MariaDB\nFoundation |\n| Google | USA | Sponsoring encryption,\nparallel replication and GTID |\n| Facebook | USA | Sponsoring\nnon-blocking API, LIMIT ROWS EXAMINED etc |\n| Ronald Bradford | Brisbane, Australia | EFF contribution for\nUC2006 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\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 (364,26,'SHOW CREATE DATABASE','Syntax\n------\n\nSHOW CREATE {DATABASE | SCHEMA} db_name\n\nDescription\n-----------\n\nShows the CREATE DATABASE statement that creates the given database. SHOW\nCREATE SCHEMA is a synonym for SHOW CREATE DATABASE. SHOW CREATE DATABASE\nquotes database names according to the value of the sql_quote_show_create\nserver system variable.\n\nExamples\n--------\n\nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |\n+----------+-----------------------------------------------------------------+\n\nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET 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 latin1 */ |\n+----------+---------------------------------------------------------------+\n\nWith a comment, from MariaDB 10.5:\n\nSHOW CREATE DATABASE p;\n+----------+-------------------------------------------------------------------\n------------------+\n| Database | Create Database \n |\n+----------+-------------------------------------------------------------------\n------------------+\n| p | CREATE DATABASE `p` /*!40100 DEFAULT CHARACTER SET latin1 */\nCOMMENT \'presentations\' |\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 (365,26,'SHOW CREATE EVENT','Syntax\n------\n\nSHOW CREATE EVENT event_name\n\nDescription\n-----------\n\nThis statement displays the CREATE EVENT statement needed to re-create a given\nevent, as well as the SQL_MODE that was used when the trigger has been created\nand the character set used by the connection. To find out which events are\npresent, 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 more complete,\ninformation.\n\nExamples\n--------\n\nSHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\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 (366,26,'SHOW CREATE FUNCTION','Syntax\n------\n\nSHOW CREATE FUNCTION func_name\n\nDescription\n-----------\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored 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-------\n\nSHOW CREATE FUNCTION VatCents\\G\n*************************** 1. row ***************************\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\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 (367,26,'SHOW CREATE PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package specification.\n\nExamples\n--------\n\nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row ***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE\n\"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\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 (368,26,'SHOW CREATE PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package body (i.e. the\nimplementation).\n\nExamples\n--------\n\nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row ***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE BODY\n\"employee_tools\" AS\n\nstdRaiseAmount DECIMAL(10,2):=500;\n\nPROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n\nPROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename, esalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n\nFUNCTION 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=\' || nSalary);\n RETURN nSalary;\n END;\n\nPROCEDURE 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=\' || amount);\n END;\n\nPROCEDURE 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() || \' \' || current_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\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 (369,26,'SHOW CREATE PROCEDURE','Syntax\n------\n\nSHOW CREATE PROCEDURE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns the exact string that can be\nused to re-create the named stored procedure, as well as the SQL_MODE that was\nused when the trigger has been created and the character set used by the\nconnection.. A similar statement, SHOW CREATE FUNCTION, displays information\nabout stored functions.\n\nBoth statements require that you are the owner of the routine or have the\nSELECT privilege on the mysql.proc table. When neither is true, the statements\ndisplay NULL for the Create Procedure or Create Function field.\n\nWarning Users with SELECT privileges on mysql.proc or USAGE privileges on *.*\ncan view the text of routines, even when they do not have privileges for the\nfunction or procedure itself.\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--------\n\nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION\nstatements.\n\nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nSHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nWhen the user issuing the statement does not have privileges on the routine,\nattempting to CALL the procedure raises Error 1370.\n\nCALL test.prc1();\nError 1370 (42000): execute command denieed to user \'test_user\'@\'localhost\'\nfor routine \'test\'.\'prc1\'\n\nIf the user neither has privilege to the routine nor the SELECT privilege on\nmysql.proc table, it raises Error 1305, informing them that the procedure does\nnot exist.\n\nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\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 (370,26,'SHOW CREATE SEQUENCE','MariaDB starting with 10.3.1\n----------------------------\nSequences were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSHOW CREATE SEQUENCE sequence_name;\n\nDescription\n-----------\n\nShows the CREATE SEQUENCE statement that created the given sequence. The\nstatement requires the SELECT privilege for the table.\n\nExample\n-------\n\nCREATE SEQUENCE s1 START WITH 50;\nSHOW CREATE SEQUENCE s1\\G;\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue\n9223372036854775806 \n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nNotes\n-----\n\nIf you want to see the underlying table structure used for the SEQUENCE you\ncan use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the\ncurrent recorded state of the SEQUENCE:\n\nSHOW CREATE TABLE s1\\G\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\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 when sequences is\ncreated \n or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, \n 1 if the sequence should begin a new cycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have been done\'\n) ENGINE=InnoDB SEQUENCE=1\n\nSELECT * FROM s1\\G\n*************************** 1. row ***************************\nnext_not_cached_value: 50\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 50\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\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 (371,26,'SHOW CREATE TRIGGER','Syntax\n------\n\nSHOW CREATE TRIGGER trigger_name\n\nDescription\n-----------\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger, as well as the SQL_MODE that was used when the trigger has been\ncreated and the 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--------\n\nSHOW CREATE TRIGGER example\\G\n*************************** 1. row ***************************\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\n\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example\nBEFORE\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\nMariaDB starting with 10.2.3\n----------------------------\nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3 as part of\nintroducing multiple trigger events per action.\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 (372,26,'SHOW CREATE VIEW','Syntax\n------\n\nSHOW CREATE VIEW view_name\n\nDescription\n-----------\n\nThis statement shows a CREATE VIEW statement that creates the given view, as\nwell as the character set used by the connection when the view was created.\nThis statement also works with views.\n\nSHOW CREATE VIEW quotes table, column and stored function names according to\nthe value of the sql_quote_show_create server system variable.\n\nExamples\n--------\n\nSHOW CREATE VIEW example\\G\n*************************** 1. row ***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS `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 View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL\nSECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n\nGrants\n------\n\nTo be able to see a view, you need to have the SHOW VIEW and the SELECT\nprivilege on the view:\n\nGRANT SHOW VIEW,SELECT ON test_database.test_view TO \'test\'@\'localhost\';\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 (373,26,'SHOW DATABASES','Syntax\n------\n\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW DATABASES lists the databases on the MariaDB server host. SHOW SCHEMAS is\na synonym for SHOW DATABASES. The LIKE clause, if present on its own,\nindicates which database names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as discussed in Extended\nSHOW.\n\nYou see only those databases for which you have some kind of privilege, unless\nyou have the global SHOW DATABASES privilege. You can also get this list using\nthe mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you cannot use\nthis statement at all unless you have the SHOW DATABASES privilege.\n\nThe list of results returned by SHOW DATABASES is based on directories in the\ndata directory, which is how MariaDB implements databases. It\'s possible that\noutput includes directories that do not correspond to actual databases.\n\nThe Information Schema SCHEMATA table also contains database information.\n\nExamples\n--------\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\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 (374,26,'SHOW ENGINE','Syntax\n------\n\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nDescription\n-----------\n\nSHOW ENGINE displays operational information about a storage engine. The\nfollowing statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\nSHOW ENGINE ROCKSDB STATUS\n\nIf the Sphinx Storage Engine is installed, the following is also supported:\n\nSHOW ENGINE SPHINX STATUS\n\nSee SHOW ENGINE SPHINX STATUS.\n\nOlder (and now removed) synonyms were SHOW INNODB STATUS for SHOW ENGINE\nINNODB STATUS and SHOW MUTEX STATUS for SHOW ENGINE INNODB MUTEX.\n\nSHOW ENGINE INNODB STATUS\n-------------------------\n\nSHOW ENGINE INNODB STATUS displays extensive information from the standard\nInnoDB Monitor about the state of the InnoDB storage engine. See SHOW ENGINE\nINNODB STATUS for more.\n\nSHOW ENGINE INNODB MUTEX\n------------------------\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n\nThe statement displays the following output fields:\n\n* Type: Always InnoDB.\n* Name: The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number is dependent on the\nMariaDB version.\n* Status: This field displays the following values if UNIV_DEBUG was defined\nat compilation time (for example, in include/univ.h in the InnoDB part of the\nsource tree). Only the os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the output is based is\ninsufficient to distinguish regular mutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer). Consequently, the\n output may appear to contain multiple rows for the same mutex.\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. (spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits. This occurs when\n the spinlock did not work (the mutex was not locked during the spinlock and\n it was necessary to yield to the operating system and wait).\nos_yields indicates the number of times a the thread trying to lock a mutex\n gave up its timeslice and yielded to the operating system (on the\n presumption that allowing other threads to run will free the mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in operating system\n waits, if the timed_mutexes system variable is 1 (ON). If timed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0. timed_mutexes is off by\n default.\n\nInformation from this statement can be used to diagnose system problems. For\nexample, large values of spin_waits and spin_rounds may indicate scalability\nproblems.\n\nThe information_schema.INNODB_MUTEXES table provides similar information.\n\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n-------------------------------------\n\nThis statement shows how much memory is used for performance_schema tables and\ninternal buffers.\n\nThe output contains the following fields:\n\n* Type: Always performance_schema.\n* Name: The name of a table, the name of an internal buffer, or the\nperformance_schema word, followed by a dot and an attribute. Internal buffers\nnames are enclosed by parenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \n* Status: The value for the attribute.\n\nThe following attributes are shown, in this order, for all tables:\n\n* row_size: The memory used for an individual record. This value will never\nchange.\n* row_count: The number of rows in the table or buffer. For some tables, this\nvalue depends on a server system variable.\n* memory: For tables and performance_schema, this is the result of row_size *\nrow_count.\n\nFor internal buffers, the attributes are:\n\n* count\n* size\n\nSHOW ENGINE ROCKSDB STATUS\n--------------------------\n\nSee also MyRocks Performance Troubleshooting\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 (375,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that\ndisplays the InnoDB Monitor output, which is extensive InnoDB information\nwhich can be useful in diagnosing problems.\n\nThe following sections are displayed\n\n* Status: Shows the timestamp, monitor name and the number of seconds, or the\nelapsed time between the current time and the time the InnoDB Monitor output\nwas last displayed. The per-second averages are based upon this time.\n* BACKGROUND THREAD: srv_master_thread lines show work performed by the main\nbackground thread.\n* SEMAPHORES: Threads waiting for a semaphore and stats on how the number of\ntimes threads have needed a spin or a wait on a mutex or rw-lock semaphore. If\nthis number of threads is large, there may be I/O or contention issues.\nReducing the size of the innodb_thread_concurrency system variable may help if\ncontention is related to thread scheduling. Spin rounds per wait shows the\nnumber of spinlock rounds per OS wait for a mutex. \n* LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key\nconstraint error, it displays the failed statement and information about the\nconstraint and the related tables.\n* LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it\ndisplays the transactions involved in the deadlock and the statements being\nexecuted, held and required locked and the transaction rolled back to.\n* TRANSACTIONS: The output of this section can help identify lock contention,\nas well as reasons for the deadlocks.\n* FILE I/O: InnoDB thread information as well as pending I/O operations and\nI/O performance statistics.\n* INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for\nthe change buffer) and adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive hash index\nperformance.\n* LOG: InnoDB log information, including current log sequence number, how far\nthe log has been flushed to disk, the position at which InnoDB last took a\ncheckpoint, pending writes and write performance statistics.\n* BUFFER POOL AND MEMORY: Information on buffer pool pages read and written,\nwhich allows you to see the number of data file I/O operations performed by\nyour queries. See InnoDB Buffer Pool for more. Similar information is also\navailable from the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\n* ROW OPERATIONS:Information about the main thread, including the number and\nperformance rate for each type of row operation.\n\nIf the innodb_status_output_locks system variable is set to 1, extended lock\ninformation will be displayed.\n\nExample output:\n\n=====================================\n2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 4 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle\nsrv_master_thread log flush and writes: 83682\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 15\nOS WAIT ARRAY INFO: signal count 8\nRW-shared spins 0, rounds 20, OS waits 7\nRW-excl spins 0, rounds 0, OS waits 0\nRW-sx spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx\n------------\nTRANSACTIONS\n------------\nTrx id counter 236\nPurge done for trx\'s n:o < 236 undo n:o < 0 state: running\nHistory list length 22\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 421747401994584, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n---TRANSACTION 421747401990328, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests (insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log thread)\nI/O thread 2 state: waiting for completed aio requests (read thread)\nI/O thread 3 state: waiting for completed aio requests (read thread)\nI/O thread 4 state: waiting for completed aio requests (read thread)\nI/O thread 5 state: waiting for completed aio requests (read thread)\nI/O thread 6 state: waiting for completed aio requests (write thread)\nI/O thread 7 state: waiting for completed aio requests (write thread)\nI/O thread 8 state: waiting for completed aio requests (write thread)\nI/O thread 9 state: waiting for completed aio requests (write thread)\nPending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,\n ibuf aio reads:, log i/o\'s:, sync i/o\'s:\nPending flushes (fsync) log: 0; buffer pool: 0\n286 OS file reads, 171 OS file writes, 22 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\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 445926\nLog flushed up to 445926\nPages flushed up to 445926\nLast checkpoint at 445917\n0 pending log flushes, 0 pending chkp writes\n18 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal large memory allocated 167772160\nDictionary memory allocated 50768\nBuffer pool size 8012\nFree buffers 7611\nDatabase pages 401\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 264, created 137, written 156\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, Random read ahead\n0.00/s\nLRU len: 401, 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\nProcess ID=4267, Main thread ID=140272021272320, state: sleeping\nNumber of rows inserted 1, updated 0, deleted 0, read 1\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 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\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 (376,26,'SHOW ENGINES','Syntax\n------\n\nSHOW [STORAGE] ENGINES\n\nDescription\n-----------\n\nSHOW ENGINES displays status information about the server\'s storage engines.\nThis is particularly useful for checking whether a storage engine is\nsupported, or to see what the default engine is. SHOW TABLE TYPES is a\ndeprecated synonym.\n\nThe information_schema.ENGINES table provides the same information.\n\nSince storage engines are plugins, different information about them is also\nshown in the information_schema.PLUGINS table and by the SHOW PLUGINS\nstatement.\n\nNote that both MySQL\'s InnoDB and Percona\'s XtraDB replacement are labeled as\nInnoDB. However, if XtraDB is in use, it will be specified in the COMMENT\nfield. See XtraDB and InnoDB. The same applies to FederatedX.\n\nThe output consists of the following columns:\n\n* Engine indicates the engine\'s name.\n* Support indicates whether the engine is installed, and whether it is the\ndefault engine for the current session.\n* Comment is a brief description.\n* Transactions, XA and Savepoints indicate whether transactions, XA\ntransactions and transaction savepoints are supported by the engine.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n*************************** 1. row ***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and foreign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row ***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row ***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row ***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it disappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row ***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row ***************************\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 Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row ***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row ***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row ***************************\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\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 (377,26,'SHOW ERRORS','Syntax\n------\n\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) ERRORS\n\nDescription\n-----------\n\nThis statement is similar to SHOW WARNINGS, except that instead of displaying\nerrors, warnings, and notes, it displays only errors.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You can also\nretrieve this number from the error_count variable.\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nThe value of error_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nFor a list of MariaDB error codes, see MariaDB Error Codes.\n\nExamples\n--------\n\nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n\nSHOW COUNT(*) ERRORS;\n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSHOW ERRORS;\n+-------+------+---------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\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 (378,26,'SHOW EVENTS','Syntax\n------\n\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nShows information about Event Manager events (created with CREATE EVENT).\nRequires the EVENT privilege. Without any arguments, SHOW EVENTS lists all of\nthe events in the current 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 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 look at the\ninformation_schema.EVENTS table.\n\nTo see events for a specific schema, use the FROM clause. For example, to see\nevents for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The WHERE\nclause can be given to select rows using more general conditions, as discussed\nin Extended Show.\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 (379,26,'SHOW FUNCTION STATUS','Syntax\n------\n\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored functions.\n\nThe LIKE clause, if present on its own, indicates which function names to\nmatch.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe information_schema.ROUTINES table contains more detailed information.\n\nExamples\n--------\n\nShowing all stored functions:\n\nSHOW FUNCTION STATUS\\G\n*************************** 1. row ***************************\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 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\' \\G\n*************************** 1. row ***************************\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\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 (380,26,'SHOW LOCALES','SHOW LOCALES was introduced as part of the Information Schema plugin extension.\n\nSHOW LOCALES is used to return locales information as part of the Locales\nplugin. While the information_schema.LOCALES table has 8 columns, the SHOW\nLOCALES statement will only display 4 of them:\n\nExample\n-------\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\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 (381,26,'SHOW OPEN TABLES','Syntax\n------\n\nSHOW OPEN TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open in the\ntable cache. See http://dev.mysql.com/doc/refman/5.1/en/table-cache.html.\n\nThe FROM and LIKE clauses may be used.\n\nThe FROM clause, if present, restricts the tables shown to those present in\nthe db_name database.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Database | Database name. |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| In_use | Number of table instances being used. |\n+---------------------------+------------------------------------------------+\n| Name_locked | 1 if the table is name-locked, e.g. if it is |\n| | being dropped or renamed, otherwise 0. |\n+---------------------------+------------------------------------------------+\n\nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ... WRITE would\nincrement In_use for that table. With the implementation of the metadata\nlocking improvements in MariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL\nlock, and concurrent connections will wait on this MDL lock, so any subsequent\nLOCK TABLE... WRITE will not increment In_use.\n\nExample\n-------\n\nSHOW OPEN TABLES;\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\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 (382,26,'SHOW PACKAGE BODY STATUS','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW PACKAGE BODY STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE BODY STATUS statement returns characteristics of stored\npackage bodies (implementations), such as the database, name, type, creator,\ncreation and modification dates, and character set information. A similar\nstatement, SHOW PACKAGE STATUS, displays information about stored package\nspecifications.\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE\nand LIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PACKAGE BODY STATUS LIKE \'pkg1\'\\G\n*************************** 1. row ***************************\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\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 (383,26,'SHOW PACKAGE STATUS','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW PACKAGE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE STATUS statement returns characteristics of stored package\nspecifications, such as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar statement, SHOW\nPACKAGE BODY STATUS, displays information about stored package bodies (i.e.\nimplementations).\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE\nand LIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PACKAGE STATUS LIKE \'pkg1\'\\G\n*************************** 1. row ***************************\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\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 (384,26,'SHOW PRIVILEGES','Syntax\n------\n\nSHOW PRIVILEGES\n\nDescription\n-----------\n\nSHOW PRIVILEGES shows the list of system privileges that the MariaDB server\nsupports. The exact list of privileges depends on the version of your server.\n\nNote that before MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.2 , the\nDelete history privilege displays as Delete versioning rows (MDEV-20382).\n\nExample\n-------\n\nFrom MariaDB 10.5.9\n\nSHOW PRIVILEGES;\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Privilege | Context | Comment \n |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Alter | Tables | To alter\nthe table |\n| Alter routine | Functions,Procedures | To alter\nor drop stored functions/procedures |\n| Create | Databases,Tables,Indexes | To create\nnew databases and tables |\n| Create routine | Databases | To use\nCREATE FUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use\nCREATE TEMPORARY TABLE |\n| Create view | Tables | To create\nnew views |\n| Create user | Server Admin | To create\nnew users |\n| Delete | Tables | To delete\nexisting rows |\n| Delete history | Tables | To delete\nversioning table historical rows |\n| Drop | Databases,Tables | To drop\ndatabases, tables, and views |\n| Event | Server Admin | To\ncreate, alter, drop and execute events |\n| Execute | Functions,Procedures | To\nexecute stored routines |\n| File | File access on server | To read\nand write files on the server |\n| Grant option | Databases,Tables,Functions,Procedures | To give\nto other users those privileges you possess |\n| Index | Tables | To create\nor drop indexes |\n| Insert | Tables | To insert\ndata into tables |\n| Lock tables | Databases | To use\nLOCK TABLES (together with SELECT privilege) |\n| Process | Server Admin | To view\nthe plain text of currently executing queries |\n| Proxy | Server Admin | To make\nproxy user possible |\n| References | Databases,Tables | To have\nreferences on tables |\n| Reload | Server Admin | To reload\nor refresh tables, logs and privileges |\n| Binlog admin | Server | To purge\nbinary logs |\n| Binlog monitor | Server | To use\nSHOW BINLOG STATUS and SHOW BINARY LOG |\n| Binlog replay | Server | To use\nBINLOG (generated by mariadb-binlog) |\n| Replication master admin | Server | To\nmonitor connected slaves |\n| Replication slave admin | Server | To\nstart/stop slave and apply binlog events |\n| Slave monitor | Server | To use\nSHOW SLAVE STATUS and SHOW RELAYLOG EVENTS |\n| Replication slave | Server Admin | To read\nbinary log events from the master |\n| Select | Tables | To\nretrieve rows from table |\n| Show databases | Server Admin | To see\nall databases with SHOW DATABASES |\n| Show view | Tables | To see\nviews with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut\ndown the server |\n| Super | Server Admin | To use\nKILL thread, SET GLOBAL, CHANGE MASTER, etc. |\n| Trigger | Tables | To use\ntriggers |\n| Create tablespace | Server Admin | To\ncreate/alter/drop tablespaces |\n| Update | Tables | To update\nexisting rows |\n| Set user | Server | To create\nviews and stored routines with a different definer |\n| Federated admin | Server | To\nexecute the CREATE SERVER, ALTER SERVER, DROP SERVER statements |\n| Connection admin | Server | To bypass\nconnection limits and kill other users\' connections |\n| Read_only admin | Server | To\nperform write operations even if @@read_only=ON |\n| Usage | Server Admin | No\nprivileges - allow connect only |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n41 rows in set (0.000 sec)\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 (385,26,'SHOW PROCEDURE CODE','Syntax\n------\n\nSHOW PROCEDURE CODE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension that is available only for servers that\nhave been built with debugging support. It displays a representation of the\ninternal implementation of the named stored procedure. A similar statement,\nSHOW FUNCTION CODE, displays information about stored functions.\n\nBoth statements require that you be the owner of the routine or have SELECT\naccess to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result set. Each\nrow in the result set corresponds to one \"instruction\" in the routine. The\nfirst column is Pos, which is an ordinal number beginning with 0. The second\ncolumn is Instruction, which contains an SQL statement (usually changed from\nthe original source), or a directive which has meaning only to the\nstored-routine handler.\n\nExamples\n--------\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\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 (386,26,'SHOW PROCEDURE STATUS','Syntax\n------\n\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns characteristics of a stored\nprocedure, such as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar statement, SHOW\nFUNCTION STATUS, displays information about stored functions.\n\nThe LIKE clause, if present, indicates which procedure or function names to\nmatch. The WHERE and LIKE clauses can be given to select rows using more\ngeneral conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row ***************************\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\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 (387,26,'SHOW PROCESSLIST','Syntax\n------\n\nSHOW [FULL] PROCESSLIST\n\nDescription\n-----------\n\nSHOW PROCESSLIST shows you which threads are running. You can also get this\ninformation from the information_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. If you have the PROCESS privilege, you can see all\nthreads. Otherwise, you can see only your own threads (that is, threads\nassociated with the MariaDB account that you are using). If you do not use the\nFULL keyword, only the first 100 characters of each statement are shown in the\nInfo field.\n\nThe columns shown in SHOW PROCESSLIST are:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| ID | The client\'s process ID. |\n+---------------------+------------------------------------------------------+\n| USER | The username associated with the process. |\n+---------------------+------------------------------------------------------+\n| HOST | The host the client is connected to. |\n+---------------------+------------------------------------------------------+\n| DB | The default database of the process (NULL if no |\n| | default). |\n+---------------------+------------------------------------------------------+\n| COMMAND | The command type. See Thread Command Values. |\n+---------------------+------------------------------------------------------+\n| TIME | The amount of time, in seconds, the process has |\n| | been in its current state. For a replica SQL thread |\n| | before MariaDB 10.1, this is the time in seconds |\n| | between the last replicated event\'s timestamp and |\n| | the replica machine\'s real time. |\n+---------------------+------------------------------------------------------+\n| STATE | See Thread States. |\n+---------------------+------------------------------------------------------+\n| INFO | The statement being executed. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The total progress of the process (0-100%) (see |\n| | Progress Reporting). |\n+---------------------+------------------------------------------------------+\n\nSee TIME_MS column in information_schema.PROCESSLIST for differences in the\nTIME column between MariaDB and MySQL.\n\nThe information_schema.PROCESSLIST table contains the following additional\ncolumns:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| TIME_MS | The amount of time, in milliseconds, the process |\n| | has been in its current state. |\n+---------------------+------------------------------------------------------+\n| STAGE | The stage the process is currently in. |\n+---------------------+------------------------------------------------------+\n| MAX_STAGE | The maximum number of stages. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The progress of the process within the current |\n| | stage (0-100%). |\n+---------------------+------------------------------------------------------+\n| MEMORY_USED | The amount of memory used by the process. |\n+---------------------+------------------------------------------------------+\n| EXAMINED_ROWS | The number of rows the process has examined. |\n+---------------------+------------------------------------------------------+\n| QUERY_ID | Query ID. |\n+---------------------+------------------------------------------------------+\n\nNote that the PROGRESS field from the information schema, and the PROGRESS\nfield from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows\nthe total progress, while the information schema shows the progress for the\ncurrent stage only.\n\nThreads can be killed using their thread_id or their query_id, with the KILL\nstatement.\n\nSince queries on this table are locking, if the performance_schema is enabled,\nyou may want to query the THREADS table instead.\n\nExamples\n--------\n\nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| Id | User | Host | db | Command | Time | State \n | Info | Progress |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty\nqueue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock \n | SHOW PROCESSLIST | 0.000 |\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 (388,26,'SHOW PROFILE','Syntax\n------\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-----------\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling information\nthat indicates resource usage for statements executed during the course of the\ncurrent session.\n\nProfiling is controlled by the profiling session variable, which has a default\nvalue of 0 (OFF). Profiling is enabled by setting profiling to 1 or ON:\n\nSET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nmaster. The size of the list is controlled by the profiling_history_size\nsession variable, which has a default value of 15. The maximum value is 100.\nSetting the value to 0 has the practical effect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILES and SHOW PROFILE, so you will\nfind neither of those statements in the profile list. Malformed statements are\nprofiled. For example, SHOW PROFILING is an illegal statement, and a syntax\nerror occurs if you try to execute it, but it will show up in the profiling\nlist.\n\nSHOW PROFILE displays detailed information about a single statement. Without\nthe FOR QUERY n clause, the output pertains to the most recently executed\nstatement. If FOR QUERY n is included, SHOW PROFILE displays information for\nstatement n. The values of n correspond to the Query_ID values displayed by\nSHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to row_count rows.\nIf LIMIT is given, OFFSET offset may be added to begin the output offset rows\ninto the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The Status\nvalues are like the State values displayed by SHOW PROCESSLIST, although there\nmight be some minor differences in interpretation for the two statements for\nsome 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 additional types of\ninformation:\n\n* ALL displays all information\n* BLOCK IO displays counts for block input and output operations\n* CONTEXT SWITCHES displays counts for voluntary and involuntary context\nswitches\n* CPU displays user and system CPU usage times\n* IPC displays counts for messages sent and received\n* MEMORY is not currently implemented\n* PAGE FAULTS displays counts for major and minor page faults\n* SOURCE displays the names of functions from the source code, together with\nthe name and line number of the file in which the function occurs\n* SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nThe information_schema.PROFILING table contains similar information.\n\nExamples\n--------\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\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 (389,26,'SHOW PROFILES','Syntax\n------\n\nSHOW PROFILES\n\nDescription\n-----------\n\nThe SHOW PROFILES statement displays profiling information that indicates\nresource usage for statements executed during the course of the current\nsession. It is used together with SHOW PROFILE.\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 (390,26,'SHOW QUERY_RESPONSE_TIME','It is possible to use SHOW QUERY_RESPONSE_TIME as an alternative for\nretrieving information from the QUERY_RESPONSE_TIME plugin.\n\nThis was introduced as part of the Information Schema plugin extension.\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 (391,26,'SHOW STATUS','Syntax\n------\n\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW STATUS provides server status information. This information also can be\nobtained using the mysqladmin extended-status command, or by querying the\nInformation Schema GLOBAL_STATUS and SESSION_STATUS tables. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for all\nconnections to MariaDB. With SESSION, it displays the status values for the\ncurrent connection. If no modifier is present, the default is SESSION. LOCAL\nis a synonym for SESSION. If you see a lot of 0 values, the reason is probably\nthat you have used SHOW STATUS with a new connection instead of SHOW GLOBAL\nSTATUS.\n\nSome status variables have only a global value. For these, you get the same\nvalue for both GLOBAL and SESSION.\n\nSee Server Status Variables for a full list, scope and description of the\nvariables that can be viewed with SHOW STATUS.\n\nThe LIKE clause, if present on its own, indicates which variable name to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nFull output from MariaDB 10.1.17:\n\nSHOW GLOBAL STATUS;\n+--------------------------------------------------------------+---------------\n------------------------+\n| Variable_name | Value \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n| Aborted_clients | 0 \n |\n| Aborted_connects | 0 \n |\n| Access_denied_errors | 0 \n |\n| Acl_column_grants | 0 \n |\n| Acl_database_grants | 2 \n |\n| Acl_function_grants | 0 \n |\n| Acl_procedure_grants | 0 \n |\n| Acl_proxy_users | 2 \n |\n| Acl_role_grants | 0 \n |\n| Acl_roles | 0 \n |\n| Acl_table_grants | 0 \n |\n| Acl_users | 6 \n |\n| Aria_pagecache_blocks_not_flushed | 0 \n |\n| Aria_pagecache_blocks_unused | 15706 \n |\n| Aria_pagecache_blocks_used | 0 \n |\n| Aria_pagecache_read_requests | 0 \n |\n| Aria_pagecache_reads | 0 \n |\n| Aria_pagecache_write_requests | 0 \n |\n| Aria_pagecache_writes | 0 \n |\n| Aria_transaction_log_syncs | 0 \n |\n| Binlog_commits | 0 \n |\n| Binlog_group_commits | 0 \n |\n| Binlog_group_commit_trigger_count | 0 \n |\n| Binlog_group_commit_trigger_lock_wait | 0 \n |\n| Binlog_group_commit_trigger_timeout | 0 \n |\n| Binlog_snapshot_file | \n |\n| Binlog_snapshot_position | 0 \n |\n| Binlog_bytes_written | 0 \n |\n| Binlog_cache_disk_use | 0 \n |\n| Binlog_cache_use | 0 \n |\n| Binlog_stmt_cache_disk_use | 0 \n |\n| Binlog_stmt_cache_use | 0 \n |\n| Busy_time | 0.000000 \n |\n| Bytes_received | 432 \n |\n| Bytes_sent | 15183 \n |\n| Com_admin_commands | 1 \n |\n| Com_alter_db | 0 \n |\n| Com_alter_db_upgrade | 0 \n |\n| Com_alter_event | 0 \n |\n| Com_alter_function | 0 \n |\n| Com_alter_procedure | 0 \n |\n| Com_alter_server | 0 \n |\n| Com_alter_table | 0 \n |\n| Com_alter_tablespace | 0 \n |\n| Com_analyze | 0 \n |\n| Com_assign_to_keycache | 0 \n |\n| Com_begin | 0 \n |\n| Com_binlog | 0 \n |\n| Com_call_procedure | 0 \n |\n| Com_change_db | 0 \n |\n| Com_change_master | 0 \n |\n| Com_check | 0 \n |\n| Com_checksum | 0 \n |\n| Com_commit | 0 \n |\n| Com_compound_sql | 0 \n |\n| Com_create_db | 0 \n |\n| Com_create_event | 0 \n |\n| Com_create_function | 0 \n |\n| Com_create_index | 0 \n |\n| Com_create_procedure | 0 \n |\n| Com_create_role | 0 \n |\n| Com_create_server | 0 \n |\n| Com_create_table | 0 \n |\n| Com_create_temporary_table | 0 \n |\n| Com_create_trigger | 0 \n |\n| Com_create_udf | 0 \n |\n| Com_create_user | 0 \n |\n| Com_create_view | 0 \n |\n| Com_dealloc_sql | 0 \n |\n| Com_delete | 0 \n |\n| Com_delete_multi | 0 \n |\n| Com_do | 0 \n |\n| Com_drop_db | 0 \n |\n| Com_drop_event | 0 \n |\n| Com_drop_function | 0 \n |\n| Com_drop_index | 0 \n |\n| Com_drop_procedure | 0 \n |\n| Com_drop_role | 0 \n |\n| Com_drop_server | 0 \n |\n| Com_drop_table | 0 \n |\n| Com_drop_temporary_table | 0 \n |\n| Com_drop_trigger | 0 \n |\n| Com_drop_user | 0 \n |\n| Com_drop_view | 0 \n |\n| Com_empty_query | 0 \n |\n| Com_execute_sql | 0 \n |\n| Com_flush | 0 \n |\n| Com_get_diagnostics | 0 \n |\n| Com_grant | 0 \n |\n| Com_grant_role | 0 \n |\n| Com_ha_close | 0 \n |\n| Com_ha_open | 0 \n |\n| Com_ha_read | 0 \n |\n| Com_help | 0 \n |\n| Com_insert | 0 \n |\n| Com_insert_select | 0 \n |\n| Com_install_plugin | 0 \n |\n| Com_kill | 0 \n |\n| Com_load | 0 \n |\n| Com_lock_tables | 0 \n |\n| Com_optimize | 0 \n |\n| Com_preload_keys | 0 \n |\n| Com_prepare_sql | 0 \n |\n| Com_purge | 0 \n |\n| Com_purge_before_date | 0 \n |\n| Com_release_savepoint | 0 \n |\n| Com_rename_table | 0 \n |\n| Com_rename_user | 0 \n |\n| Com_repair | 0 \n |\n| Com_replace | 0 \n |\n| Com_replace_select | 0 \n |\n| Com_reset | 0 \n |\n| Com_resignal | 0 \n |\n| Com_revoke | 0 \n |\n| Com_revoke_all | 0 \n |\n| Com_revoke_role | 0 \n |\n| Com_rollback | 0 \n |\n| Com_rollback_to_savepoint | 0 \n |\n| Com_savepoint | 0 \n |\n| Com_select | 1 \n |\n| Com_set_option | 0 \n |\n| Com_show_authors | 0 \n |\n| Com_show_binlog_events | 0 \n |\n| Com_show_binlogs | 0 \n |\n| Com_show_charsets | 0 \n |\n| Com_show_collations | 0 \n |\n| Com_show_contributors | 0 \n |\n| Com_show_create_db | 0 \n |\n| Com_show_create_event | 0 \n |\n| Com_show_create_func | 0 \n |\n| Com_show_create_proc | 0 \n |\n| Com_show_create_table | 0 \n |\n| Com_show_create_trigger | 0 \n |\n| Com_show_databases | 0 \n |\n| Com_show_engine_logs | 0 \n |','','https://mariadb.com/kb/en/show-status/');
-update help_topic set description = CONCAT(description, '\n| Com_show_engine_mutex | 0 \n |\n| Com_show_engine_status | 0 \n |\n| Com_show_errors | 0 \n |\n| Com_show_events | 0 \n |\n| Com_show_explain | 0 \n |\n| Com_show_fields | 0 \n |\n| Com_show_function_status | 0 \n |\n| Com_show_generic | 0 \n |\n| Com_show_grants | 0 \n |\n| Com_show_keys | 0 \n |\n| Com_show_master_status | 0 \n |\n| Com_show_open_tables | 0 \n |\n| Com_show_plugins | 0 \n |\n| Com_show_privileges | 0 \n |\n| Com_show_procedure_status | 0 \n |\n| Com_show_processlist | 0 \n |\n| Com_show_profile | 0 \n |\n| Com_show_profiles | 0 \n |\n| Com_show_relaylog_events | 0 \n |\n| Com_show_slave_hosts | 0 \n |\n| Com_show_slave_status | 0 \n |\n| Com_show_status | 2 \n |\n| Com_show_storage_engines | 0 \n |\n| Com_show_table_status | 0 \n |\n| Com_show_tables | 0 \n |\n| Com_show_triggers | 0 \n |\n| Com_show_variables | 0 \n |\n| Com_show_warnings | 0 \n |\n| Com_shutdown | 0 \n |\n| Com_signal | 0 \n |\n| Com_start_all_slaves | 0 \n |\n| Com_start_slave | 0 \n |\n| Com_stmt_close | 0 \n |\n| Com_stmt_execute | 0 \n |\n| Com_stmt_fetch | 0 \n |\n| Com_stmt_prepare | 0 \n |\n| Com_stmt_reprepare | 0 \n |\n| Com_stmt_reset | 0 \n |\n| Com_stmt_send_long_data | 0 \n |\n| Com_stop_all_slaves | 0 \n |\n| Com_stop_slave | 0 \n |\n| Com_truncate | 0 \n |\n| Com_uninstall_plugin | 0 \n |\n| Com_unlock_tables | 0 \n |\n| Com_update | 0 \n |\n| Com_update_multi | 0 \n |\n| Com_xa_commit | 0 \n |\n| Com_xa_end | 0 \n |\n| Com_xa_prepare | 0 \n |\n| Com_xa_recover | 0 \n |\n| Com_xa_rollback | 0 \n |\n| Com_xa_start | 0 \n |\n| Compression | OFF \n |\n| Connection_errors_accept | 0 \n |\n| Connection_errors_internal | 0 \n |\n| Connection_errors_max_connections | 0 \n |\n| Connection_errors_peer_address | 0 \n |\n| Connection_errors_select | 0 \n |\n| Connection_errors_tcpwrap | 0 \n |\n| Connections | 4 \n |\n| Cpu_time | 0.000000 \n |\n| Created_tmp_disk_tables | 0 \n |\n| Created_tmp_files | 6 \n |\n| Created_tmp_tables | 2 \n |\n| Delayed_errors | 0 \n |\n| Delayed_insert_threads | 0 \n |\n| Delayed_writes | 0 \n |\n| Delete_scan | 0 \n |\n| Empty_queries | 0 \n |\n| Executed_events | 0 \n |\n| Executed_triggers | 0 \n |\n| Feature_delay_key_write | 0 \n |\n| Feature_dynamic_columns | 0 \n |\n| Feature_fulltext | 0 \n |\n| Feature_gis | 0 \n |\n| Feature_locale | 0 \n |\n| Feature_subquery | 0 \n |\n| Feature_timezone | 0 \n |\n| Feature_trigger | 0 \n |\n| Feature_xml | 0 \n |\n| Flush_commands | 1 \n |\n| Handler_commit | 1 \n |\n| Handler_delete | 0 \n |\n| Handler_discover | 0 \n |\n| Handler_external_lock | 0 \n |\n| Handler_icp_attempts | 0 \n |\n| Handler_icp_match | 0 \n |\n| Handler_mrr_init | 0 \n |\n| Handler_mrr_key_refills | 0 \n |\n| Handler_mrr_rowid_refills | 0 \n |\n| Handler_prepare | 0 \n |\n| Handler_read_first | 3 \n |\n| Handler_read_key | 0 \n |\n| Handler_read_last | 0 \n |\n| Handler_read_next | 0 \n |\n| Handler_read_prev | 0 \n |\n| Handler_read_retry | 0 \n |\n| Handler_read_rnd | 0 \n |\n| Handler_read_rnd_deleted | 0 \n |\n| Handler_read_rnd_next | 537 \n |\n| Handler_rollback | 0 \n |\n| Handler_savepoint | 0 \n |\n| Handler_savepoint_rollback | 0 \n |\n| Handler_tmp_update | 0 \n |\n| Handler_tmp_write | 516 \n |\n| Handler_update | 0 \n |\n| Handler_write | 0 \n |\n| Innodb_available_undo_logs | 128 \n |\n| Innodb_background_log_sync | 222 \n |\n| Innodb_buffer_pool_bytes_data | 2523136 \n |\n| Innodb_buffer_pool_bytes_dirty | 0 \n |\n| Innodb_buffer_pool_dump_status | Dumping\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_load_status | Loading\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_pages_data | 154 \n |\n| Innodb_buffer_pool_pages_dirty | 0 \n |\n| Innodb_buffer_pool_pages_flushed | 1 \n |\n| Innodb_buffer_pool_pages_free | 8037 \n |\n| Innodb_buffer_pool_pages_lru_flushed | 0 \n |\n| Innodb_buffer_pool_pages_made_not_young | 0 \n |\n| Innodb_buffer_pool_pages_made_young | 0 \n |\n| Innodb_buffer_pool_pages_misc | 0 \n |\n| Innodb_buffer_pool_pages_old | 0 \n |\n| Innodb_buffer_pool_pages_total | 8191 \n |\n| Innodb_buffer_pool_read_ahead | 0 \n |\n| Innodb_buffer_pool_read_ahead_evicted | 0 \n |\n| Innodb_buffer_pool_read_ahead_rnd | 0 \n |\n| Innodb_buffer_pool_read_requests | 558 \n |\n| Innodb_buffer_pool_reads | 155 \n |\n| Innodb_buffer_pool_wait_free | 0 \n |\n| Innodb_buffer_pool_write_requests | 1 \n |\n| Innodb_checkpoint_age | 0 \n |\n| Innodb_checkpoint_max_age | 80826164 \n |\n| Innodb_data_fsyncs | 5 \n |\n| Innodb_data_pending_fsyncs | 0 \n |\n| Innodb_data_pending_reads | 0 \n |\n| Innodb_data_pending_writes | 0 \n |\n| Innodb_data_read | 2609664 \n |\n| Innodb_data_reads | 172 \n |\n| Innodb_data_writes | 5 \n |\n| Innodb_data_written | 34304 \n |\n| Innodb_dblwr_pages_written | 1 \n |\n| Innodb_dblwr_writes | 1 \n |\n| Innodb_deadlocks | 0 \n |\n| Innodb_have_atomic_builtins | ON \n |\n| Innodb_history_list_length | 0 \n |\n| Innodb_ibuf_discarded_delete_marks | 0 \n |\n| Innodb_ibuf_discarded_deletes | 0 \n |\n| Innodb_ibuf_discarded_inserts | 0 \n |\n| Innodb_ibuf_free_list | 0 \n |\n| Innodb_ibuf_merged_delete_marks | 0 \n |\n| Innodb_ibuf_merged_deletes | 0 \n |\n| Innodb_ibuf_merged_inserts | 0 \n |\n| Innodb_ibuf_merges | 0 \n |') WHERE help_topic_id = 391;
-update help_topic set description = CONCAT(description, '\n| Innodb_ibuf_segment_size | 2 \n |\n| Innodb_ibuf_size | 1 \n |\n| Innodb_log_waits | 0 \n |\n| Innodb_log_write_requests | 0 \n |\n| Innodb_log_writes | 1 \n |\n| Innodb_lsn_current | 1616829 \n |\n| Innodb_lsn_flushed | 1616829 \n |\n| Innodb_lsn_last_checkpoint | 1616829 \n |\n| Innodb_master_thread_active_loops | 0 \n |\n| Innodb_master_thread_idle_loops | 222 \n |\n| Innodb_max_trx_id | 2308 \n |\n| Innodb_mem_adaptive_hash | 2217568 \n |\n| Innodb_mem_dictionary | 630703 \n |\n| Innodb_mem_total | 140771328 \n |\n| Innodb_mutex_os_waits | 1 \n |\n| Innodb_mutex_spin_rounds | 30 \n |\n| Innodb_mutex_spin_waits | 1 \n |\n| Innodb_oldest_view_low_limit_trx_id | 0 \n |\n| Innodb_os_log_fsyncs | 3 \n |\n| Innodb_os_log_pending_fsyncs | 0 \n |\n| Innodb_os_log_pending_writes | 0 \n |\n| Innodb_os_log_written | 512 \n |\n| Innodb_page_size | 16384 \n |\n| Innodb_pages_created | 0 \n |\n| Innodb_pages_read | 154 \n |\n| Innodb_pages_written | 1 \n |\n| Innodb_purge_trx_id | 0 \n |\n| Innodb_purge_undo_no | 0 \n |\n| Innodb_read_views_memory | 88 \n |\n| Innodb_row_lock_current_waits | 0 \n |\n| Innodb_row_lock_time | 0 \n |\n| Innodb_row_lock_time_avg | 0 \n |\n| Innodb_row_lock_time_max | 0 \n |\n| Innodb_row_lock_waits | 0 \n |\n| Innodb_rows_deleted | 0 \n |\n| Innodb_rows_inserted | 0 \n |\n| Innodb_rows_read | 0 \n |\n| Innodb_rows_updated | 0 \n |\n| Innodb_system_rows_deleted | 0 \n |\n| Innodb_system_rows_inserted | 0 \n |\n| Innodb_system_rows_read | 0 \n |\n| Innodb_system_rows_updated | 0 \n |\n| Innodb_s_lock_os_waits | 2 \n |\n| Innodb_s_lock_spin_rounds | 60 \n |\n| Innodb_s_lock_spin_waits | 2 \n |\n| Innodb_truncated_status_writes | 0 \n |\n| Innodb_x_lock_os_waits | 0 \n |\n| Innodb_x_lock_spin_rounds | 0 \n |\n| Innodb_x_lock_spin_waits | 0 \n |\n| Innodb_page_compression_saved | 0 \n |\n| Innodb_page_compression_trim_sect512 | 0 \n |\n| Innodb_page_compression_trim_sect1024 | 0 \n |\n| Innodb_page_compression_trim_sect2048 | 0 \n |\n| Innodb_page_compression_trim_sect4096 | 0 \n |\n| Innodb_page_compression_trim_sect8192 | 0 \n |\n| Innodb_page_compression_trim_sect16384 | 0 \n |\n| Innodb_page_compression_trim_sect32768 | 0 \n |\n| Innodb_num_index_pages_written | 0 \n |\n| Innodb_num_non_index_pages_written | 5 \n |\n| Innodb_num_pages_page_compressed | 0 \n |\n| Innodb_num_page_compressed_trim_op | 0 \n |\n| Innodb_num_page_compressed_trim_op_saved | 0 \n |\n| Innodb_num_pages_page_decompressed | 0 \n |\n| Innodb_num_pages_page_compression_error | 0 \n |\n| Innodb_num_pages_encrypted | 0 \n |\n| Innodb_num_pages_decrypted | 0 \n |\n| Innodb_have_lz4 | OFF \n |\n| Innodb_have_lzo | OFF \n |\n| Innodb_have_lzma | OFF \n |\n| Innodb_have_bzip2 | OFF \n |\n| Innodb_have_snappy | OFF \n |\n| Innodb_defragment_compression_failures | 0 \n |\n| Innodb_defragment_failures | 0 \n |\n| Innodb_defragment_count | 0 \n |\n| Innodb_onlineddl_rowlog_rows | 0 \n |\n| Innodb_onlineddl_rowlog_pct_used | 0 \n |\n| Innodb_onlineddl_pct_progress | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_cache | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 \n |\n| Innodb_encryption_rotation_pages_modified | 0 \n |\n| Innodb_encryption_rotation_pages_flushed | 0 \n |\n| Innodb_encryption_rotation_estimated_iops | 0 \n |\n| Innodb_scrub_background_page_reorganizations | 0 \n |\n| Innodb_scrub_background_page_splits | 0 \n |\n| Innodb_scrub_background_page_split_failures_underflow | 0 \n |\n| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 \n |\n| Innodb_scrub_background_page_split_failures_missing_index | 0 \n |\n| Innodb_scrub_background_page_split_failures_unknown | 0 \n |\n| Key_blocks_not_flushed | 0 \n |\n| Key_blocks_unused | 107163 \n |\n| Key_blocks_used | 0 \n |\n| Key_blocks_warm | 0 \n |\n| Key_read_requests | 0 \n |\n| Key_reads | 0 \n |\n| Key_write_requests | 0 \n |\n| Key_writes | 0 \n |\n| Last_query_cost | 0.000000 \n |\n| Master_gtid_wait_count | 0 \n |\n| Master_gtid_wait_time | 0 \n |\n| Master_gtid_wait_timeouts | 0 \n |\n| Max_statement_time_exceeded | 0 \n |\n| Max_used_connections | 1 \n |\n| Memory_used | 273614696 \n |\n| Not_flushed_delayed_rows | 0 \n |\n| Open_files | 25 \n |\n| Open_streams | 0 \n |\n| Open_table_definitions | 18 \n |\n| Open_tables | 11 \n |\n| Opened_files | 77 \n |\n| Opened_plugin_libraries | 0 \n |\n| Opened_table_definitions | 18 \n |\n| Opened_tables | 18 \n |\n| Opened_views | 0 \n |\n| Performance_schema_accounts_lost | 0 \n |\n| Performance_schema_cond_classes_lost | 0 \n |\n| Performance_schema_cond_instances_lost | 0 \n |\n| Performance_schema_digest_lost | 0 \n |\n| Performance_schema_file_classes_lost | 0 \n |\n| Performance_schema_file_handles_lost | 0 \n |\n| Performance_schema_file_instances_lost | 0 \n |\n| Performance_schema_hosts_lost | 0 \n |\n| Performance_schema_locker_lost | 0 \n |\n| Performance_schema_mutex_classes_lost | 0 \n |\n| Performance_schema_mutex_instances_lost | 0 \n |\n| Performance_schema_rwlock_classes_lost | 0 \n |\n| Performance_schema_rwlock_instances_lost | 0 \n |\n| Performance_schema_session_connect_attrs_lost | 0 \n |\n| Performance_schema_socket_classes_lost | 0 \n |\n| Performance_schema_socket_instances_lost | 0 \n |\n| Performance_schema_stage_classes_lost | 0 \n |\n| Performance_schema_statement_classes_lost | 0 \n |\n| Performance_schema_table_handles_lost | 0 \n |\n| Performance_schema_table_instances_lost | 0 \n |\n| Performance_schema_thread_classes_lost | 0 \n |\n| Performance_schema_thread_instances_lost | 0 \n |\n| Performance_schema_users_lost | 0 \n |\n| Prepared_stmt_count | 0 \n |\n| Qcache_free_blocks | 1 \n |\n| Qcache_free_memory | 1031336 \n |\n| Qcache_hits | 0 \n |\n| Qcache_inserts | 0 \n |\n| Qcache_lowmem_prunes | 0 \n |\n| Qcache_not_cached | 0 \n |\n| Qcache_queries_in_cache | 0 \n |\n| Qcache_total_blocks | 1 \n |\n| Queries | 4 \n |\n| Questions | 4 \n |\n| Rows_read | 10 \n |\n| Rows_sent | 517 \n |\n| Rows_tmp_read | 516 \n |\n| Rpl_status | AUTH_MASTER \n |') WHERE help_topic_id = 391;
-update help_topic set description = CONCAT(description, '\n| Select_full_join | 0 \n |\n| Select_full_range_join | 0 \n |\n| Select_range | 0 \n |\n| Select_range_check | 0 \n |\n| Select_scan | 2 \n |\n| Slave_connections | 0 \n |\n| Slave_heartbeat_period | 0.000 \n |\n| Slave_open_temp_tables | 0 \n |\n| Slave_received_heartbeats | 0 \n |\n| Slave_retried_transactions | 0 \n |\n| Slave_running | OFF \n |\n| Slave_skipped_errors | 0 \n |\n| Slaves_connected | 0 \n |\n| Slaves_running | 0 \n |\n| Slow_launch_threads | 0 \n |\n| Slow_queries | 0 \n |\n| Sort_merge_passes | 0 \n |\n| Sort_priority_queue_sorts | 0 \n |\n| Sort_range | 0 \n |\n| Sort_rows | 0 \n |\n| Sort_scan | 0 \n |\n| Ssl_accept_renegotiates | 0 \n |\n| Ssl_accepts | 0 \n |\n| Ssl_callback_cache_hits | 0 \n |\n| Ssl_cipher | \n |\n| Ssl_cipher_list | \n |\n| Ssl_client_connects | 0 \n |\n| Ssl_connect_renegotiates | 0 \n |\n| Ssl_ctx_verify_depth | 0 \n |\n| Ssl_ctx_verify_mode | 0 \n |\n| Ssl_default_timeout | 0 \n |\n| Ssl_finished_accepts | 0 \n |\n| Ssl_finished_connects | 0 \n |\n| Ssl_server_not_after | \n |\n| Ssl_server_not_before | \n |\n| Ssl_session_cache_hits | 0 \n |\n| Ssl_session_cache_misses | 0 \n |\n| Ssl_session_cache_mode | NONE \n |\n| Ssl_session_cache_overflows | 0 \n |\n| Ssl_session_cache_size | 0 \n |\n| Ssl_session_cache_timeouts | 0 \n |\n| Ssl_sessions_reused | 0 \n |\n| Ssl_used_session_cache_entries | 0 \n |\n| Ssl_verify_depth | 0 \n |\n| Ssl_verify_mode | 0 \n |\n| Ssl_version | \n |\n| Subquery_cache_hit | 0 \n |\n| Subquery_cache_miss | 0 \n |\n| Syncs | 2 \n |\n| Table_locks_immediate | 21 \n |\n| Table_locks_waited | 0 \n |\n| Tc_log_max_pages_used | 0 \n |\n| Tc_log_page_size | 4096 \n |\n| Tc_log_page_waits | 0 \n |\n| Threadpool_idle_threads | 0 \n |\n| Threadpool_threads | 0 \n |\n| Threads_cached | 0 \n |\n| Threads_connected | 1 \n |\n| Threads_created | 2 \n |\n| Threads_running | 1 \n |\n| Update_scan | 0 \n |\n| Uptime | 223 \n |\n| Uptime_since_flush_status | 223 \n |\n| wsrep_cluster_conf_id |\n18446744073709551615 |\n| wsrep_cluster_size | 0 \n |\n| wsrep_cluster_state_uuid | \n |\n| wsrep_cluster_status | Disconnected \n |\n| wsrep_connected | OFF \n |\n| wsrep_local_bf_aborts | 0 \n |\n| wsrep_local_index |\n18446744073709551615 |\n| wsrep_provider_name | \n |\n| wsrep_provider_vendor | \n |\n| wsrep_provider_version | \n |\n| wsrep_ready | OFF \n |\n| wsrep_thread_count | 0 \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n516 rows in set (0.00 sec)\n\nExample of filtered output:\n\nSHOW STATUS LIKE \'Key%\';\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\nURL: https://mariadb.com/kb/en/show-status/') WHERE help_topic_id = 391;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,26,'SHOW TABLE STATUS','Syntax\n------\n\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive\ninformation about each non-TEMPORARY table.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| Engine | Table storage engine. |\n+---------------------------+------------------------------------------------+\n| Version | Version number from the table\'s .frm file. |\n+---------------------------+------------------------------------------------+\n| Row_format | Row format (see InnoDB, Aria and MyISAM row |\n| | formats). |\n+---------------------------+------------------------------------------------+\n| Rows | Number of rows in the table. Some engines, |\n| | such as XtraDB and InnoDB may store an |\n| | estimate. |\n+---------------------------+------------------------------------------------+\n| Avg_row_length | Average row length in the table. |\n+---------------------------+------------------------------------------------+\n| Data_length | For InnoDB/XtraDB, the index size, in pages, |\n| | multiplied by the page size. For Aria and |\n| | MyISAM, length of the data file, in bytes. |\n| | For MEMORY, the approximate allocated memory. |\n+---------------------------+------------------------------------------------+\n| Max_data_length | Maximum length of the data file, ie the total |\n| | number of bytes that could be stored in the |\n| | table. Not used in XtraDB and InnoDB. |\n+---------------------------+------------------------------------------------+\n| Index_length | Length of the index file. |\n+---------------------------+------------------------------------------------+\n| Data_free | Bytes allocated but unused. For InnoDB tables |\n| | in a shared tablespace, the free space of the |\n| | shared tablespace with small safety margin. |\n| | An estimate in the case of partitioned tables |\n| | - see the PARTITIONS table. |\n+---------------------------+------------------------------------------------+\n| Auto_increment | Next AUTO_INCREMENT value. |\n+---------------------------+------------------------------------------------+\n| Create_time | Time the table was created. Some engines just |\n| | return the ctime information from the file |\n| | system layer here, in that case the value is |\n| | not necessarily the table creation time but |\n| | rather the time the file system metadata for |\n| | it had last changed. |\n+---------------------------+------------------------------------------------+\n| Update_time | Time the table was last updated. On Windows, |\n| | the timestamp is not updated on update, so |\n| | MyISAM values will be inaccurate. In InnoDB, |\n| | if shared tablespaces are used, will be NULL, |\n| | while buffering can also delay the update, so |\n| | the value will differ from the actual time of |\n| | the last UPDATE, INSERT or DELETE. |\n+---------------------------+------------------------------------------------+\n| Check_time | Time the table was last checked. Not kept by |\n| | all storage engines, in which case will be |\n| | NULL. |\n+---------------------------+------------------------------------------------+\n| Collation | Character set and collation. |\n+---------------------------+------------------------------------------------+\n| Checksum | Live checksum value, if any. |\n+---------------------------+------------------------------------------------+\n| Create_options | Extra CREATE TABLE options. |\n+---------------------------+------------------------------------------------+\n| Comment | Table comment provided when MariaDB created |\n| | the table. |\n+---------------------------+------------------------------------------------+\n| Max_index_length | Maximum index length (supported by MyISAM and |\n| | Aria tables). Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n| Temporary | Placeholder to signal that a table is a |\n| | temporary table. Currently always \"N\", except |\n| | \"Y\" for generated information_schema tables |\n| | and NULL for views. Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n\nSimilar information can be found in the information_schema.TABLES table as\nwell as by using mysqlshow:\n\nmysqlshow --status db_name\n\nViews\n-----\n\nFor views, all columns in SHOW TABLE STATUS are NULL except \'Name\' and\n\'Comment\'\n\nExample\n-------\n\nshow table status\\G\n*************************** 1. row ***************************\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\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 (393,26,'SHOW TABLES','Syntax\n------\n\nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLES lists the non-TEMPORARY tables, sequences and views in a given\ndatabase.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the WHERE and LIKE\nclauses will be Tables_in_test\n\nThe FULL modifier is supported such that SHOW FULL TABLES displays a second\noutput column. Values for the second column, Table_type, are BASE TABLE for a\ntable, VIEW for a view 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 not show up in the\noutput from SHOW TABLES or mysqlshow db_name.\n\nThe information_schema.TABLES table, as well as the SHOW TABLE STATUS\nstatement, provide extended information about tables.\n\nExamples\n--------\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\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 (394,26,'SHOW TABLE_STATISTICS','Syntax\n------\n\nSHOW TABLE_STATISTICS\n\nDescription\n-----------\n\nThe SHOW TABLE_STATISTICS statementis part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics on table usage\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.TABLE_STATISTICS articles for more\ninformation.\n\nExample\n-------\n\nSHOW TABLE_STATISTICS\\G\n*************************** 1. row ***************************\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 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 Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row ***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\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 (395,26,'SHOW TRIGGERS','Syntax\n------\n\nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a database\n(the default database unless a FROM clause is given). This statement requires\nthe TRIGGER privilege (prior to MySQL 5.1.22, it required the SUPER privilege).\n\nThe LIKE clause, if present on its own, indicates which table names to match\nand causes the statement to display triggers for those tables. The WHERE and\nLIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nSimilar information is stored in the information_schema.TRIGGERS table.\n\nMariaDB starting with 10.2.3\n----------------------------\nIf there are multiple triggers for the same action, then the triggers are\nshown in action order.\n\nExamples\n--------\n\nFor the trigger defined at Trigger Overview:\n\nSHOW triggers Like \'animals\' \\G\n*************************** 1. row ***************************\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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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 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 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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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\n* character_set_client is the session value of the character_set_client system\nvariable when the trigger was created. \n* collation_connection is the session value of the collation_connection system\nvariable when the trigger was\n created. \n* Database 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 NULL in the\nCreated column.\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 (396,26,'SHOW USER_STATISTICS','Syntax\n------\n\nSHOW USER_STATISTICS\n\nDescription\n-----------\n\nThe SHOW USER_STATISTICS statement is part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.USER_STATISTICS table holds statistics about user activity.\nYou can use this table to find out such things as which user is causing the\nmost load and which users are being abusive. You can also use this table to\nmeasure how close to capacity the server may be.\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.USER_STATISTICS table for more\ninformation.\n\nExample\n-------\n\nSHOW USER_STATISTICS\\G\n*************************** 1. row ***************************\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\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 (397,26,'SHOW VARIABLES','Syntax\n------\n\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW VARIABLES shows the values of MariaDB system variables. This information\nalso can be obtained using the mysqladmin variables command. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are used for\nnew connections to MariaDB. With SESSION, it displays the values that are in\neffect for the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement\ndisplays only rows for those variables with names that match the pattern. To\nobtain the row for a specific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'maria_group_commit\';\nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n\nTo get a list of variables whose name match a pattern, use the \"%\" wildcard\ncharacter in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%maria%\';\nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n\nWildcard characters can be used in any position within the pattern to be\nmatched. Strictly speaking, because \"_\" is a wildcard that matches any single\ncharacter, you should escape it as \"\\_\" to match it literally. In practice,\nthis is rarely necessary.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, 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 that can be set.\n\nYou can also see the server variables by querying the Information Schema\nGLOBAL_VARIABLES and SESSION_VARIABLES tables.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE \'aria%\';\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| 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| 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| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n\nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nBecause the following variable only has a global scope, the global value is\nreturned even when specifying SESSION (in this case by default):\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\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 (398,26,'SHOW WARNINGS','Syntax\n------\n\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n\nDescription\n-----------\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted from\nthe last statement that generated messages in the current session. It shows\nnothing if the last statement used a table and generated no messages. (That\nis, a statement that uses a table but generates no messages clears the message\nlist.) Statements that do not use tables and do not generate messages have no\neffect on the message list.\n\nA note is different to a warning in that it only appears if the sql_notes\nvariable is set to 1 (the default), and is not converted to an error if strict\nmode is enabled.\n\nA related statement, SHOW ERRORS, shows only the errors.\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of errors,\nwarnings, and notes. You can also retrieve this number from the warning_count\nvariable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nThe value of warning_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is\ninternally rewritten by MariaDB.\n\nIf the sql_notes server variable is set to 1, Notes are included in the output\nof SHOW WARNINGS; if it is set to 0, this statement will not show (or count)\nNotes.\n\nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to\nthe client. If you need to access those information in a stored program, you\ncan use the GET DIAGNOSTICS 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 warnings. The \\W\ncommand will show warnings after every statement, while \\w will disable this.\nStarting the client with the --show-warnings option will show warnings after\nevery statement.\n\nMariaDB 10.3.1 implements a stored routine error stack trace. SHOW WARNINGS\ncan also be used to show more information. See the example below.\n\nExamples\n--------\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-----------\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 exist\n\nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist |\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 error actually\nhappened:\n\n* Line 4 in test.p1 is the OPEN command which actually raised the error\n* Line 3 in test.p2 is the CALL statement, calling p1 from p2.\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 (399,26,'SHOW WSREP_MEMBERSHIP','SHOW WSREP_MEMBERSHIP is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_MEMBERSHIP\n\nDescription\n-----------\n\nThe SHOW WSREP_MEMBERSHIP statement returns Galera node cluster membership\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with the SUPER privilege\ncan access this information.\n\nExamples\n--------\n\nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |\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 (400,26,'SHOW WSREP_STATUS','SHOW WSREP_STATUS is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_STATUS\n\nDescription\n-----------\n\nThe SHOW WSREP_STATUS statement returns Galera node and cluster status\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_STATUS table. Only users with the SUPER privilege can\naccess this information.\n\nExamples\n--------\n\nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\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 (401,26,'BINLOG','Syntax\n------\n\nBINLOG \'str\'\n\nDescription\n-----------\n\nBINLOG is an internal-use statement. It is generated by the\nmariadb-binlog/mysqlbinlog program as the printable representation of certain\nevents in binary log files. The \'str\' value is a base 64-encoded string the\nthat server decodes to determine the data change indicated by the\ncorresponding event. This statement requires the SUPER privilege (<= MariaDB\n10.5.1) or theBINLOG REPLAY privilege (>= MariaDB 10.5.2).\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 (402,26,'PURGE BINARY LOGS','Syntax\n------\n\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nDescription\n-----------\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed in the\nlog index file prior to the specified log file name or date. BINARY and MASTER\nare synonyms. Deleted log files also are removed from the list recorded in the\nindex file, so that the given log file becomes the first in the list.\n\nThe datetime expression is in the format \'YYYY-MM-DD hh:mm:ss\'.\n\nIf a replica is active but has yet to read from a binary log file you attempt\nto delete, the statement will fail with an error. However, if the replica is\nnot connected and has yet to read from a log file you delete, the file will be\ndeleted, but the replica will be unable to continue replicating once it\nconnects again.\n\nThis statement has no effect if the server was not started with the --log-bin\noption to enable binary logging.\n\nTo list the binary log files on the server, use SHOW BINARY LOGS. To see which\nfiles they are reading, use SHOW SLAVE STATUS (or SHOW REPLICA STATUS from\nMariaDB 10.5.1). You can only delete the files that are older than the oldest\nfile that is used by the slaves.\n\nTo delete all binary log files, use RESET MASTER. To move to a new log file\n(for example if you want to remove the current log file), use FLUSH LOGS\nbefore you execute PURGE LOGS.\n\nIf the expire_logs_days server system variable is not set to 0, the server\nautomatically deletes binary log files after the given number of days. From\nMariaDB 10.6, the binlog_expire_logs_seconds variable allows more precise\ncontrol over binlog deletion, and takes precedence if both are non-zero.\n\nRequires the SUPER privilege or, from MariaDB 10.5.2, the BINLOG ADMIN\nprivilege, to run.\n\nExamples\n--------\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\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 (403,26,'CACHE INDEX','Syntax\n------\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-----------\n\nThe CACHE INDEX statement assigns table indexes to a specific key cache. It is\nused only for MyISAM tables.\n\nA default key cache exists and cannot be destroyed. To create more key caches,\nthe key_buffer_size server system variable.\n\nThe associations between tables indexes and key caches are lost on server\nrestart. To recreate them automatically, it is necessary to configure caches\nin a configuration file and include some CACHE INDEX (and optionally LOAD\nINDEX) statements in the init file.\n\nExamples\n--------\n\nThe following statement assigns indexes from the tables t1, t2, and t3 to the\nkey 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---------------------------\n\nNormally CACHE INDEX should not take a long time to execute. Internally it\'s\nimplemented the following way:\n\n* Find the right key cache (under LOCK_global_system_variables)\n* Open the table with a TL_READ_NO_INSERT lock.\n* Flush the original key cache for the given file (under key cache lock)\n* Flush the new key cache for the given file (safety)\n* Move the file to the new key cache (under file share lock)\n\nThe only possible long operations are getting the locks for the table and\nflushing the original key cache, if there were many key blocks for the file in\nit.\n\nWe plan to also add CACHE INDEX for Aria tables if there is a need for this.\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 (404,26,'HELP Command','Syntax\n------\n\nHELP search_string\n\nDescription\n-----------\n\nThe HELP command can be used in any MariaDB client, such as the mysql\ncommand-line client, to get basic syntax help and a short description for most\ncommands and functions.\n\nIf you provide an argument to the HELP command, the mysql client uses it as a\nsearch string to access server-side help. The proper operation of this command\nrequires that the help tables in the mysql database be initialized with help\ntopic information.\n\nIf there is no match for the search string, the search fails. Use HELP\ncontents to see a list of the help categories:\n\nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help <item>\', where <item> is one of the following\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 list of matching\ntopics:\n\nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> 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 help entry for that\ntopic.\n\nThe help is provided with the MariaDB server and makes use of four help tables\nfound in the mysql database: help_relation, help_topic, help_category and\nhelp_keyword. These tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which, until MariaDB 10.4.7, contain data\ngenerated from an old version of MySQL.\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 (405,26,'KILL [CONNECTION | QUERY]','Syntax\n------\n\nKILL [HARD | SOFT] { {CONNECTION|QUERY} thread_id | QUERY ID query_id | USER\nuser_name }\n\nDescription\n-----------\n\nEach connection to mysqld runs in a separate thread. You can see which threads\nare running with the SHOW PROCESSLIST statement and kill a thread with the\nKILL thread_id statement. KILL allows the optional CONNECTION or QUERY\nmodifier:\n\n* KILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the given thread or\nquery id.\n* KILL QUERY terminates the statement that the connection thread_id is\n currently executing, but leaves the connection itself intact.\n* KILL QUERY ID terminates the query by query_id, leaving the connection\nintact.\n\nIf a connection is terminated that has an active transaction, the transaction\nwill be rolled back. If only a query is killed, the current transaction will\nstay active. See also idle_transaction_timeout.\n\nIf you have the PROCESS privilege, you can see all threads. If you have the\nSUPER privilege, or, from MariaDB 10.5.2, the CONNECTION ADMIN privilege, you\ncan kill all threads and statements. Otherwise, you can see and kill only your\nown threads and statements.\n\nKilling queries that repair or create indexes on MyISAM and Aria tables may\nresult in corrupted tables. Use the SOFT option to avoid this!\n\nThe HARD option (default) kills a command as soon as possible. If you use\nSOFT, then critical operations that may leave a table in an inconsistent state\nwill not be interrupted. Such operations include REPAIR and INDEX creation for\nMyISAM and Aria tables (REPAIR TABLE, OPTIMIZE TABLE).\n\nKILL ... USER username will kill all connections/queries for a given user.\nUSER can be specified one of the following ways:\n\n* username (Kill without regard to hostname)\n* username@hostname\n* CURRENT_USER or CURRENT_USER()\n\nIf you specify a thread id and that thread does not exist, you get the\nfollowing error:\n\nERROR 1094 (HY000): Unknown thread id: <thread_id>\n\nIf you specify a query id that doesn\'t exist, you get the following error:\n\nERROR 1957 (HY000): Unknown query id: <query_id>\n\nHowever, if you specify a user name, no error is issued for non-connected (or\neven non-existing) users. To check if the connection/query has been killed,\nyou can use the ROW_COUNT() function.\n\nA client whose connection is killed receives the following error:\n\nERROR 1317 (70100): Query execution was interrupted\n\nTo obtain a list of existing sessions, use the SHOW PROCESSLIST statement or\nquery the Information Schema PROCESSLIST table.\n\nNote: You cannot use KILL with the Embedded MySQL Server library because the\nembedded server merely runs inside the threads of the host application. It\ndoes not create any connection threads of its own.\n\nNote: You can also use mysqladmin kill thread_id [,thread_id...] to kill\nconnections. To get a list of running queries, use mysqladmin processlist. See\nmysqladmin.\n\nPercona Toolkit contains a program, pt-kill that can be used to automatically\nkill connections that match certain criteria. For example, it can be used to\nterminate idle connections, or connections that have been busy for more than\n60 seconds.\n\nURL: https://mariadb.com/kb/en/kill/','','https://mariadb.com/kb/en/kill/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,26,'LOAD INDEX','Syntax\n------\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-----------\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key cache\nto which it has been assigned by an explicit CACHE INDEX statement, or into\nthe default key cache otherwise. LOAD INDEX INTO CACHE is used only for MyISAM\nor Aria tables.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of the\nindex to be preloaded.\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 (407,26,'RESET','Syntax\n------\n\nRESET reset_option [, reset_option] ...\n\nDescription\n-----------\n\nThe RESET statement is used to clear the state of various server operations.\nYou must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement.\n\nThe different RESET options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deletes all relay logs from the slave and |\n| [\"connection_name\"] [ALL] | reset the replication position in the master |\n| | binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deletes all old binary logs, makes the binary |\n| | index file (--log-bin-index) empty and |\n| | creates a new binary log file. This is |\n| | useful when you want to reset the master to |\n| | an initial state. If you want to just delete |\n| | old, not used binary logs, you should use the |\n| | PURGE BINARY LOGS command. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Removes all queries from the query cache. See |\n| | also FLUSH QUERY CACHE. |\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 (408,26,'SHUTDOWN','Syntax\n------\n\nSHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]\n\nDescription\n-----------\n\nThe SHUTDOWN command shuts the server down.\n\nWAIT FOR ALL SLAVES\n-------------------\n\nMariaDB starting with 10.4.4\n----------------------------\nThe WAIT FOR ALL SLAVES option was first added in MariaDB 10.4.4. WAIT FOR ALL\nREPLICAS has been a synonym since MariaDB 10.5.1.\n\nWhen a master server is shutdown and it goes through the normal shutdown\nprocess, the master kills client threads in random order. By default, the\nmaster also considers its binary log dump threads to be regular client\nthreads. As a consequence, the binary log dump threads can be killed while\nclient threads still exist, and this means that data can be written on the\nmaster during a normal shutdown that won\'t be replicated. This is true even if\nsemi-synchronous replication is being used.\n\nIn MariaDB 10.4 and later, this problem can be solved by shutting down the\nserver with the SHUTDOWN command and by providing the WAIT FOR ALL SLAVES\noption to the command. For example:\n\nSHUTDOWN WAIT FOR ALL SLAVES;\n\nWhen the WAIT FOR ALL SLAVES option is provided, the server only kills its\nbinary log dump threads after all client threads have been killed, and it only\ncompletes the shutdown after the last binary log has been sent to all\nconnected replicas.\n\nSee Replication Threads: Binary Log Dump Threads and the Shutdown Process for\nmore information.\n\nRequired Permissions\n--------------------\n\nOne must have a SHUTDOWN privilege (see GRANT) to use this command. It is the\nsame privilege one needs to use the mariadb-admin/mysqladmin shutdown command.\n\nShutdown for Upgrades\n---------------------\n\nIf you are doing a shutdown to migrate to another major version of MariaDB,\nplease ensure that the innodb_fast_shutdown variable is not 2 (fast crash\nshutdown). The default of this variable is 1.\n\nExample\n-------\n\nThe following example shows how to create an event which turns off the server\nat a certain time:\n\nCREATE EVENT `test`.`shutd`\n ON SCHEDULE\n EVERY 1 DAY\n STARTS \'2014-01-01 20:00:00\'\n COMMENT \'Shutdown Maria when the office is closed\'\nDO BEGIN\n SHUTDOWN;\nEND;\n\nOther Ways to Stop mysqld\n-------------------------\n\nYou can use the mariadb-admin/mysqladmin shutdown command to take down mysqld\ncleanly.\n\nYou can also use the system kill command on Unix with signal SIGTERM (15)\n\nkill -SIGTERM pid-of-mysqld-process\n\nYou can find the process number of the server process in the file that ends\nwith .pid in your data directory.\n\nThe above is identical to mysqladmin shutdown.\n\nOn windows you should use:\n\nNET STOP MySQL\n\nURL: https://mariadb.com/kb/en/shutdown/','','https://mariadb.com/kb/en/shutdown/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,26,'USE','Syntax\n------\n\nUSE db_name\n\nDescription\n-----------\n\nThe \'USE db_name\' statement tells MariaDB to use the db_name database as the\ndefault (current) database for subsequent statements. The database remains the\ndefault until the end of the session or another USE statement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is specifying its name at mysql\ncommand line client startup.\n\nURL: https://mariadb.com/kb/en/use/','','https://mariadb.com/kb/en/use/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,26,'SHOW FUNCTION CODE','Syntax\n------\n\nSHOW FUNCTION CODE func_name\n\nDescription\n-----------\n\nSHOW FUNCTION CODE shows a representation of the internal implementation of\nthe stored function.\n\nIt is similar to SHOW PROCEDURE CODE but for stored functions.\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 (411,26,'SHOW COLLATION','Syntax\n------\n\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe output from SHOW COLLATION includes all available collations. The LIKE\nclause, if present on its own, indicates which collation names to match. The\nWHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema COLLATIONS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncollation at the server, database, table and column levels.\n\nExamples\n--------\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 \'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\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 (412,27,'DELETE','Syntax\n------\n\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| LOW_PRIORITY | Wait until all SELECT\'s are done before |\n| | starting the statement. Used with storage |\n| | engines that uses table locking (MyISAM, Aria |\n| | etc). See HIGH_PRIORITY and LOW_PRIORITY |\n| | clauses for details. |\n+---------------------------+------------------------------------------------+\n| QUICK | Signal the storage engine that it should |\n| | expect that a lot of rows are deleted. The |\n| | storage engine engine can do things to speed |\n| | up the DELETE like ignoring merging of data |\n| | blocks until all rows are deleted from the |\n| | block (instead of when a block is half full). |\n| | This speeds up things at the expanse of lost |\n| | space in data blocks. At least MyISAM and |\n| | Aria support this feature. |\n+---------------------------+------------------------------------------------+\n| IGNORE | Don\'t stop the query even if a not-critical |\n| | error occurs (like data overflow). See How |\n| | IGNORE works for a full description. |\n+---------------------------+------------------------------------------------+\n\nFor the single-table syntax, the DELETE statement deletes rows from tbl_name\nand returns a count of the number of deleted rows. This count can be obtained\nby calling the ROW_COUNT() function. The WHERE clause, if given, specifies the\nconditions that identify which rows to delete. With no WHERE clause, all rows\nare deleted. If the ORDER BY clause is specified, the rows are deleted in the\norder that is specified. The LIMIT clause places a limit on the number of rows\nthat can be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the rows that\nsatisfy the conditions. In this case, ORDER BY and LIMIT> cannot be used. A\nDELETE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\ndeleted. It is specified as described in SELECT.\n\nCurrently, you cannot delete from a table and select from the same table in a\nsubquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You need only\nthe SELECT privilege for any columns that are only read, such as those named\nin the WHERE clause. See GRANT.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A faster\nway to do this, when you do not need to know the number of deleted rows, is to\nuse TRUNCATE TABLE. However, within a transaction or if you have a lock on the\ntable, TRUNCATE TABLE cannot be used whereas DELETE can. See TRUNCATE TABLE,\nand LOCK.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Deletion by Portion.\n\nRETURNING\n---------\n\nIt is possible to return a resultset of the deleted rows for a single table to\nthe client by using the syntax DELETE ... RETURNING select_expr [,\nselect_expr2 ...]]\n\nAny of SQL expression that can be calculated from a single row fields is\nallowed. Subqueries are allowed. The AS keyword is allowed, so it is possible\nto use aliases.\n\nThe use of aggregate functions is not allowed. RETURNING cannot be used in\nmulti-table DELETEs.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nSame Source and Target Table\n----------------------------\n\nUntil MariaDB 10.3.1, deleting from a table with the same source and target\nwas not possible. From MariaDB 10.3.1, this is now possible. For example:\n\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nMariaDB starting with 10.3.4\n----------------------------\n\nDELETE HISTORY\n--------------\n\nOne can use DELETE HISTORY to delete historical information from\nSystem-versioned tables.\n\nExamples\n--------\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| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+\n\nThe following statement joins two tables: one is only used to satisfy a WHERE\ncondition, but no row is deleted from it; rows from the other table are\ndeleted, instead.\n\nDELETE post FROM blog INNER JOIN post WHERE blog.id = post.blog_id;\n\nDeleting from the Same Source and Target\n----------------------------------------\n\nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nUntil MariaDB 10.3.1, this returned:\n\nERROR 1093 (HY000): Table \'t1\' is specified twice, both as a target for\n\'DELETE\' \n and as a separate source for\n\nFrom MariaDB 10.3.1:\n\nQuery OK, 0 rows affected (0.00 sec)\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 (413,27,'REPLACE','Syntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE works exactly like INSERT, except that if an old row in the table has\nthe same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row\nis deleted before the new row is inserted. If the table has more than one\nUNIQUE keys, it is possible 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 or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use REPLACE ... SELECT to copy rows between different databases.\n\nMariaDB starting with 10.5.0\n----------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.0\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=# ;\nENDIF\nINSERT INTO t1 VALUES (...);\nEND;\n\nThe above can be replaced with:\n\nREPLACE INTO t1 VALUES (...)\n\nREPLACE is a MariaDB/MySQL extension to the SQL standard. It either inserts,\nor deletes and inserts. For other MariaDB/MySQL extensions to standard SQL ---\nthat also handle duplicate values --- see IGNORE and INSERT ON DUPLICATE KEY\nUPDATE.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a REPLACE\nstatement makes no sense. It becomes equivalent to INSERT, because there is no\nindex to be used to determine whether a new row duplicates another.\n\nValues for all columns are taken from the values sSee Partition Pruning and\nSelection for details.pecified in the REPLACE statement. Any missing columns\nare set to their default values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row. If you use an\nassignment such as \'SET col = col + 1\', the reference to the column name on\nthe right hand side is treated as DEFAULT(col), so the assignment is\nequivalent to \'SET col = DEFAULT(col) + 1\'.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for the\ntable.\n\nThere are some gotchas you should be aware of, before using REPLACE:\n\n* If there is an AUTO_INCREMENT field, a new value will be generated.\n* If there are foreign keys, ON DELETE action will be activated by REPLACE.\n* Triggers on DELETE and INSERT will be activated by REPLACE.\n\nTo avoid some of these behaviors, you can use INSERT ... ON DUPLICATE KEY\nUPDATE.\n\nThis statement activates INSERT and DELETE triggers. See Trigger Overview for\ndetails.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nREPLACE RETURNING\n-----------------\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in REPLACE...SEL==\nDescription\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in\nREPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the REPLACE table. ECT...RETURNING if the table in the RETURNING\nclause is not the same as the REPLACE table.\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 (414,27,'UPDATE','Syntax\n------\n\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\nFor the single-table syntax, the UPDATE statement updates columns of existing\nrows in the named table with new values. The SET clause indicates which\ncolumns to modify and the values they should be given. Each value can be given\nas an expression, or the keyword DEFAULT to set a column explicitly to its\ndefault value. The WHERE clause, if given, specifies the conditions that\nidentify which rows to update. With no WHERE clause, all rows are updated. If\nthe ORDER BY clause is specified, the rows are updated in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that can be\nupdated.\n\nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE updates rows in\neach table named in table_references that satisfy the conditions. In this\ncase, ORDER BY and LIMIT cannot be used. This restriction was lifted in\nMariaDB 10.3.2 and both clauses can be used with multiple-table updates. An\nUPDATE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\nupdated.\n\ntable_references and where_condition are as specified as described in SELECT.\n\nFor single-table updates, assignments are evaluated in left-to-right order,\nwhile for multi-table updates, there is no guarantee of a particular order. If\nthe SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB 10.3.5) is set,\nUPDATE statements evaluate all assignments simultaneously.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE that\nare actually updated. You need only the SELECT privilege for any columns that\nare read but not modified. See GRANT.\n\nThe UPDATE statement supports the following modifiers:\n\n* If you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading from\n the table. This affects only storage engines that use only table-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and LOW_PRIORITY clauses\nfor details.\n* If you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for which\n duplicate-key conflicts occur are not updated. Rows for which columns are\n updated to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Updating by Portion.\n\nUPDATE Statements With the Same Source and Target\n-------------------------------------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nFrom MariaDB 10.3.2, UPDATE statements may have the same source and target.\n\nFor example, given the following table:\n\nDROP TABLE t1;\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 not 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 for 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| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n\nExample\n-------\n\nSingle-table syntax:\n\nUPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;\n\nMultiple-table syntax:\n\nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE\ntab1.id = tab2.id;\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 (415,27,'IGNORE','The IGNORE option tells the server to ignore some common errors.\n\nIGNORE can be used with the following statements:\n\n* DELETE\n* INSERT (see also INSERT IGNORE)\n* LOAD DATA INFILE\n* UPDATE\n* ALTER TABLE\n* CREATE TABLE ... SELECT\n* INSERT ... SELECT\n\nThe logic used:\n\n* Variables out of ranges are replaced with the maximum/minimum value.\n\n* SQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,\nNO_ZERO_DATE are ignored.\n\n* Inserting NULL in a NOT NULL field will insert 0 ( in a numerical\n field), 0000-00-00 ( in a date field) or an empty string ( in a character\n field).\n\n* Rows that cause a duplicate key error or break a foreign key constraint are\n not inserted, updated, or deleted.\n\nThe following errors are ignored:\n\n+---------------------+---------------------------------+--------------------+\n| Error number | Symbolic error name | Description |\n+---------------------+---------------------------------+--------------------+\n| 1022 | ER_DUP_KEY | Can\'t write; |\n| | | duplicate key in |\n| | | table \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1048 | ER_BAD_NULL_ERROR | Column \'%s\' |\n| | | cannot be null |\n+---------------------+---------------------------------+--------------------+\n| 1062 | ER_DUP_ENTRY | Duplicate entry |\n| | | \'%s\' for key %d |\n+---------------------+---------------------------------+--------------------+\n| 1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns |\n| | | more than 1 row |\n+---------------------+---------------------------------+--------------------+\n| 1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range |\n| | | value for column |\n| | | \'%s\' at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1265 | WARN_DATA_TRUNCATED | Data truncated |\n| | | for column \'%s\' |\n| | | at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1292 | ER_TRUNCATED_WRONG_VALUE | Truncated |\n| | | incorrect %s |\n| | | value: \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FI | Incorrect integer |\n| | LD | value |\n+---------------------+---------------------------------+--------------------+\n| 1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION |\n| | | failed \'%s.%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or |\n| | | update a parent |\n| | | row |\n+---------------------+---------------------------------+--------------------+\n| 1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or |\n| | | update a child |\n| | | row: a foreign |\n| | | key constraint |\n| | | fails (%s) |\n+---------------------+---------------------------------+--------------------+\n| 1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | | partition for |\n| | | value %s |\n+---------------------+---------------------------------+--------------------+\n| 1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry |\n| | | \'%s\' for key \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | SILENT | partition for |\n| | | some existing |\n| | | values |\n+---------------------+---------------------------------+--------------------+\n| 1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PAR | Found a row not |\n| | ITION_SET | matching the |\n| | | given partition |\n| | | set |\n+---------------------+---------------------------------+--------------------+\n\nIgnored errors normally generate a warning.\n\nA property of the IGNORE clause consists in causing transactional engines and\nnon-transactional engines (like XtraDB and Aria) to behave the same way. For\nexample, normally a multi-row insert which tries to violate a UNIQUE contraint\nis completely rolled back on XtraDB/InnoDB, but might be partially executed on\nAria. With the IGNORE clause, the statement will be partially executed in both\nengines.\n\nDuplicate key errors also generate warnings. The OLD_MODE server variable can\nbe used to prevent this.\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 (416,27,'SELECT','Syntax\n------\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], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset [ROWS EXAMINED\nrows_limit] } |\n [OFFSET start { ROW | ROWS }]\n [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }]\n]\n procedure|[PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name] [export_options] |\n INTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ]\n [FOR UPDATE lock_option | LOCK IN SHARE MODE lock_option]\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 ]\nlock_option:\n [WAIT n | NOWAIT | SKIP LOCKED]\n\nDescription\n-----------\n\nSELECT is used to retrieve rows selected from one or more tables, and can\ninclude UNION statements and subqueries.\n\n* Each select_expr expression indicates a column or data that you want to\nretrieve. You\nmust have at least one select expression. See Select Expressions below.\n\n* The FROM clause indicates the table or tables from which to retrieve rows.\nUse either a single table name or a JOIN expression. See JOIN\nfor details. If no table is involved, FROM DUAL can be specified.\n\n* Each table can also be specified as db_name.tabl_name. Each column can also\nbe specified as tbl_name.col_name or even db_name.tbl_name.col_name. This\nallows one to write queries which involve multiple databases. See Identifier\nQualifiers for syntax details.\n\n* The 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 there 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 (summary) functions.\nSee Functions and Operators and Functions and Modifiers for use with GROUP BY\n(aggregate).\n\n* Use the ORDER BY clause to order the results.\n\n* Use the LIMIT clause allows you to restrict the results to only\na certain number of rows, optionally with an offset.\n\n* Use the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in common.\n\nSELECT can also be used to retrieve rows computed without reference to any\ntable.\n\nSelect Expressions\n------------------\n\nA SELECT statement must contain one or more select expressions, separated by\ncommas. Each select expression can be one of the following:\n\n* The name of a column.\n* Any expression using functions and operators.\n* * to select all columns from all tables in the FROM clause.\n* tbl_name.* to select all columns from just the table tbl_name.\n\nWhen specifying a column, you can either use just the column name or qualify\nthe column name with the name of the table using tbl_name.col_name. The\nqualified form is useful if you are joining multiple tables in the FROM\nclause. If you do not qualify the column names when selecting from multiple\ntables, MariaDB will try to find the column in each table. It is an error if\nthat column name exists in multiple tables.\n\nYou can quote column names using backticks. If you are qualifying column names\nwith table names, quote each part separately as `tbl_name`.`col_name`.\n\nIf you use any grouping functions in any of the select expressions, all rows\nin your results will be implicitly grouped, as if you had used GROUP BY NULL.\n\nDISTINCT\n--------\n\nA query may produce some identical rows. By default, all rows are retrieved,\neven when their values are the same. To explicitly specify that you want to\nretrieve identical rows, use the ALL option. If you want duplicates to be\nremoved from the resultset, use the DISTINCT option. DISTINCTROW is a synonym\nfor DISTINCT. See also COUNT DISTINCT and SELECT UNIQUE in Oracle mode.\n\nINTO\n----\n\nThe INTO clause is used to specify that the query results should be written to\na file or variable.\n\n* SELECT INTO OUTFILE - formatting and writing the result to an external file.\n* SELECT INTO DUMPFILE - binary-safe writing of the unformatted results to an\nexternal file.\n* SELECT INTO Variable - selecting and setting variables.\n\nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n\nLIMIT\n-----\n\nRestricts the number of returned rows. See LIMIT and LIMIT ROWS EXAMINED for\ndetails.\n\nLOCK IN SHARE MODE/FOR UPDATE\n-----------------------------\n\nSee LOCK IN SHARE MODE and FOR UPDATE for details on the respective locking\nclauses.\n\nOFFSET ... FETCH\n----------------\n\nMariaDB starting with 10.6\n--------------------------\nSee SELECT ... OFFSET ... FETCH.\n\nORDER BY\n--------\n\nOrder a resultset. See ORDER BY for details.\n\nPARTITION\n---------\n\nSpecifies to the optimizer which partitions are relevant for the query. Other\npartitions will not be read. See Partition Pruning and Selection for details.\n\nPROCEDURE\n---------\n\nPasses the whole result set to a C Procedure. See PROCEDURE and PROCEDURE\nANALYSE (the only built-in procedure not requiring the server to be\nrecompiled).\n\nSKIP LOCKED\n-----------\n\nMariaDB starting with 10.6\n--------------------------\nThe SKIP LOCKED clause was introduced in MariaDB 10.6.0.\n\nThis causes those rows that couldn\'t be locked (LOCK IN SHARE MODE or FOR\nUPDATE) to be excluded from the result set. An explicit NOWAIT is implied\nhere. This is only implemented on InnoDB tables and ignored otherwise.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nWhen SQL_CALC_FOUND_ROWS is used, then MariaDB will calculate how many rows\nwould have been in the result, if there would be no LIMIT clause. The result\ncan be found by calling the function FOUND_ROWS() in your next sql statement.\n\nmax_statement_time clause\n-------------------------\n\nBy using max_statement_time in conjunction with SET STATEMENT, it is possible\nto limit the execution time of individual queries. For example:\n\nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nExamples\n--------\n\nSELECT f1,f2 FROM t1 WHERE (f3<=10) AND (f4=\'y\');\n\nSee Getting Data from MariaDB (Beginner tutorial), or the various\nsub-articles, for more examples.\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 (417,27,'JOIN Syntax','Description\n-----------\n\nMariaDB supports the following JOIN syntaxes for the table_references part of\nSELECT statements and multiple-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] [index_hint_list]\n | table_subquery [query_system_time_period_specification] [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 [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\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 allows to write\nqueries which involve multiple databases. See Identifier Qualifiers for syntax\ndetails.\n\nThe syntax of table_factor is extended in comparison with the SQL Standard.\nThe latter accepts only table_reference, not a list of them inside a pair of\nparentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MariaDB, CROSS JOIN is a syntactic equivalent to INNER JOIN (they can\nreplace each other). In standard SQL, they are not equivalent. INNER JOIN is\nused with an ON clause, CROSS JOIN is used otherwise.\n\nIn general, parentheses can be ignored in join expressions containing only\ninner join operations. MariaDB also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n\nSee System-versioned tables for more information about FOR SYSTEM_TIME syntax.\n\nIndex hints can be specified to affect how the MariaDB optimizer makes use of\nindexes. For more information, see How to force query plans.\n\nExamples\n--------\n\nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n\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 (418,27,'Scalar Subqueries','A scalar subquery is a subquery that returns a single value. This is the\nsimplest form of a subquery, and can be used in most places a literal or\nsingle column value is valid.\n\nThe data type, length and character set and collation are all taken from the\nresult returned by the subquery. The result of a subquery can always be NULL,\nthat is, no result returned. Even if the original value is defined as NOT\nNULL, this is disregarded.\n\nA subquery cannot be used where only a literal is expected, for example LOAD\nDATA INFILE expects a literal string containing the file name, and LIMIT\nrequires a literal integer.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num TINYINT);\n\nINSERT INTO sq1 VALUES (1);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n+------+\n\nInserting a second row means the subquery is no longer a scalar, and this\nparticular query is not valid:\n\nINSERT INTO sq1 VALUES (2);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\nERROR 1242 (21000): Subquery returns more than 1 row\n\nNo rows in the subquery, so the scalar is NULL:\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq3 WHERE num=\'3\'));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n| NULL |\n+------+\n\nA more traditional scalar subquery, as part of a WHERE clause:\n\nSELECT * FROM sq1 WHERE num = (SELECT MAX(num)/10 FROM sq2); \n+------+\n| num |\n+------+\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-scalar-subqueries/','','https://mariadb.com/kb/en/subqueries-scalar-subqueries/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'Row Subqueries','A row subquery is a subquery returning a single row, as opposed to a scalar\nsubquery, which returns a single column from a row, or a literal.\n\nExamples\n--------\n\nCREATE TABLE staff (name VARCHAR(10), age TINYINT);\n\nCREATE TABLE customer (name VARCHAR(10), age TINYINT);\n\nINSERT INTO staff VALUES (\'Bilhah\',37), (\'Valerius\',61), (\'Maia\',25);\n\nINSERT INTO customer VALUES (\'Thanasis\',48), (\'Valerius\',61), (\'Brion\',51);\n\nSELECT * FROM staff WHERE (name,age) = (SELECT name,age FROM customer WHERE\nname=\'Valerius\');\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nFinding all rows in one table also in another:\n\nSELECT name,age FROM staff WHERE (name,age) IN (SELECT name,age FROM customer);\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nURL: https://mariadb.com/kb/en/subqueries-row-subqueries/','','https://mariadb.com/kb/en/subqueries-row-subqueries/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'Subqueries and ALL','Subqueries using the ALL keyword will return true if the comparison returns\ntrue for each row returned by the subquery, or the subquery returns no rows.\n\nSyntax\n------\n\nscalar_expression comparison_operator ALL <Table subquery>\n\n* scalar_expression may be any expression that evaluates to a single\nvalue\n* comparison_operator may be any one of: =, >, <, >=, <=, <> or !=\n\nALL returns:\n\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery or scalar_expression returns NULL.\n* FALSE if the comparison operator returns FALSE for at least one row returned\nby the Table subquery.\n* TRUE if the comparison operator returns TRUE for all rows returned by the\nTable subquery, or if Table subquery returns no rows.\n\nNOT IN is an alias for <> ALL.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSince 100 > all of 40,50 and 60, the evaluation is true and the row is returned\n\nAdding a second row to sq1, where the evaluation for that record is false:\n\nINSERT INTO sq1 VALUES(30);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nAdding a new row to sq2, causing all evaluations to be false:\n\nINSERT INTO sq2 VALUES(120);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nWhen the subquery returns no results, the evaluation is still true:\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2 WHERE num2 > 300);\n+------+\n| num |\n+------+\n| 100 |\n| 30 |\n+------+\n\nEvaluating against a NULL will cause the result to be unknown, or not true,\nand therefore return no rows:\n\nINSERT INTO sq2 VALUES (NULL);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n\nURL: https://mariadb.com/kb/en/subqueries-and-all/','','https://mariadb.com/kb/en/subqueries-and-all/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'Subqueries and ANY','Subqueries using the ANY keyword will return true if the comparison returns\ntrue for at least one row returned by the subquery.\n\nSyntax\n------\n\nThe required syntax for an ANY or SOME quantified comparison is:\n\nscalar_expression comparison_operator ANY <Table subquery>\n\nOr:\n\nscalar_expression comparison_operator SOME <Table subquery>\n\n* scalar_expression may be any expression that evaluates to a\nsingle value.\n* comparison_operator may be any one of =, >, <, >=, <=, <> or !=.\n\nANY returns:\n\n* TRUE if the comparison operator returns TRUE for at least one row returned\nby the Table subquery.\n* FALSE if the comparison operator returns FALSE for all rows returned by the\nTable subquery, or Table subquery has zero rows.\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery and doesn\'t returns TRUE for any of them, or if\nscalar_expression returns NULL.\n\nSOME is a synmonym for ANY, and IN is a synonym for = ANY\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(120);\n\nSELECT * FROM sq1 WHERE num > ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\n100 is greater than two of the three values, and so the expression evaluates\nas true.\n\nSOME is a synonym for ANY:\n\nSELECT * FROM sq1 WHERE num < SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nIN is a synonym for = ANY, and here there are no matches, so no results are\nreturned:\n\nSELECT * FROM sq1 WHERE num IN (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nINSERT INTO sq2 VALUES(100);\nQuery OK, 1 row affected (0.05 sec)\n\nSELECT * FROM sq1 WHERE num <> ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nReading this query, the results may be counter-intuitive. It may seem to read\nas \"SELECT * FROM sq1 WHERE num does not match any results in sq2. Since it\ndoes match 100, it could seem that the results are incorrect. However, the\nquery returns a result if the match does not match any of sq2. Since 100\nalready does not match 40, the expression evaluates to true immediately,\nregardless of the 100\'s matching. It may be more easily readable to use SOME\nin a case such as this:\n\nSELECT * FROM sq1 WHERE num <> SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-and-any/','','https://mariadb.com/kb/en/subqueries-and-any/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'Subqueries and EXISTS','Syntax\n------\n\nSELECT ... WHERE EXISTS <Table subquery>\n\nDescription\n-----------\n\nSubqueries using the EXISTS keyword will return true if the subquery returns\nany rows. Conversely, subqueries using NOT EXISTS will return true only if the\nsubquery returns no rows from the table.\n\nEXISTS subqueries ignore the columns specified by the SELECT of the subquery,\nsince they\'re not relevant. For example,\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT * FROM t2);\n\nand\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT col2 FROM t2);\n\nproduce identical results.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE EXISTS (SELECT * FROM sq2 WHERE num2>50);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSELECT * FROM sq1 WHERE NOT EXISTS (SELECT * FROM sq2 GROUP BY num2 HAVING\nMIN(num2)=40);\nEmpty set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/subqueries-and-exists/','','https://mariadb.com/kb/en/subqueries-and-exists/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'Subqueries in a FROM Clause','Although subqueries are more commonly placed in a WHERE clause, they can also\nform part of the FROM clause. Such subqueries are commonly called derived\ntables.\n\nIf a subquery is used in this way, you must also use an AS clause to name the\nresult of the subquery.\n\nORACLE mode\n-----------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, anonymous subqueries in a FROM clause (no AS clause) are\npermitted in ORACLE mode.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\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\nAssume that, given the data above, you want to return the average total for\nall students. In other words, the average of Chun\'s 148 (75+73), Esben\'s 74\n(43+31), etc.\n\nYou cannot do the following:\n\nSELECT AVG(SUM(score)) FROM student GROUP BY name;\nERROR 1111 (HY000): Invalid use of group function\n\nA subquery in the FROM clause is however permitted:\n\nSELECT AVG(sq_sum) FROM (SELECT SUM(score) AS sq_sum FROM student GROUP BY\nname) AS t;\n+-------------+\n| AVG(sq_sum) |\n+-------------+\n| 134.0000 |\n+-------------+\n\nFrom MariaDB 10.6 in ORACLE mode, the following is permitted:\n\nSELECT * FROM (SELECT 1 FROM DUAL), (SELECT 2 FROM DUAL);\n\nURL: https://mariadb.com/kb/en/subqueries-in-a-from-clause/','','https://mariadb.com/kb/en/subqueries-in-a-from-clause/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'Subqueries and JOINs','A subquery can quite often, but not in all cases, be rewritten as a JOIN.\n\nRewriting Subqueries as JOINS\n-----------------------------\n\nA subquery using IN can be rewritten with the DISTINCT keyword, for example:\n\nSELECT * FROM table1 WHERE col1 IN (SELECT col1 FROM table2);\n\ncan be rewritten as:\n\nSELECT DISTINCT table1.* FROM table1, table2 WHERE table1.col1=table2.col1;\n\nNOT IN or NOT EXISTS queries can also be rewritten. For example, these two\nqueries returns the same result:\n\nSELECT * FROM table1 WHERE col1 NOT IN (SELECT col1 FROM table2);\nSELECT * FROM table1 WHERE NOT EXISTS (SELECT col1 FROM table2 WHERE\ntable1.col1=table2.col1);\n\nand both can be rewritten as:\n\nSELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE\ntable2.id IS NULL;\n\nSubqueries that can be rewritten as a LEFT JOIN are sometimes more efficient.\n\nUsing Subqueries instead of JOINS\n---------------------------------\n\nThere are some scenarios, though, which call for subqueries rather than joins:\n\n* When you want duplicates, but not false duplicates. Suppose Table_1\n has three rows — {1,1,2}\n — and Table_2 has two rows\n — {1,2,2}. If you need to list the rows\n in Table_1 which are also in Table_2, only this\n subquery-based SELECT statement will give the right answer\n (1,1,2):\n\nSELECT Table_1.column_1 \nFROM Table_1 \nWHERE Table_1.column_1 IN \n (SELECT Table_2.column_1\n FROM Table_2);\n\n* This SQL statement won\'t work:\n\nSELECT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,1,2,2}\n — and the duplication of 2 is an error. This SQL\n statement won\'t work either:\n\nSELECT DISTINCT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,2} — and\n the removal of the duplicated 1 is an error too.\n\n* When the outermost statement is not a query. The SQL statement:\n\nUPDATE Table_1 SET column_1 = (SELECT column_1 FROM Table_2);\n\n* can\'t be expressed using a join unless some rare SQL3 features are used.\n\n* When the join is over an expression. The SQL statement:\n\nSELECT * FROM Table_1 \nWHERE column_1 + 5 =\n (SELECT MAX(column_1) FROM Table_2);\n\n* is hard to express with a join. In fact, the only way we can think of is\n this SQL statement:\n\nSELECT Table_1.*\nFROM Table_1, \n (SELECT MAX(column_1) AS max_column_1 FROM Table_2) AS Table_2\nWHERE Table_1.column_1 + 5 = Table_2.max_column_1;\n\n* which still involves a parenthesized query, so nothing is gained from the\n transformation.\n\n* When you want to see the exception. For example, suppose the question is:\n what books are longer than Das Kapital? These two queries are effectively\n almost the same:\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 JOIN Books AS Bookcolumn_2 USING(page_count) \nWHERE title = \'Das Kapital\';\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 \nWHERE Bookcolumn_1.page_count > \n (SELECT DISTINCT page_count\n FROM Books AS Bookcolumn_2\n WHERE title = \'Das Kapital\');\n\n* The difference is between these two SQL statements is, if there are two\n editions of Das Kapital (with different page counts), then the self-join\n example will return the books which are longer than the shortest edition\n of Das Kapital. That might be the wrong answer, since the original\n question didn\'t ask for \"... longer than ANY book named Das Kapital\"\n (it seems to contain a false assumption that there\'s only one edition).\n\nURL: https://mariadb.com/kb/en/subqueries-and-joins/','','https://mariadb.com/kb/en/subqueries-and-joins/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'Subquery Limitations','There are a number of limitations regarding subqueries, which are discussed\nbelow. The following tables and data will be used in the examples that follow:\n\nCREATE TABLE staff(name VARCHAR(10),age TINYINT);\n\nCREATE TABLE customer(name VARCHAR(10),age TINYINT);\n\nINSERT INTO staff VALUES \n(\'Bilhah\',37), (\'Valerius\',61), (\'Maia\',25);\n\nINSERT INTO customer VALUES \n(\'Thanasis\',48), (\'Valerius\',61), (\'Brion\',51);\n\nORDER BY and LIMIT\n------------------\n\nTo use ORDER BY or limit LIMIT in subqueries both must be used.. For example:\n\nSELECT * FROM staff WHERE name IN (SELECT name FROM customer ORDER BY name);\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nis valid, but\n\nSELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name\nLIMIT 1);\nERROR 1235 (42000): This version of MariaDB doesn\'t \n yet support \'LIMIT & IN/ALL/ANY/SOME subquery\'\n\nis not.\n\nModifying and Selecting from the Same Table\n-------------------------------------------\n\nIt\'s not possible to both modify and select from the same table in a subquery.\nFor example:\n\nDELETE FROM staff WHERE name = (SELECT name FROM staff WHERE age=61);\nERROR 1093 (HY000): Table \'staff\' is specified twice, both \n as a target for \'DELETE\' and as a separate source for data\n\nRow Comparison Operations\n-------------------------\n\nThere is only partial support for row comparison operations. The expression in\n\nexpr op {ALL|ANY|SOME} subquery,\n\nmust be scalar and the subquery can only return a single column.\n\nHowever, because of the way IN is implemented (it is rewritten as a sequence\nof = comparisons and AND), the expression in\n\nexpression [NOT] IN subquery\n\nis permitted to be an n-tuple and the subquery can return rows of n-tuples.\n\nFor example:\n\nSELECT * FROM staff WHERE (name,age) NOT IN (\n SELECT name,age FROM customer WHERE age >=51]\n);\n+--------+------+\n| name | age |\n+--------+------+\n| Bilhah | 37 |\n| Maia | 25 |\n+--------+------+\n\nis permitted, but\n\nSELECT * FROM staff WHERE (name,age) = ALL (\n SELECT name,age FROM customer WHERE age >=51\n);\nERROR 1241 (21000): Operand should contain 1 column(s)\n\nis not.\n\nCorrelated Subqueries\n---------------------\n\nSubqueries in the FROM clause cannot be correlated subqueries. They cannot be\nevaluated for each row of the outer query since they are evaluated to produce\na result set during when the query is executed.\n\nStored Functions\n----------------\n\nA subquery can refer to a stored function which modifies data. This is an\nextension to the SQL standard, but can result in indeterminate outcomes. For\nexample, take:\n\nSELECT ... WHERE x IN (SELECT f() ...);\n\nwhere f() inserts rows. The function f() could be executed a different number\nof times depending on how the optimizer chooses to handle the query.\n\nThis sort of construct is therefore not safe to use in replication that is not\nrow-based, as there could be different results on the master and the slave.\n\nURL: https://mariadb.com/kb/en/subquery-limitations/','','https://mariadb.com/kb/en/subquery-limitations/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'UNION','UNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nSyntax\n------\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-----------\n\nUNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nThe column names from the first SELECT statement are used as the column names\nfor the results returned. Selected columns listed in corresponding positions\nof each SELECT statement should have the same data type. (For example, the\nfirst column selected by the first statement should have the same type as the\nfirst column selected by the other statements.)\n\nIf they don\'t, the type and length of the columns in the result take into\naccount the values returned by all of the SELECTs, so there is no need for\nexplicit casting. Note that currently this is not the case for recursive CTEs\n- see MDEV-12325.\n\nTable names can be specified as db_name.tbl_name. This permits writing UNIONs\nwhich involve multiple databases. See Identifier Qualifiers for syntax details.\n\nUNION queries cannot be used with aggregate functions.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nALL/DISTINCT\n------------\n\nThe ALL keyword causes duplicate rows to be preserved. The DISTINCT keyword\n(the default if the keyword is omitted) causes duplicate rows to be removed by\nthe results.\n\nUNION ALL and UNION DISTINCT can both be present in a query. In this case,\nUNION DISTINCT will override any UNION ALLs to its left.\n\nMariaDB starting with 10.1.1\n----------------------------\nUntil MariaDB 10.1.1, all UNION ALL statements required the server to create a\ntemporary table. Since MariaDB 10.1.1, the server can in most cases execute\nUNION ALL without creating a temporary table, improving performance (see\nMDEV-334).\n\nORDER BY and LIMIT\n------------------\n\nIndividual SELECTs can contain their own ORDER BY and LIMIT clauses. In this\ncase, the individual queries need to be wrapped between parentheses. However,\nthis does not affect the order of the UNION, so they only are useful to limit\nthe record read by one SELECT.\n\nThe UNION can have global ORDER BY and LIMIT clauses, which affect the whole\nresultset. If the columns retrieved by individual SELECT statements have an\nalias (AS), the ORDER BY must use that alias, not the real column names.\n\nHIGH_PRIORITY\n-------------\n\nSpecifying a query as HIGH_PRIORITY will not work inside a UNION. If applied\nto the first SELECT, it will be ignored. Applying to a later SELECT results in\na syntax error:\n\nERROR 1234 (42000): Incorrect usage/placement of \'HIGH_PRIORITY\'\n\nSELECT ... INTO ...\n-------------------\n\nIndividual SELECTs cannot be written INTO DUMPFILE or INTO OUTFILE. If the\nlast SELECT statement specifies INTO DUMPFILE or INTO OUTFILE, the entire\nresult of the UNION will 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 also be used.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nExamples\n--------\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 rows:\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 email)\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 use of a sort\ncolumn:\n\n(SELECT 1 AS sort_column, e_name AS name, email FROM employees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY sort_column;\n\nDifference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 (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 (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\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 (427,27,'EXCEPT','MariaDB starting with 10.3.0\n----------------------------\nEXCEPT was introduced in MariaDB 10.3.0.\n\nThe result of EXCEPT is all records of the left SELECT result set except\nrecords which are in right SELECT result set, i.e. it is subtraction of two\nresult sets. From MariaDB 10.6.1, MINUS is a synonym.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nPlease note:\n\n* Brackets for explicit operation precedence are not supported; use a subquery\nin the FROM clause as a workaround).\n\nDescription\n-----------\n\nMariaDB has supported EXCEPT and INTERSECT in addition to UNION since MariaDB\n10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nEXCEPT implicitly supposes a DISTINCT operation.\n\nThe result of EXCEPT is all records of the left SELECT result except records\nwhich are in right SELECT result set, i.e. it is subtraction of two result\nsets.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nEXCEPT ALL and EXCEPT DISTINCT were introduced in MariaDB 10.5.0. The ALL\noperator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\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. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 c 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 c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\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 (428,27,'INTERSECT','MariaDB starting with 10.3.0\n----------------------------\nINTERSECT was introduced in MariaDB 10.3.0.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nMariaDB has supported INTERSECT (as well as EXCEPT) in addition to UNION since\nMariaDB 10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nINTERSECT implicitly supposes a DISTINCT operation.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nINTERSECT has higher precedence than UNION and EXCEPT (unless running running\nin Oracle mode, in which case all three have the same precedence). If possible\nit will be executed linearly but if not it will be translated to a subquery in\nthe 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\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nINTERSECT ALL and INTERSECT DISTINCT were introduced in MariaDB 10.5.0. The\nALL operator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\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. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 (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 (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\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 (429,27,'Precedence Control in Table Operations','MariaDB starting with 10.4.0\n----------------------------\nBeginning in MariaDB 10.4, you can control the ordering of execution on table\noperations using parentheses.\n\nSyntax\n------\n\n( expression )\n[ORDER BY [column[, column...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUsing parentheses in your SQL allows you to control the order of execution for\nSELECT statements and Table Value Constructor, including UNION, EXCEPT, and\nINTERSECT operations. MariaDB executes the parenthetical expression before the\nrest of the statement. You can then use ORDER BY and LIMIT clauses the further\norganize the result-set.\n\nNote: In practice, the Optimizer may rearrange the exact order in which\nMariaDB executes different parts of the statement. When it calculates the\nresult-set, however, it returns values as though the parenthetical expression\nwere executed first.\n\nExample\n-------\n\nCREATE TABLE test.t1 (num INT);\n\nINSERT INTO test.t1 VALUES (1),(2),(3);\n\n(SELECT * FROM test.t1 \n UNION \n VALUES (10)) \nINTERSECT \nVALUES (1),(3),(10),(11);\n+------+\n| num |\n+------+\n| 1 |\n| 3 |\n| 10 |\n+------+\n\n((SELECT * FROM test.t1 \n UNION\n VALUES (10))\n INTERSECT \n VALUES (1),(3),(10),(11)) \nORDER BY 1 DESC;\n+------+\n| num |\n+------+\n| 10 |\n| 3 |\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/precedence-control-in-table-operations/','','https://mariadb.com/kb/en/precedence-control-in-table-operations/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,27,'LIMIT','Description\n-----------\n\nUse the LIMIT clause to restrict the number of returned rows. When you use a\nsingle integer n with LIMIT, the first n rows will be returned. Use the ORDER\nBY clause to control which rows come first. You can also select a number of\nrows after an offset using 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 rows will be ignored,\nand the following n rows will be returned.\n\nExecuting an UPDATE with the LIMIT clause is not safe for replication. LIMIT 0\nis an exception to this rule (see MDEV-6170).\n\nThere is a LIMIT ROWS EXAMINED optimization which provides the means to\nterminate the execution of SELECT statements which examine too many rows, and\nthus use too many resources. See LIMIT ROWS EXAMINED.\n\nMulti-Table Updates\n-------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or ORDER BY) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nGROUP_CONCAT\n------------\n\nMariaDB starting with 10.3.2\n----------------------------\nStarting from MariaDB 10.3.3, it is possible to use LIMIT with GROUP_CONCAT().\n\nExamples\n--------\n\nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members VALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n\nSELECT * FROM members;\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| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n\nAll the names in alphabetical order:\n\nSELECT * FROM members ORDER BY name;\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| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n\nThe third name, ordered alphabetically (the first name would be offset zero,\nso the third is offset two):\n\nSELECT * FROM members ORDER BY name LIMIT 2,1;\n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n\nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (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, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\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| 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, so, for example,\ngiven 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) ORDER BY cc\nDESC),\",\",1) FROM d;\n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY 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 LIMIT 1) FROM d;\n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\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 (431,27,'ORDER BY','Description\n-----------\n\nUse the ORDER BY clause to order a resultset, such as that are returned from a\nSELECT statement. You can specify just a column or use any expression with\nfunctions. If you are using the GROUP BY clause, you can use grouping\nfunctions in ORDER BY. Ordering is done after grouping.\n\nYou can use multiple ordering expressions, separated by commas. Rows will be\nsorted by the first expression, then by the second expression if they have the\nsame value for the first, and so on.\n\nYou can use the keywords ASC and DESC after each ordering expression to force\nthat ordering to be ascending or descending, respectively. Ordering is\nascending by default.\n\nYou can also use a single integer as the ordering expression. If you use an\ninteger n, the results will be ordered by the nth column in the select\nexpression.\n\nWhen string values are compared, they are compared as if by the STRCMP\nfunction. STRCMP ignores trailing whitespace and may normalize characters and\nignore case, depending on the collation in use.\n\nDuplicated entries in the ORDER BY clause are removed.\n\nORDER BY can also be used to order the activities of a DELETE or UPDATE\nstatement (usually with the LIMIT clause).\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use ORDER BY (or LIMIT) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nMariaDB starting with 10.5\n--------------------------\nFrom MariaDB 10.5, MariaDB allows packed sort keys and values of non-sorted\nfields in the sort buffer. This can make filesort temporary files much smaller\nwhen VARCHAR, CHAR or BLOBs are used, notably speeding up some ORDER BY sorts.\n\nExamples\n--------\n\nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'), (4,\'f\'), (5,\'e\');\n\nSELECT * FROM seq ORDER BY i;\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| 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| 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 1;\n\nSELECT * FROM seq;\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 update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (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, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\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| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\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 (432,27,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows together that have\nthe same value in one or more column, or the same computed value using\nexpressions with any functions and operators except grouping functions. When\nyou use a GROUP BY clause, you will get a single result row for each group of\nrows that have the same value for the expression given in GROUP BY.\n\nWhen grouping rows, grouping values are compared as if by the = operator. For\nstring values, the = operator ignores trailing whitespace and may normalize\ncharacters and ignore case, depending on the collation in use.\n\nYou can use any of the grouping functions in your select expression. Their\nvalues will be calculated based on all the rows that have been grouped\ntogether for each result row. If you select a non-grouped column or a value\ncomputed from a non-grouped column, it is undefined which row the returned\nvalue is taken from. This is not permitted if the ONLY_FULL_GROUP_BY SQL_MODE\nis used.\n\nYou can use multiple expressions in the GROUP BY clause, separated by commas.\nRows are grouped together if they match on each of the expressions.\n\nYou can also use a single integer as the grouping expression. If you use an\ninteger n, the results will be grouped by the nth column in the select\nexpression.\n\nThe WHERE clause is applied before the GROUP BY clause. It filters\nnon-aggregated rows before the rows are grouped together. To filter grouped\nrows based on aggregate values, use the HAVING clause. The HAVING clause takes\nany expression and evaluates it as a boolean, just like the WHERE clause. You\ncan use grouping functions in the HAVING clause. As with the select\nexpression, if you reference non-grouped columns in the HAVING clause, the\nbehavior is undefined.\n\nBy default, if a GROUP BY clause is present, the rows in the output will be\nsorted by the expressions used in the GROUP BY. You can also specify ASC or\nDESC (ascending, descending) after those expressions, like in ORDER BY. The\ndefault is ASC.\n\nIf you want the rows to be sorted by another field, you can add an explicit\nORDER BY. If you don\'t want the result to be ordered, you can add ORDER BY\nNULL.\n\nWITH ROLLUP\n-----------\n\nThe WITH ROLLUP modifer adds extra rows to the resultset that represent\nsuper-aggregate summaries. For a full description with examples, see SELECT\nWITH ROLLUP.\n\nGROUP BY Examples\n-----------------\n\nConsider the following table that records how many times each user has played\nand 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| 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 refer back to an\nidentifer specified with AS. Get a list of win averages along with a count:\n\nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP BY winavg;\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 in the select expression. For each win\naverage as above, get a list of the average play count taken to get that\naverage:\n\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\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 clause. The HAVING\nclause is applied after GROUP BY and allows you to filter on aggregate data\nthat is not available to the WHERE clause. Restrict the above example to\nresults that involve an 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| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\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 (433,27,'WITH','MariaDB starting with 10.2.1\n----------------------------\nCommon Table Expressions were introduced in MariaDB 10.2.1.\n\nSyntax\n------\n\nWITH [RECURSIVE] table_reference [(columns_list)] AS (\n SELECT ...\n)\n[CYCLE cycle_column_list RESTRICT]\nSELECT ...\n\nDescription\n-----------\n\nThe WITH keyword signifies a Common Table Expression (CTE). It allows you to\nrefer to a subquery expression many times in a query, as if having a temporary\ntable that only exists for the duration of a query.\n\nThere are two kinds of CTEs:\n\n* Non-Recursive\n* Recursive (signified by the RECURSIVE keyword, supported since MariaDB\n10.2.2)\n\nYou can use table_reference as any normal table in the external SELECT part.\nYou can also use WITH in subqueries, as well as with EXPLAIN and SELECT.\n\nPoorly-formed recursive CTEs can in theory cause infinite loops. The\nmax_recursive_iterations system variable limits the number of recursions.\n\nCYCLE ... RESTRICT\n------------------\n\nMariaDB starting with 10.5.2\n----------------------------\nThe CYCLE clause enables CTE cycle detection, avoiding excessive or infinite\nloops, MariaDB supports a relaxed, non-standard grammar.\n\nThe SQL Standard permits a CYCLE clause, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE <cycle column list>\nSET <cycle mark column> TO <cycle mark value> DEFAULT <non-cycle mark value>\nUSING <path column>\n\nwhere all clauses are mandatory.\n\nMariaDB does not support this, but from 10.5.2 permits a non-standard relaxed\ngrammar, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE <cycle column list> RESTRICT\n\nWith the use of CYCLE ... RESTRICT it makes no difference whether the CTE uses\nUNION ALL or UNION DISTINCT anymore. UNION ALL means \"all rows, but without\ncycles\", which is exactly what the CYCLE clause enables. And UNION DISTINCT\nmeans all rows should be different, which, again, is what will happen — as\nuniqueness is enforced over a subset of columns, complete rows will\nautomatically all be different.\n\nExamples\n--------\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 < 5)\n SELECT t2.c FROM t2, t WHERE t2.c = t.a);\n\nBelow is an example of a Recursive CTE:\n\nWITH RECURSIVE ancestors AS \n ( SELECT * FROM folks\n WHERE name=\"Alex\"\n UNION\n SELECT f.*\n FROM folks AS f, ancestors AS a\n WHERE f.id = a.father OR f.id = a.mother )\nSELECT * FROM ancestors;\n\nTake the following structure, and data,\n\nCREATE TABLE t1 (from_ int, to_ int);\nINSERT INTO t1 VALUES (1,2), (1,100), (2,3), (3,4), (4,1);\nSELECT * FROM t1;\n+-------+------+\n| from_ | to_ |\n+-------+------+\n| 1 | 2 |\n| 1 | 100 |\n| 2 | 3 |\n| 3 | 4 |\n| 4 | 1 |\n+-------+------+\n\nGiven the above, the following query would theoretically result in an infinite\nloop due to the last record in t1 (note that max_recursive_iterations is set\nto 10 for the purposes of this example, to avoid the excessive number of\ncycles):\n\nSET max_recursive_iterations=10;\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION DISTINCT SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n| 5 | 1 | 2 |\n| 5 | 1 | 100 |\n| 6 | 2 | 3 |\n| 7 | 3 | 4 |\n| 8 | 4 | 1 |\n| 9 | 1 | 2 |\n| 9 | 1 | 100 |\n| 10 | 2 | 3 |\n+-------+-------+------+\n\nHowever, the CYCLE ... RESTRICT clause (from MariaDB 10.5.2) can overcome this:\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nCYCLE from_, to_ RESTRICT \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n+-------+-------+------+\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 (434,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. There are two kinds of CTEs:\nNon-Recursive, which this article covers; and Recursive.\n\nMariaDB starting with 10.2.1\n----------------------------\nCommon table expressions were introduced in MariaDB 10.2.1.\n\nNon-Recursive CTEs\n------------------\n\nThe WITH keyword signifies a CTE. It is given a name, followed by a body (the\nmain 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 are several\nadvantages and caveats to them. The syntax is more readable than nested FROM\n(SELECT ...). A CTE can refer to another and it can be referenced from\nmultiple places.\n\nA CTE referencing Another CTE\n-----------------------------\n\nUsing this format makes for a more readable SQL than a nested FROM(SELECT ...)\nclause. 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 IN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n\nMultiple Uses of a CTE\n----------------------\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. Below is an example\nof 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\nURL: https://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 (435,27,'Recursive Common Table Expressions Overview','MariaDB starting with 10.2.2\n----------------------------\nRecursive Common Table Expressions have been supported since MariaDB 10.2.2.\n\nCommon Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. CTEs first appeared in the SQL\nstandard in 1999, and the first implementations began appearing in 2007.\n\nThere are two kinds of CTEs:\n\n* Non-recursive\n* Recursive, which this article covers.\n\nSQL is generally poor at recursive structures.\n\nCTEs permit a query to reference itself. A recursive CTE will repeatedly\nexecute subsets of the data until it obtains the complete result set. This\nmakes it particularly useful for handing hierarchical or tree-structured data.\nmax_recursive_iterations avoids infinite loops.\n\nSyntax example\n--------------\n\nWITH RECURSIVE signifies a recursive CTE. It is given a name, followed by a\nbody (the main query) as follows:\n\nComputation\n-----------\n\nGiven the following structure:\n\nFirst execute the anchor part of the query:\n\nNext, execute the recursive part of the query:\n\nSummary so far\n--------------\n\nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\n\n* Compute anchor_data\n* Compute recursive_part to get the new data\n* if (new data is non-empty) goto 2;\n\nCAST to avoid truncating data\n-----------------------------\n\nAs currently implemented by MariaDB and by the SQL Standard, data may be\ntruncated if not correctly cast. It is necessary to CAST the column to the\ncorrect width if the CTE\'s recursive part produces wider values for a column\nthan the CTE\'s nonrecursive part. Some other DBMS give an error in this\nsituation, and MariaDB\'s behavior may change in future - see MDEV-12325. See\nthe examples below.\n\nExamples\n--------\n\nTransitive closure - determining bus destinations\n-------------------------------------------------\n\nSample data:\n\nCREATE TABLE bus_routes (origin varchar(50), dst varchar(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 the origin:\n\nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New York\'\n UNION\n SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst=\nbus_routes.origin \n) \nSELECT * FROM bus_dst;\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:\n\n* Starting from New York\n* Boston and Washington are added\n\nNext, the recursive part:\n\n* Starting from Boston and then Washington\n* Raleigh is added\n* UNION excludes nodes that are already present.\n\nComputing paths - determining bus routes\n----------------------------------------\n\nThis time, we are trying to get bus routes such as \"New York -> Washington ->\nRaleigh\".\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 York\'\n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst), bus_routes.dst\n FROM paths\n JOIN bus_routes\n ON paths.cur_dest = bus_routes.origin AND\n NOT FIND_IN_SET(bus_routes.dst, paths.cur_path)\n) \nSELECT * FROM paths;\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-----------------------------\n\nIn the following example, data is truncated because the results are not\nspecifically 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)\nSELECT col FROM tbl\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| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n\nURL: https://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 (436,27,'SELECT WITH ROLLUP','Syntax\n------\n\nSee SELECT for the full syntax.\n\nDescription\n-----------\n\nThe WITH ROLLUP modifier adds extra rows to the resultset that represent\nsuper-aggregate summaries. The super-aggregated column is represented by a\nNULL value. Multiple aggregates over different columns will be added if there\nare multiple GROUP BY columns.\n\nThe LIMIT clause can be used at the same time, and is applied after the WITH\nROLLUP rows have been added.\n\nWITH ROLLUP cannot be used with ORDER BY. Some sorting is still possible by\nusing ASC or DESC clauses with the GROUP BY column, although the\nsuper-aggregate rows will always be added last.\n\nExamples\n--------\n\nThese examples use the following sample table\n\nCREATE TABLE booksales ( \n country VARCHAR(35), genre ENUM(\'fiction\',\'non-fiction\'), year YEAR, sales\nINT);\n\nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234), (\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980), (\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970), (\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760), (\'Paraguay\',\'non-fiction\',2015,9030);\n\nThe addition of the WITH ROLLUP modifier in this example adds an extra row\nthat aggregates both years:\n\nSELECT year, SUM(sales) FROM booksales GROUP BY year;\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 ROLLUP;\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 the country change,\nanother super-aggregate row is added:\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\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| 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 LIMIT 4;\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 ROLLUP;\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\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 (437,27,'SELECT INTO OUTFILE','Syntax\n------\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-----------\n\nSELECT INTO OUTFILE writes the resulting rows to a file, and allows the use of\ncolumn and row terminators to specify a particular output format. The default\nis to terminate fields with tabs (\\t) and lines with newlines (\\n).\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nThe LOAD DATA INFILE statement complements SELECT INTO OUTFILE.\n\nCharacter-sets\n--------------\n\nThe CHARACTER SET clause specifies the character set in which the results are\nto be written. Without the clause, no conversion takes place (the binary\ncharacter set). In this case, if there are multiple character sets, the output\nwill contain these too, and may not easily be able to be reloaded.\n\nIn cases where you have two servers using different character-sets, using\nSELECT INTO OUTFILE to transfer data from one to the other can have unexpected\nresults. To ensure that MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE statement and the\nsubsequent LOAD DATA INFILE statement.\n\nExample\n-------\n\nThe following example produces a file in the CSV format:\n\nSELECT customer_id, firstname, surname INTO OUTFILE \'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\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 (438,27,'SELECT INTO DUMPFILE','Syntax\n------\n\nSELECT ... INTO DUMPFILE \'file_path\'\n\nDescription\n-----------\n\nSELECT ... INTO DUMPFILE is a SELECT clause which writes the resultset into a\nsingle unformatted row, without any separators, in a file. The results will\nnot be returned to the client.\n\nfile_path can be an absolute path, or a relative path starting from the data\ndirectory. It can only be specified as a string literal, not as a variable.\nHowever, the statement can be dynamically composed and executed as a prepared\nstatement to work around this limitation.\n\nThis statement is binary-safe and so is particularly useful for writing BLOB\nvalues to file. It can be used, for example, to copy an image or an audio\ndocument from the database 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 needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nExample\n-------\n\nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n\nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n+--------------+\n| world |\n+--------------+\n| Hello world! |\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 (439,27,'FOR UPDATE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nThe FOR UPDATE clause of SELECT applies only when autocommit is set to 0 or\nthe SELECT is enclosed in a transaction. A lock is acquired on the rows, and\nother transactions are prevented from writing the rows, acquire locks, and\nfrom reading them (unless their isolation level is READ UNCOMMITTED).\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\n\nIf the isolation level is set to SERIALIZABLE, all plain SELECT statements are\nconverted to SELECT ... LOCK IN SHARE MODE.\n\nExample\n-------\n\nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\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 (440,27,'LOCK IN SHARE MODE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nWhen LOCK IN SHARE MODE is specified in a SELECT statement, MariaDB will wait\nuntil all transactions that have modified the rows are committed. Then, a\nwrite lock is acquired. All transactions can read the rows, but if they want\nto modify them, they have to wait until your transaction is committed.\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\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 (441,27,'Optimizer Hints','Optimizer hints\n---------------\n\nThere are some options available in SELECT to affect the execution plan. These\nare known as optimizer hints.\n\nHIGH PRIORITY\n-------------\n\nHIGH_PRIORITY gives the statement a higher priority. If the table is locked,\nhigh priority SELECTs will be executed as soon as the lock is released, even\nif other statements are queued. HIGH_PRIORITY applies only if the storage\nengine only supports table-level locking (MyISAM, MEMORY, MERGE). See\nHIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nSQL_CACHE / SQL_NO_CACHE\n------------------------\n\nIf the query_cache_type system variable is set to 2 or DEMAND, and the current\nstatement is cacheable, SQL_CACHE causes the query to be cached and\nSQL_NO_CACHE causes the query not to be cached. For UNIONs, SQL_CACHE or\nSQL_NO_CACHE should be specified for the first query. See also The Query Cache\nfor more detail and a list of the types of statements that aren\'t cacheable.\n\nSQL_BUFFER_RESULT\n-----------------\n\nSQL_BUFFER_RESULT forces the optimizer to use a temporary table to process the\nresult. This is useful to free locks as soon as possible.\n\nSQL_SMALL_RESULT / SQL_BIG_RESULT\n---------------------------------\n\nSQL_SMALL_RESULT and SQL_BIG_RESULT tell the optimizer whether the result is\nvery big or not. Usually, GROUP BY and DISTINCT operations are performed using\na temporary table. Only if the result is very big, using a temporary table is\nnot convenient. The optimizer automatically knows if the result is too big,\nbut you can force the optimizer to use a temporary table with\nSQL_SMALL_RESULT, or avoid the temporary table using SQL_BIG_RESULT.\n\nSTRAIGHT_JOIN\n-------------\n\nSTRAIGHT_JOIN applies to the JOIN queries, and tells the optimizer that the\ntables must be read in the order they appear in the SELECT. For const and\nsystem table this options is sometimes ignored.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nSQL_CALC_FOUND_ROWS is only applied when using the LIMIT clause. If this\noption is used, MariaDB will count how many rows would match the query,\nwithout the LIMIT clause. That number can be retrieved in the next query,\nusing FOUND_ROWS().\n\nUSE/FORCE/IGNORE INDEX\n----------------------\n\nUSE INDEX, FORCE INDEX and IGNORE INDEX constrain the query planning to a\nspecific index.\n\nFor further information about some of these options, see How to force query\nplans.\n\nURL: https://mariadb.com/kb/en/optimizer-hints/','','https://mariadb.com/kb/en/optimizer-hints/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (442,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set to a Procedure\nwhich will process it. These Procedures are not Stored Procedures, and can\nonly be written in the C language, so it is necessary to recompile the server.\n\nCurrently, the only available procedure is ANALYSE, which examines the\nresultset and suggests the optimal datatypes for each column. It is defined in\nthe sql/sql_analyse.cc file, and can be used as an example to create more\nProcedures.\n\nThis clause cannot be used in a view\'s definition.\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 (443,27,'DUAL','Description\n-----------\n\nYou are allowed to specify DUAL as a dummy table name in situations where no\ntables are referenced, such as the following SELECT statement:\n\nSELECT 1 + 1 FROM DUAL;\n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n\nDUAL is purely for the convenience of people who require that all SELECT\nstatements should have FROM and possibly other clauses. MariaDB ignores the\nclauses. MariaDB does not require FROM DUAL if no tables are referenced.\n\nFROM DUAL could be used when you only SELECT computed values, but require a\nWHERE clause, perhaps to test that a script correctly handles empty resultsets:\n\nSELECT 1 FROM DUAL WHERE FALSE;\nEmpty set (0.00 sec)\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 (444,27,'SELECT ... OFFSET ... FETCH','MariaDB starting with 10.6.0\n----------------------------\nSELECT ... OFFSET ... FETCH was introduced in MariaDB 10.6.\n\nSyntax\n------\n\nOFFSET start { ROW | ROWS }\nFETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }\n\nDescription\n-----------\n\nThe OFFSET clause allows one to return only those elements of a resultset that\ncome after a specified offset. The FETCH clause specifies the number of rows\nto return, while ONLY or WITH TIES specifies whether or not to also return any\nfurther results that tie for last place according to the ordered resultset.\n\nEither the singular ROW or the plural ROWS can be used after the OFFSET and\nFETCH clauses; the choice has no impact on the results.\n\nIn the case of WITH TIES, an ORDER BY clause is required, otherwise an ERROR\nwill be returned.\n\nSELECT i FROM t1 FETCH FIRST 2 ROWS WITH TIES;\nERROR 4180 (HY000): FETCH ... WITH TIES requires ORDER BY clause to be present\n\nExamples\n--------\n\nGiven a table with 6 rows:\n\nCREATE OR REPLACE TABLE t1 (i INT);\nINSERT INTO t1 VALUES (1),(2),(3),(4), (4), (5);\nSELECT i FROM t1 ORDER BY i ASC;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nOFFSET 2 allows one to skip the first two results.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 2 ROWS;\n+------+\n| i |\n+------+\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nFETCH FIRST 3 ROWS ONLY limits the results to three rows only\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS ONLY;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nThe same outcome can also be achieved with the LIMIT clause:\n\nSELECT i FROM t1 ORDER BY i ASC LIMIT 3 OFFSET 1;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nWITH TIES ensures the tied result 4 is also returned.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS WITH TIES;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n+------+\n\nURL: https://mariadb.com/kb/en/select-offset-fetch/','','https://mariadb.com/kb/en/select-offset-fetch/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (445,27,'INSERT','Syntax\n------\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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nThe INSERT statement is used to insert new rows into an existing table. The\nINSERT ... VALUES and INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed further\nin the INSERT ... SELECT article.\n\nThe table name can be specified in the form db_name.tbl_name or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use INSERT ... SELECT to copy rows between different databases.\n\nThe PARTITION clause can be used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n\nMariaDB starting with 10.5\n--------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.\n\nThe columns list is optional. It specifies which values are explicitly\ninserted, and in which order. If this clause is not specified, all values must\nbe explicitly specified, in the same order they are listed in the table\ndefinition.\n\nThe list of value follow the VALUES or VALUE keyword (which are\ninterchangeable, regardless how much values you want to insert), and is\nwrapped by parenthesis. The values must be listed in the same order as the\ncolumns list. It is possible to specify more than one list to insert more than\none rows with a single statement. If many rows are inserted, this is a speed\noptimization.\n\nFor one-row statements, the SET clause may be more simple, because you don\'t\nneed to remember the columns order. All values are specified in the form col =\nexpr.\n\nValues can also be specified in the form of a SQL expression or subquery.\nHowever, the subquery cannot access the same table that is named in the INTO\nclause.\n\nIf you use the LOW_PRIORITY keyword, execution of the INSERT is delayed until\nno other clients are reading from the table. If you use the HIGH_PRIORITY\nkeyword, the statement has the same priority as SELECTs. This affects only\nstorage engines that use only table-level locking (MyISAM, MEMORY, MERGE).\nHowever, if one of these keywords is specified, concurrent inserts cannot be\nused. See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nINSERT DELAYED\n--------------\n\nFor more details on the DELAYED option, see INSERT DELAYED.\n\nHIGH PRIORITY and LOW PRIORITY\n------------------------------\n\nSee HIGH_PRIORITY and LOW_PRIORITY.\n\nDefaults and Duplicate Values\n-----------------------------\n\nSee INSERT - Default & Duplicate Values for details..\n\nINSERT IGNORE\n-------------\n\nSee INSERT IGNORE.\n\nINSERT ON DUPLICATE KEY UPDATE\n------------------------------\n\nSee INSERT ON DUPLICATE KEY UPDATE.\n\nExamples\n--------\n\nSpecifying the column names:\n\nINSERT INTO person (first_name, last_name) VALUES (\'John\', \'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 = \'Doe\';\n\nSELECTing from another table:\n\nINSERT INTO contractor SELECT * FROM person WHERE status = \'c\';\n\nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for further examples.\n\nINSERT ... RETURNING\n--------------------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statement\n\nINSERT INTO t2 VALUES (1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \nRETURNING id2,id2+id2,id2&id2,id2||id2;\n+-----+---------+---------+----------+\n| id2 | id2+id2 | id2&id2 | id2||id2 |\n+-----+---------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+-----+---------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\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 (446,27,'INSERT DELAYED','Syntax\n------\n\nINSERT DELAYED ...\n\nDescription\n-----------\n\nThe DELAYED option for the INSERT statement is a MariaDB/MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or need not\nwait for the INSERT to complete. This is a common situation when you use\nMariaDB for logging and you also periodically run SELECT and UPDATE statements\nthat take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at once,\nand the row is queued to be inserted when the table is not in use by any other\nthread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much faster\nthan performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is not\notherwise in use. There is also the additional overhead for the server to\nhandle a separate thread for each table for which there are delayed rows. This\nmeans that you should use INSERT DELAYED only when you are really sure that\nyou need it.\n\nThe queued rows are held only in memory until they are inserted into the\ntable. This means that if you terminate mysqld forcibly (for example, with\nkill -9) or if mysqld dies unexpectedly, any queued rows that have not been\nwritten to disk are lost.\n\nThe number of concurrent INSERT DELAYED threads is limited by the\nmax_delayed_threads server system variables. If it is set to 0, INSERT DELAYED\nis disabled. The session value can be equal to the global value, or 0 to\ndisable this statement for the current session. If this limit has been\nreached, the DELAYED clause will be silently ignore for subsequent statements\n(no error will be produced).\n\nLimitations\n-----------\n\nThere are some limitations on the use of DELAYED:\n\n* INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with another storage\nengine, you will get an error like this: ERROR 1616 (HY000): DELAYED option\nnot supported for table \'tab_name\'\n* For MyISAM tables, if there are no free blocks in the middle of the data\n file, concurrent SELECT and INSERT statements are supported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n* INSERT 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.\n* Because 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.\n* DELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\n* After INSERT DELAYED, ROW_COUNT() returns the number of the rows you tried\nto insert, not the number of the successful writes.\n* DELAYED 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 replication.\n* Pending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table structure.\n* INSERT DELAYED is not supported for views. If you try, you will get an error\nlike this: ERROR 1347 (HY000): \'view_name\' is not BASE TABLE\n* INSERT DELAYED is not supported for partitioned tables.\n* INSERT DELAYED is not supported within stored programs.\n* INSERT DELAYED does not work with triggers.\n* INSERT DELAYED does not work if there is a check constraint in place.\n* INSERT DELAYED does not work if skip-new mode is active.\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 (447,27,'INSERT SELECT','Syntax\n------\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-----------\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table from one\nor 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 (see Identifier\nQualifiers). This allows to copy rows between different databases.\n\nIf the new table has a primary key or UNIQUE indexes, you can use IGNORE to\nhandle duplicate key errors during the query. The newer values will not be\ninserted if an identical value already exists.\n\nREPLACE can be used instead of INSERT to prevent duplicates on UNIQUE indexes\nby deleting old values. In that case, ON DUPLICATE KEY UPDATE cannot be used.\n\nINSERT ... SELECT works for tables which already exist. To create a table for\na given resultset, you can use CREATE TABLE ... SELECT.\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 (448,27,'LOAD DATA INFILE','Syntax\n------\n\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nLOAD DATA INFILE is unsafe for statement-based replication.\n\nReads rows from a text file into the designated table on the database at a\nvery high speed. The file name must be given as a literal string.\n\nFiles are written to disk using the SELECT INTO OUTFILE statement. You can\nthen read the files back into a table using the LOAD DATA INFILE statement.\nThe FIELDS and LINES clauses are the same in both statements. These clauses\nare optional, but if both are specified then the FIELDS clause must precede\nLINES.\n\nExecuting this statement activates INSERT triggers.\n\nOne must have the FILE privilege to be able to execute LOAD DATA. This is the\nensure the normal users will not attempt to read system files.\n\nNote that MariaDB\'s systemd unit file restricts access to /home, /root, and\n/run/user by default. See Configuring access to home directories.\n\nLOAD DATA LOCAL INFILE\n----------------------\n\nWhen you execute the LOAD DATA INFILE statement, MariaDB Server attempts to\nread the input file from its own file system. In contrast, when you execute\nthe LOAD DATA LOCAL INFILE statement, the client attempts to read the input\nfile from its file system, and it sends the contents of the input file to the\nMariaDB Server. This allows you to load files from the client\'s local file\nsystem into the database.\n\nIn the event that you don\'t want to permit this operation (such as for\nsecurity reasons), you can disable the LOAD DATA LOCAL INFILE statement on\neither the server or the client.\n\n* The LOAD DATA LOCAL INFILE statement can be disabled on the server by\nsetting the local_infile system variable to 0.\n* The LOAD DATA LOCAL INFILE statement can be disabled on the client. If you\nare using MariaDB Connector/C, this can be done by unsetting the\nCLIENT_LOCAL_FILES capability flag with the mysql_real_connect function or by\nunsetting the MYSQL_OPT_LOCAL_INFILE option with mysql_optionsv function. If\nyou are using a different client or client library, then see the documentation\nfor your specific client or client library to determine how it handles the\nLOAD DATA LOCAL INFILE statement.\n\nIf the LOAD DATA LOCAL INFILE statement is disabled by either the server or\nthe client and if the user attempts to execute it, then the server will cause\nthe statement to fail with the following error message:\n\nThe used command is not allowed with this MariaDB version\n\nNote that it is not entirely accurate to say that the MariaDB version does not\nsupport the command. It would be more accurate to say that the MariaDB\nconfiguration does not support the command. See MDEV-20500 for more\ninformation.\n\nFrom MariaDB 10.5.2, the error message is more accurate:\n\nThe used command is not allowed because the MariaDB server or client \n has disabled the local infile capability\n\nREPLACE and IGNORE\n------------------\n\nIn cases where you load data from a file into a table that already contains\ndata and has a primary key, you may encounter issues where the statement\nattempts to insert a row with a primary key that already exists. When this\nhappens, the statement fails with Error 1064, protecting the data already on\nthe table. In cases where you want MariaDB to overwrite duplicates, use the\nREPLACE keyword.\n\nThe REPLACE keyword works like the REPLACE statement. Here, the statement\nattempts to load the data from the file. If the row does not exist, it adds it\nto the table. If the row contains an existing Primary Key, it replaces the\ntable data. That is, in the event of a conflict, it assumes the file contains\nthe desired row.\n\nThis operation can cause a degradation in load speed by a factor of 20 or more\nif the part that has already been loaded is larger than the capacity of the\nInnoDB Buffer Pool. This happens because it causes a lot of turnaround in the\nbuffer pool.\n\nUse the IGNORE keyword when you want to skip any rows that contain a\nconflicting primary key. Here, the statement attempts to load the data from\nthe file. If the row does not exist, it adds it to the table. If the row\ncontains an existing primary key, it ignores the addition request and moves on\nto the next. That is, in the event of a conflict, it assumes the table\ncontains the desired row.\n\nCharacter-sets\n--------------\n\nWhen the statement opens the file, it attempts to read the contents using the\ndefault character-set, as defined by the character_set_database system\nvariable.\n\nIn the cases where the file was written using a character-set other than the\ndefault, you can specify the character-set to use with the CHARACTER SET\nclause in the statement. It ignores character-sets specified by the SET NAMES\nstatement and by the character_set_client system variable. Setting the\nCHARACTER SET clause to a value of binary indicates \"no conversion.\"\n\nThe statement interprets all fields in the file as having the same\ncharacter-set, regardless of the column data type. To properly interpret file\ncontents, you must ensure that it was written with the correct character-set.\nIf you write a data file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the --default-character-set\noption, so that the output is written with the desired character-set.\n\nWhen using mixed character sets, use the CHARACTER SET clause in both SELECT\nINTO OUTFILE and LOAD DATA INFILE to ensure that MariaDB correctly interprets\nthe escape sequences.\n\nThe character_set_filesystem system variable controls the interpretation of\nthe filename.\n\nIt is currently not possible to load data files that use the ucs2 character\nset.\n\nPreprocessing Inputs\n--------------------\n\ncol_name_or_user_var can be a column name, or a user variable. In the case of\na variable, the SET statement can be used to preprocess the value before\nloading into the table.\n\nPriority and Concurrency\n------------------------\n\nIn storage engines that perform table-level locking (MyISAM, MEMORY and\nMERGE), using the LOW_PRIORITY keyword, MariaDB delays insertions until no\nother clients are reading from the table. Alternatively, when using the MyISAM\nstorage engine, you can use the CONCURRENT keyword to perform concurrent\ninsertion.\n\nThe LOW_PRIORITY and CONCURRENT keywords are mutually exclusive. They cannot\nbe used in the same statement.\n\nProgress Reporting\n------------------\n\nThe LOAD DATA INFILE statement supports progress reporting. You may find this\nuseful when dealing with long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the data load.\n\nUsing mariadb-import/mysqlimport\n--------------------------------\n\nMariaDB ships with a separate utility for loading data from files:\nmariadb-import (or mysqlimport before MariaDB 10.5). It operates by sending\nLOAD DATA INFILE statements to the server.\n\nUsing mariadb-import/mysqlimport you can compress the file using the\n--compress option, to get better performance over slow networks, providing\nboth the client and server support the compressed protocol. Use the --local\noption to load from the local file system.\n\nIndexing\n--------\n\nIn cases where the storage engine supports ALTER TABLE... DISABLE KEYS\nstatements (MyISAM and Aria), the LOAD DATA INFILE statement automatically\ndisables indexes during the execution.\n\nExamples\n--------\n\nYou have a file with this content (note the the separator is \',\', not tab,\nwhich is the default):\n\n2,2\n3,3\n4,4\n5,5\n6,8\n\nCREATE TABLE t1 (a int, b int, c int, d int);\nLOAD DATA LOCAL INFILE \n \'/tmp/loaddata7.dat\' into table t1 fields terminated by \',\' (a,b) set c=a+b;\nSELECT * FROM t1;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| 2 | 2 | 4 |\n| 3 | 3 | 6 |\n| 4 | 4 | 8 |\n| 5 | 5 | 10 |\n| 6 | 8 | 14 |\n+------+------+------+\n\nAnother example, given the following data (the separator is a tab):\n\n1 a\n2 b\n\nThe value of the first column is doubled before loading:\n\nLOAD DATA INFILE \'ld.txt\' INTO TABLE ld (@i,v) SET i=@i*2;\n\nSELECT * FROM ld;\n+------+------+\n| i | v |\n+------+------+\n| 2 | a |\n| 4 | b |\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 (449,27,'LOAD XML','Syntax\n------\n\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'<tagname>\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nThe LOAD XML statement reads data from an XML file into a table. The file_name\nmust be given as a literal string. The tagname in the optional ROWS IDENTIFIED\nBY clause must also be given as a literal string, and must be surrounded by\nangle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML output mode\n(that is, starting the client with the --xml option). To write data from a\ntable to an XML file, use a command such as the following one from the system\nshell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default, the <row>\nelement is considered to be the equivalent of a database table row; this can\nbe changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\n* Column names as attributes and column values as attribute values:\n\n<row column1=\"value1\" column2=\"value2\" .../>\n\n* Column names as tags and column values as the content of these tags:\n\n<row>\n <column1>value1</column1>\n <column2>value2</column2>\n</row>\n\n* Column names are the name attributes of <field> tags, and values are\n the contents of these tags:\n\n<row>\n <field name=\'column1\'>value1</field>\n <field name=\'column2\'>value2</field>\n</row>\n\nThis is the format used by other tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it correctly.\nTags are matched based on the tag or attribute name and the column name.\n\nThe following clauses work essentially the same way for LOAD XML as they do\nfor LOAD DATA:\n\n* LOW_PRIORITY or CONCURRENT\n* LOCAL\n* REPLACE or IGNORE\n* CHARACTER SET\n* (column_or_user_var,...)\n* SET\n\nSee LOAD DATA for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first number\nrows in the XML file to be skipped. It is analogous to the LOAD DATA\nstatement\'s IGNORE ... LINES clause.\n\nIf the LOW_PRIORITY keyword is used, insertions are delayed until no other\nclients are reading from the table. The CONCURRENT keyword allowes the use of\nconcurrent inserts. These clauses cannot be specified together.\n\nThis statement activates INSERT triggers.\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 (450,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This feature allows\nSELECT statements to be executed during INSERT operations, reducing contention.\n\nWhether concurrent inserts can be used or not depends on the value of the\nconcurrent_insert server system variable:\n\n* NEVER (0) disables concurrent inserts.\n* AUTO (1) allows concurrent inserts only when the target table has no free\nblocks (no data in the middle of the table has been deleted after the last\nOPTIMIZE TABLE). This is the default.\n* ALWAYS (2) always enables concurrent inserts, in which case new rows are\nadded at the end of a table if the table is being used by another thread.\n\nIf the binary log is used, CREATE TABLE ... SELECT and INSERT ... SELECT\nstatements cannot use concurrent inserts. These statements acquire a read lock\non the table, so concurrent inserts will need to wait. This way the log can be\nsafely used to restore data.\n\nConcurrent inserts are not used by replicas with the row based replication\n(see binary log formats).\n\nIf an INSERT statement contain the HIGH_PRIORITY clause, concurrent inserts\ncannot be used. INSERT ... DELAYED is usually unneeded if concurrent inserts\nare enabled.\n\nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT keyword is\nspecified and concurrent_insert is not NEVER. This makes the statement slower\n(even if no other sessions access the table) but reduces contention.\n\nLOCK TABLES allows non-conflicting concurrent inserts if a READ LOCAL lock is\nused. Concurrent inserts are not allowed if the LOCAL keyword is omitted.\n\nNotes\n-----\n\nThe decision to enable concurrent insert for a table is done when the table is\nopened. If you change the value of concurrent_insert it will only affect new\nopened tables. If you want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\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 (451,27,'HIGH_PRIORITY and LOW_PRIORITY','The InnoDB storage engine uses row-level locking to ensure data integrity.\nHowever some storage engines (such as MEMORY, MyISAM, Aria and MERGE) lock the\nwhole table to prevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs and the other one is\nfor write statements (INSERT, DELETE, UPDATE). By default, the latter has a\nhigher priority.\n\nTo give write operations a lower priority, the low_priority_updates server\nsystem variable can be set to ON. The option is available on both the global\nand session levels, and it can be set at startup or via the SET statement.\n\nWhen too many table locks have been set by write statements, some pending\nSELECTs are executed. The maximum number of write locks that can be acquired\nbefore this happens is determined by the max_write_lock_count server system\nvariable, which is dynamic.\n\nIf write statements have a higher priority (default), the priority of\nindividual write statements (INSERT, REPLACE, UPDATE, DELETE) can be changed\nvia the LOW_PRIORITY attribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES supports a\nLOW_PRIORITY attribute for WRITE locks.\n\nIf read statements have a higher priority, the priority of an INSERT can be\nchanged via the HIGH_PRIORITY attribute. However, the priority of other write\nstatements cannot be raised individually.\n\nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT prevents Concurrent\nInserts from being used.\n\nURL: https://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 (452,27,'INSERT - Default & Duplicate Values','Default Values\n--------------\n\nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are inserting into a\ntransactional table (like InnoDB), or if the SQL_MODE contains\nSTRICT_ALL_TABLES, all NOT NULL columns which do not have a DEFAULT value (and\nare not AUTO_INCREMENT) must be explicitly referenced in INSERT statements. If\nnot, an error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nIn all other cases, if a NOT NULL column without a DEFAULT value is not\nreferenced, an empty value will be inserted (for example, 0 for INTEGER\ncolumns and \'\' for CHAR columns). See NULL Values in MariaDB:Inserting for\nexamples.\n\nIf a NOT NULL column having a DEFAULT value is not referenced, NULL will be\ninserted.\n\nIf a NULL column having a DEFAULT value is not referenced, its default value\nwill be inserted. It is also possible to explicitly assign the default value\nusing the DEFAULT keyword or the DEFAULT() function.\n\nIf the DEFAULT keyword is used but the column does not have a DEFAULT value,\nan error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nDuplicate Values\n----------------\n\nBy default, if you try to insert a duplicate row and there is a UNIQUE index,\nINSERT stops and an error like this is produced:\n\nERROR 1062 (23000): Duplicate entry \'dup_value\' for key \'col\'\n\nTo handle duplicates you can use the IGNORE clause, INSERT ON DUPLICATE KEY\nUPDATE or the REPLACE statement. Note that the IGNORE and DELAYED options are\nignored when you use ON DUPLICATE KEY UPDATE.\n\nURL: https://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 (453,27,'INSERT IGNORE','Ignoring Errors\n---------------\n\nNormally INSERT stops and rolls back when it encounters an error.\n\nBy using the IGNORE keyword all errors are converted to warnings, which will\nnot stop inserts of additional rows.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nPrior to MySQL and MariaDB 5.5.28, no warnings were issued for duplicate key\nerrors when using IGNORE. You can get the old behavior if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE.\n\nExamples\n--------\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| 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| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n\nSELECT * FROM t1;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nSee INSERT ON DUPLICATE KEY UPDATE for further examples using that syntax.\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 (454,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------\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-----------\n\nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL extension to the INSERT\nstatement that, if it finds a duplicate unique or primary key, will instead\nperform an UPDATE.\n\nThe row/s affected value is reported as 1 if a row is inserted, and 2 if a row\nis updated, unless the API\'s CLIENT_FOUND_ROWS flag is set.\n\nIf more than one unique index is matched, only the first is updated. It is not\nrecommended to use this statement on tables with more than one unique index.\n\nIf the table has an AUTO_INCREMENT primary key and the statement inserts or\nupdates a row, the LAST_INSERT_ID() function returns its AUTO_INCREMENT value.\n\nThe VALUES() function can only be used in a ON DUPLICATE KEY UPDATE clause and\nhas no meaning in any other context. It returns the column values from the\nINSERT portion of the statement. This function is particularly useful for\nmulti-rows inserts.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nSee Partition Pruning and Selection for details on the PARTITION clause.\n\nThis statement activates INSERT and UPDATE triggers. See Trigger Overview for\ndetails.\n\nSee also a similar statement, REPLACE.\n\nExamples\n--------\n\nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal VARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'), (2,\'Cheetah\'), (3,\'Zebra\');\n\nIf there is no existing key, the statement runs as a regular INSERT:\n\nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') \n ON DUPLICATE 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, due to the existing\nkey:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key \'PRIMARY\'\n\nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE instead:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') \n ON DUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n\nNote that there are two rows reported as affected, but this refers only to the\nUPDATE.\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 is updated. This\ncan be unsafe and is not recommended unless you are certain what you are doing.\n\nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) \n ON DUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected (0.004 sec)\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, which also matched,\nit was not updated.\n\nChanging id to an auto_increment field. If a new row is added, the\nauto_increment is moved forward. If the row is updated, it remains the same.\n\nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') \n ON DUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') \n ON DUPLICATE 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 \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n\nRefering to column values from the INSERT portion of the statement:\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\nURL: https://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 (455,27,'INSERT...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nINSERT ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe inserted rows.\n\nSyntax\n------\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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nDescription\n-----------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statements:\n\nCREATE OR REPLACE TABLE t2 (id INT, animal VARCHAR(20), t TIMESTAMP);\n\nINSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t;\n+------+---------------------+\n| id | t |\n+------+---------------------+\n| 2 | 2021-04-28 00:59:32 |\n| 3 | 2021-04-28 00:59:32 |\n+------+---------------------+\n\nINSERT INTO t2(id,animal) VALUES\n(1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \n RETURNING id,id+id,id&id,id||id;\n+------+-------+-------+--------+\n| id | id+id | id&id | id||id |\n+------+-------+-------+--------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+------+-------+-------+--------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\n\nURL: https://mariadb.com/kb/en/insertreturning/','','https://mariadb.com/kb/en/insertreturning/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (456,27,'REPLACE...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nREPLACE ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe replaced rows.\n\nSyntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in\nREPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the REPLACE table.\n\nURL: https://mariadb.com/kb/en/replacereturning/','','https://mariadb.com/kb/en/replacereturning/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,27,'CALL','Syntax\n------\n\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nDescription\n-----------\n\nThe CALL statement invokes a stored procedure that was defined previously with\nCREATE PROCEDURE.\n\nStored procedure names can be specified as database_name.procedure_name.\nProcedure names and database names can be quoted with backticks (). This is\nnecessary if they are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n\nCALL p() and CALL p are equivalent.\n\nIf parentheses are used, any number of spaces, tab characters and newline\ncharacters are allowed between the procedure\'s name and the open parenthesis.\n\nCALL can pass back values to its caller using parameters that are declared as\nOUT or INOUT parameters. If no value is assigned to an OUT parameter, NULL is\nassigned (and its former value is lost). To pass such values from another\nstored program you can use user-defined variables, local variables or\nroutine\'s parameters; in other contexts, you can only use user-defined\nvariables.\n\nCALL can also be executed as a prepared statement. Placeholders can be used\nfor IN parameters in all versions of MariaDB; for OUT and INOUT parameters,\nplaceholders can be used since MariaDB 5.5.\n\nWhen the procedure returns, a client program can also obtain the number of\nrows affected for the final statement executed within the routine: At the SQL\nlevel, call the ROW_COUNT() function; from the C API, call the\nmysql_affected_rows() function.\n\nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return any number of\nresultsets and the called stored procedure can execute prepared statements. If\nit is not set, at most one resultset can be returned and prepared statements\ncannot be used within procedures.\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 (458,27,'DO','Syntax\n------\n\nDO expr [, expr] ...\n\nDescription\n-----------\n\nDO executes the expressions but does not return any results. In most respects,\nDO is shorthand for SELECT expr, ..., but has the advantage that it is\nslightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: https://mariadb.com/kb/en/do/','','https://mariadb.com/kb/en/do/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (459,27,'Comment Syntax','There are three supported comment styles in MariaDB:\n\n* From a \'#\' to the end of a line:SELECT * FROM users; # This is a comment\n\n* From a \'-- \' to the end of a line. The space after the two dashes is\nrequired (as in MySQL).SELECT * FROM users; -- This is a comment\n\n* C style comments from an opening \'/*\' to a closing \'*/\'. Comments of this\nform can span multiple lines:SELECT * FROM users; /* This is a\nmulti-line\ncomment */\n\nNested comments are possible in some situations, but they are not supported or\nrecommended.\n\nExecutable Comments\n-------------------\n\nAs an aid to portability between different databases, MariaDB supports\nexecutable comments. These special comments allow you to embed SQL code which\nwill not execute when run on other databases, but will execute when run on\nMariaDB.\n\nMariaDB supports both MySQL\'s executable comment format, and a slightly\nmodified version specific to MariaDB. This way, if you have SQL code that\nworks on MySQL and MariaDB, but not other databases, you can wrap it in a\nMySQL executable comment, and if you have code that specifically takes\nadvantage of features only available in MariaDB you can use the MariaDB\nspecific format to hide the code from MySQL.\n\nExecutable Comment Syntax\n-------------------------\n\nMySQL and MariaDB executable comment syntax:\n\n/*! MySQL or MariaDB-specific code */\n\nCode that should be executed only starting from a specific MySQL or MariaDB\nversion:\n\n/*!##### MySQL or MariaDB-specific code */\n\nThe numbers, represented by \'######\' in the syntax examples above specify the\nspecific the minimum versions of MySQL and MariaDB that should execute the\ncomment. The first number is the major version, the second 2 numbers are the\nminor version and the last 2 is the patch level.\n\nFor example, if you want to embed some code that should only execute on MySQL\nor MariaDB starting from 5.1.0, you would do the following:\n\n/*!50100 MySQL and MariaDB 5.1.0 (and above) code goes here. */\n\nMariaDB-only executable comment syntax (starting from MariaDB 5.3.1):\n\n/*M! MariaDB-specific code */\n/*M!###### MariaDB-specific code */\n\nMariaDB ignores MySQL-style executable comments that have a version number in\nthe range 50700..99999. This is needed to skip features introduced in\nMySQL-5.7 that are not ported to MariaDB 10.x yet.\n\n/*!50701 MariaDB-10.x ignores MySQL-5.7 specific code */\n\nNote: comments which have a version number in the range 50700..99999 that use\nMariaDB-style executable comment syntax are still executed.\n\n/*M!50701 MariaDB-10.x does not ignore this */\n\nStatement delimiters cannot be used within executable comments.\n\nExamples\n--------\n\nIn MySQL all the following will return 2: In MariaDB, the last 2 queries would\nreturn 3.\n\nSELECT 2 /* +1 */;\nSELECT 1 /*! +1 */;\nSELECT 1 /*!50101 +1 */;\nSELECT 2 /*M! +1 */;\nSELECT 2 /*M!50301 +1 */;\n\nThe following executable statement will not work due to the delimiter inside\nthe executable portion:\n\n/*M!100100 select 1 ; */\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat corresponds to your MariaDB server version for the right syntax to use\nnear \'\' at line 1\n\nInstead, the delimiter should be placed outside the executable portion:\n\n/*M!100100 select 1 */;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n\nURL: https://mariadb.com/kb/en/comment-syntax/','','https://mariadb.com/kb/en/comment-syntax/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,27,'HANDLER Commands','Syntax\n------\n\nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE\n\nDescription\n-----------\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces for key lookups and key or table scans. It is available for at\nleast Aria, Memory, MyISAM and InnoDB tables (and should work with most\n\'normal\' storage engines, but not with system tables, MERGE or views).\n\nHANDLER ... OPEN opens a table, allowing it to be accessible to subsequent\nHANDLER ... READ statements. The table can either be opened using an alias\n(which must then be used by HANDLER ... READ, or a table name.\n\nThe table object is only closed when HANDLER ... CLOSE is called by the\nsession, and is not shared by other sessions.\n\nPrepared statements work with HANDLER READ, which gives a much higher\nperformance (50% speedup) as there is no parsing and all data is transformed\nin binary (without conversions to text, as with the normal protocol).\n\nThe HANDLER command does not work with partitioned tables.\n\nKey Lookup\n----------\n\nA key lookup is started with:\n\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value,value) [LIMIT...]\n\nThe values stands for the value of each of the key columns. For most key types\n(except for HASH keys in MEMORY storage engine) you can use a prefix subset of\nit\'s columns.\n\nIf you are using LIMIT, then in case of >= or > then there is an implicit NEXT\nimplied, while if you are using <= or < then there is an implicit PREV implied.\n\nAfter the initial read, you can use\n\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\nor\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nto scan the rows in key order.\n\nNote that the row order is not defined for keys with duplicated values and\nwill vary from engine to engine.\n\nKey Scans\n---------\n\nYou can scan a table in key order by doing:\n\nHANDLER tbl_name READ index_name FIRST [ LIMIT ... ]\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\n\nor, if the handler supports backwards key scans (most do):\n\nHANDLER tbl_name READ index_name LAST [ LIMIT ... ]\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nTable Scans\n-----------\n\nYou can scan a table in row order by doing:\n\nHANDLER tbl_name READ FIRST [ LIMIT ... ]\nHANDLER tbl_name READ NEXT [ LIMIT ... ]\n\nLimitations\n-----------\n\nAs this is a direct interface to the storage engine, some limitations may\napply for what you can do and what happens if the table changes. Here follows\nsome of the common limitations:\n\nFinding \'Old Rows\'\n------------------\n\nHANDLER READ is not transaction safe, consistent or atomic. It\'s ok for the\nstorage engine to returns rows that existed when you started the scan but that\nwere later deleted. This can happen as the storage engine may cache rows as\npart of the scan from a previous read.\n\nYou may also find rows committed since the scan originally started.\n\nInvisible Columns\n-----------------\n\nHANDLER ... READ also reads the data of invisible-columns.\n\nSystem-Versioned Tables\n-----------------------\n\nHANDLER ... READ reads everything from system-versioned tables, and so\nincludes row_start and row_end fields, as well as all rows that have since\nbeen deleted or changed, including when history partitions are used.\n\nOther Limitations\n-----------------\n\n* If you do an ALTER TABLE, all your HANDLERs for that table are automatically\nclosed.\n* If you do an ALTER TABLE for a table that is used by some other connection\nwith HANDLER, the ALTER TABLE will wait for the HANDLER to be closed.\n* For HASH keys, you must use all key parts when searching for a row.\n* For HASH keys, you can\'t do a key scan of all values. You can only find all\nrows with the same key value.\n* While each HANDLER READ command is atomic, if you do a scan in many steps,\nthen some engines may give you error 1020 if the table changed between the\ncommands. Please refer to the specific engine handler page if this happens.\n\nError Codes\n-----------\n\n* Error 1031 (ER_ILLEGAL_HA) Table storage engine for \'t1\' doesn\'t have this\noption\nIf you get this for HANDLER OPEN it means the storage engine doesn\'t support\nHANDLER calls.\nIf you get this for HANDLER READ it means you are trying to use an incomplete\nHASH key.\n\n* Error 1020 (ER_CHECKREAD) Record has changed since last read in table \'...\'\nThis means that the table changed between two reads and the handler can\'t\nhandle this case for the given scan.\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 (461,27,'HANDLER for MEMORY Tables','This article explains how to use HANDLER commands efficiently with MEMORY/HEAP\ntables.\n\nIf you want to scan a table for over different key values, not just search for\nexact key values, you should create your keys with \'USING BTREE\':\n\nCREATE TABLE t1 (a INT, b INT, KEY(a), KEY b USING BTREE (b)) engine=memory;\n\nIn the above table, a is a HASH key that only supports exact matches (=) while\nb is a BTREE key that you can use to scan the table in key order, starting\nfrom start or from a given key value.\n\nThe limitations for HANDLER READ with Memory|HEAP tables are:\n\nLimitations for HASH keys\n-------------------------\n\n* You must use all key parts when searching for a row.\n* You can\'t do a key scan of all values. You can only find all rows with the\nsame key value.\n* READ NEXT gives error 1031 if the tables changed since last read.\n\nLimitations for BTREE keys\n--------------------------\n\n* READ NEXT gives error 1031 if the tables changed since last read. This\nlimitation can be lifted in the future.\n\nLimitations for table scans\n---------------------------\n\n* READ NEXT gives error 1031 if the table was truncated since last READ call.\n\nURL: https://mariadb.com/kb/en/handler-for-memory-tables/','','https://mariadb.com/kb/en/handler-for-memory-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (462,27,'Useful MariaDB Queries','This page is intended to be a quick reference of commonly-used and/or useful\nqueries in MariaDB.\n\nCreating a Table\n----------------\n\nCREATE TABLE t1 ( a INT );\nCREATE TABLE t2 ( b INT );\nCREATE TABLE student_tests (\n name CHAR(10), test CHAR(10), \n score TINYINT, test_date DATE\n);\n\nSee CREATE TABLE for more.\n\nInserting Records\n-----------------\n\nINSERT INTO t1 VALUES (1), (2), (3);\nINSERT INTO t2 VALUES (2), (4);\n\nINSERT INTO student_tests \n (name, test, score, test_date) VALUES\n (\'Chun\', \'SQL\', 75, \'2012-11-05\'), \n (\'Chun\', \'Tuning\', 73, \'2013-06-14\'),\n (\'Esben\', \'SQL\', 43, \'2014-02-11\'), \n (\'Esben\', \'Tuning\', 31, \'2014-02-09\'), \n (\'Kaolin\', \'SQL\', 56, \'2014-01-01\'),\n (\'Kaolin\', \'Tuning\', 88, \'2013-12-29\'), \n (\'Tatiana\', \'SQL\', 87, \'2012-04-28\'), \n (\'Tatiana\', \'Tuning\', 83, \'2013-09-30\');\n\nSee INSERT for more.\n\nUsing AUTO_INCREMENT\n--------------------\n\nThe AUTO_INCREMENT attribute is used to automatically generate a unique\nidentity for new rows.\n\nCREATE TABLE student_details (\n id INT NOT NULL AUTO_INCREMENT, name CHAR(10), \n date_of_birth DATE, PRIMARY KEY (id)\n);\n\nWhen inserting, the id field can be omitted, and is automatically created.\n\nINSERT INTO student_details (name,date_of_birth) VALUES \n (\'Chun\', \'1993-12-31\'), \n (\'Esben\',\'1946-01-01\'),\n (\'Kaolin\',\'1996-07-16\'),\n (\'Tatiana\', \'1988-04-13\');\n\nSELECT * FROM student_details;\n+----+---------+---------------+\n| id | name | date_of_birth |\n+----+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+----+---------+---------------+\n\nSee AUTO_INCREMENT for more.\n\nQuerying from two tables on a common value\n------------------------------------------\n\nSELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.b;\n\nThis kind of query is called a join - see JOINS for more.\n\nFinding the Maximum Value\n-------------------------\n\nSELECT MAX(a) FROM t1;\n+--------+\n| MAX(a) |\n+--------+\n| 3 |\n+--------+\n\nSee the MAX() function for more, as well as Finding the maximum value and\ngrouping the results below for a more practical example.\n\nFinding the Minimum Value\n-------------------------\n\nSELECT MIN(a) FROM t1;\n+--------+\n| MIN(a) |\n+--------+\n| 1 |\n+--------+\n\nSee the MIN() function for more.\n\nFinding the Average Value\n-------------------------\n\nSELECT AVG(a) FROM t1;\n+--------+\n| AVG(a) |\n+--------+\n| 2.0000 |\n+--------+\n\nSee the AVG() function for more.\n\nFinding the Maximum Value and Grouping the Results\n--------------------------------------------------\n\nSELECT name, MAX(score) FROM student_tests GROUP BY name;\n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n\nSee the MAX() function for more.\n\nOrdering Results\n----------------\n\nSELECT name, test, score FROM student_tests ORDER BY score DESC;\n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n| Tatiana | Tuning | 83 |\n| Chun | SQL | 75 |\n| Chun | Tuning | 73 |\n| Kaolin | SQL | 56 |\n| Esben | SQL | 43 |\n| Esben | Tuning | 31 |\n+---------+--------+-------+\n\nSee ORDER BY for more.\n\nFinding the Row with the Minimum of a Particular Column\n-------------------------------------------------------\n\nIn this example, we want to find the lowest test score for any student.\n\nSELECT name,test, score FROM student_tests WHERE score=(SELECT MIN(score) FROM\nstudent);\n+-------+--------+-------+\n| name | test | score |\n+-------+--------+-------+\n| Esben | Tuning | 31 |\n+-------+--------+-------+\n\nFinding Rows with the Maximum Value of a Column by Group\n--------------------------------------------------------\n\nThis example returns the best test results of each student:\n\nSELECT name, test, score FROM student_tests st1 WHERE score = (\n SELECT MAX(score) FROM student st2 WHERE st1.name = st2.name\n); \n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Chun | SQL | 75 |\n| Esben | SQL | 43 |\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n+---------+--------+-------+\n\nCalculating Age\n---------------\n\nThe TIMESTAMPDIFF function can be used to calculate someone\'s age:\n\nSELECT CURDATE() AS today;\n+------------+\n| today |\n+------------+\n| 2014-02-17 |\n+------------+\n\nSELECT name, date_of_birth, TIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS\nage \n FROM student_details;\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\nSee TIMESTAMPDIFF() for more.\n\nUsing User-defined Variables\n----------------------------\n\nThis example sets a user-defined variable with the average test score, and\nthen uses it in a later query to return all results above the average.\n\nSELECT @avg_score:= AVG(score) FROM student_tests;\n+-------------------------+\n| @avg_score:= AVG(score) |\n+-------------------------+\n| 67.000000000 |\n+-------------------------+\n\nSELECT * FROM student_tests WHERE score > @avg_score;\n+---------+--------+-------+------------+\n| name | test | score | test_date |\n+---------+--------+-------+------------+\n| Chun | SQL | 75 | 2012-11-05 |\n| Chun | Tuning | 73 | 2013-06-14 |\n| Kaolin | Tuning | 88 | 2013-12-29 |\n| Tatiana | SQL | 87 | 2012-04-28 |\n| Tatiana | Tuning | 83 | 2013-09-30 |\n+---------+--------+-------+------------+\n\nUser-defined variables can also be used to add an incremental counter to a\nresultset:\n\nSET @count = 0;\n\nSELECT @count := @count + 1 AS counter, name, date_of_birth FROM\nstudent_details;\n+---------+---------+---------------+\n| counter | name | date_of_birth |\n+---------+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+---------+---------+---------------+\n\nSee User-defined Variables for more.\n\nView Tables in Order of Size\n----------------------------\n\nReturns a list of all tables in the database, ordered by size:\n\nSELECT table_schema as `DB`, table_name AS `Table`, \n ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`\n FROM information_schema.TABLES\n ORDER BY (data_length + index_length) DESC;\n\n+--------------------+---------------------------------------+-----------+\n| DB | Table | Size (MB) |\n+--------------------+---------------------------------------+-----------+\n| wordpress | wp_simple_history_contexts | 7.05 |\n| wordpress | wp_posts | 6.59 |\n| wordpress | wp_simple_history | 3.05 |\n| wordpress | wp_comments | 2.73 |\n| wordpress | wp_commentmeta | 2.47 |\n| wordpress | wp_simple_login_log | 2.03 |\n...\n\nRemoving Duplicates\n-------------------\n\nMariaDB starting with 10.3\n--------------------------\nThe following syntax is only valid MariaDB 10.3 and beyond:\n\nThis example assumes there\'s a unique ID, but that all other fields are\nidentical. In the example below, there are 4 records, 3 of which are\nduplicates, so two of the three duplicates need to be removed. The\nintermediate SELECT is not necessary, but demonstrates what is being returned.\n\nCREATE TABLE t (id INT, f1 VARCHAR(2));\n\nINSERT INTO t VALUES (1,\'a\'), (2,\'a\'), (3,\'b\'), (4,\'a\');\n\nSELECT * FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n);\n+------+------+------+------+\n| id | f1 | id | f1 |\n+------+------+------+------+\n| 4 | a | 1 | a |\n| 4 | a | 2 | a |\n+------+------+------+------+\n\nDELETE FROM t WHERE id IN (\n SELECT t2.id FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n )\n);\nQuery OK, 2 rows affected (0.120 sec)\n\nSELECT * FROM t;\n+------+------+\n| id | f1 |\n+------+------+\n| 3 | b |\n| 4 | a |\n+------+------\n\nURL: https://mariadb.com/kb/en/useful-mariadb-queries/','','https://mariadb.com/kb/en/useful-mariadb-queries/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and ANALYZE statement\nfeatures. The ANALYZE FORMAT=JSON $statement will execute $statement, and then\nprint the output of EXPLAIN FORMAT=JSON, amended with data from the query\nexecution.\n\nBasic Execution Data\n--------------------\n\nYou can get the following also from tabular ANALYZE statement form:\n\n* r_rows is provided for any node that reads rows. It shows how many rows\nwere read, on average \n* r_filtered is provided whenever there is a condition that is checked. It\nshows the percentage of rows left after checking the condition.\n\nAdvanced Execution Data\n-----------------------\n\nThe most important data not available in the regular tabula ANALYZE statement\nare:\n\n* r_loops field. This shows how many times the node was executed. Most query\nplan elements have this field.\n* r_total_time_ms field. It shows how much time in total was spent executing\nthis node. If the node has subnodes, their execution time is included.\n* r_buffer_size field. Query plan nodes that make use of buffers report the\nsize of buffer that was was used.\n\nSHOW ANALYZE FORMAT=JSON\n------------------------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW ANALYZE FORMAT=JSON for <connection_id> extends ANALYZE [FORMAT=JSON]\n<select> to allow one to analyze a query currently running in another\nconnection.\n\nData About Individual Query Plan Nodes\n--------------------------------------\n\n* filesort node reports whether sorting was done with LIMIT n parameter, and\nhow many rows were in the sort result. \n* block-nl-join node has r_loops field, which allows to tell whether Using\njoin buffer was efficient \n* range-checked-for-each-record reports counters that show the result of the\ncheck. \n* expression-cache is used for subqueries, and it reports how many times the\ncache was used, and what cache hit ratio was.\n* union_result node has r_rows so one can see how many rows were produced\nafter UNION operation\n* and so forth\n\nUse Cases\n---------\n\nSee Examples of ANALYZE FORMAT=JSON.\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 (464,28,'ANALYZE FORMAT=JSON Examples','Example #1\n----------\n\nCustomers who have ordered more than 1M goods.\n\nANALYZE FORMAT=JSON\nSELECT COUNT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE o_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) > <cache>((1000 * 1000)))\",\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, which was executed\n150K times (for every row of outer table).\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 (465,28,'ANALYZE Statement','Description\n-----------\n\nThe ANALYZE statement is similar to the EXPLAIN statement. ANALYZE statement\nwill invoke the optimizer, execute the statement, and then produce EXPLAIN\noutput instead of the result set. The EXPLAIN output will be annotated with\nstatistics from statement execution.\n\nThis lets one check how close the optimizer\'s estimates about the query plan\nare to the reality. ANALYZE produces an overview, while the ANALYZE\nFORMAT=JSON command provides a more detailed view of the query plan and the\nquery execution.\n\nThe syntax is\n\nANALYZE explainable_statement;\n\nwhere the statement is any statement for which one can run EXPLAIN.\n\nCommand Output\n--------------\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 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:\n\n* r_rows is an observation-based counterpart of the rows column. It shows how\nmany rows were actually read from the table. \n* r_filtered is an observation-based counterpart of the filtered column. It\nshows which fraction of rows was left after applying the WHERE condition.\n\nInterpreting the Output\n-----------------------\n\nJoins\n-----\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 < 0 AND\n orders.o_totalprice > 200*1000\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\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 |\ncustomer.c_custkey | 7 | 10 | 100.00 | 30.03 | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that\n\n* For table customer, customer.rows=149095, customer.r_rows=150000. The\nestimate for number of rows we will read was fairly precise\n* customer.filtered=18.08, customer.r_filtered=9.13. The optimizer somewhat\noverestimated the number of records that will match selectivity of condition\nattached to `customer` table (in general, when you have a full scan and\nr_filtered is less than 15%, it\'s time to consider adding an appropriate\nindex).\n* For table orders, orders.rows=7, orders.r_rows=10. This means that on\naverage, there are 7 orders for a given c_custkey, but in our case there were\n10, which is close to the expectation (when this number is consistently far\nfrom the expectation, it may be time to run ANALYZE TABLE, or even edit the\ntable statistics manually to get better query plans).\n* orders.filtered=100, orders.r_filtered=30.03. The optimizer didn\'t have any\nway to estimate which fraction of records will be left after it checks the\ncondition that is attached to table orders (it\'s orders.o_totalprice >\n200*1000). So, it used 100%. In reality, it is 30%. 30% is typically not\nselective enough to warrant adding new indexes. For joins with many tables, it\nmight be worth to collect and use column statistics for columns in question,\nthis may help the optimizer to pick a better query plan.\n\nMeaning of NULL in r_rows and r_filtered\n----------------------------------------\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 < -0 AND\n customer.c_comment LIKE \'%foo%\' AND\n orders.o_totalprice > 200*1000;\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\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 |\ncustomer.c_custkey | 7 | NULL | 100.00 | NULL | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that orders.r_rows=NULL and orders.r_filtered=NULL. This\nmeans that table orders was not scanned even once. Indeed, we can also see\ncustomer.r_filtered=0.00. This shows that a part of WHERE attached to table\n`customer` was never satisfied (or, satisfied in less than 0.01% of cases).\n\nANALYZE FORMAT=JSON\n-------------------\n\nANALYZE FORMAT=JSON produces JSON output. It produces much more information\nthan tabular ANALYZE.\n\nNotes\n-----\n\n* ANALYZE UPDATE or ANALYZE DELETE will actually make updates/deletes (ANALYZE\nSELECT will perform the select operation and then discard the resultset).\n* PostgreSQL has a similar command, EXPLAIN ANALYZE.\n* The EXPLAIN in the slow query log feature allows MariaDB to have ANALYZE\noutput of slow queries printed into the slow query log (see MDEV-6388).\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 (466,28,'EXPLAIN','Syntax\n------\n\nEXPLAIN tbl_name [col_name | wild]\n\nOr\n\nEXPLAIN [EXTENDED | PARTITIONS | FORMAT=JSON] \n {SELECT select_options | UPDATE update_options | DELETE delete_options}\n\nDescription\n-----------\n\nThe EXPLAIN statement can be used either as a synonym for DESCRIBE or as a way\nto obtain information about how MariaDB executes a SELECT, UPDATE or DELETE\nstatement:\n\n* \'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or\n \'SHOW COLUMNS FROM tbl_name\'.\n* When you precede a SELECT, UPDATE or a DELETE statement with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains how it would\n process the SELECT, UPDATE or DELETE, including information about how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\n* EXPLAIN PARTITIONS is useful only when examining queries involving\npartitioned tables. For details, see Partition pruning and selection.\n* ANALYZE statement performs the query as well as producing EXPLAIN output,\nand provides actual as well as estimated statistics.\n* EXPLAIN output can be printed in the slow query log. See EXPLAIN in the Slow\nQuery Log for details.\n\nSHOW EXPLAIN shows the output of a running statement. In some cases, its\noutput can be closer to reality than EXPLAIN.\n\nThe ANALYZE statement runs a statement and returns information about its\nexecution plan. It also shows additional columns, to check how much the\noptimizer\'s estimation about filtering and found rows are close to reality.\n\nThere is an online EXPLAIN Analyzer that you can use to share EXPLAIN and\nEXPLAIN EXTENDED output with others.\n\nEXPLAIN can acquire metadata locks in the same way that SELECT does, as it\nneeds to know table metadata and, sometimes, data as well.\n\nColumns in EXPLAIN ... SELECT\n-----------------------------\n\n+--------------------------------------+--------------------------------------+\n| Column name | Description |\n+--------------------------------------+--------------------------------------+\n| id | Sequence number that shows in which |\n| | order tables are joined. |\n+--------------------------------------+--------------------------------------+\n| select_type | What kind of SELECT the table comes |\n| | from. |\n+--------------------------------------+--------------------------------------+\n| table | Alias name of table. Materialized |\n| | temporary tables for sub queries |\n| | are named <subquery#> |\n+--------------------------------------+--------------------------------------+\n| type | How rows are found from the table |\n| | (join type). |\n+--------------------------------------+--------------------------------------+\n| possible_keys | keys in table that could be used to |\n| | find rows in the table |\n+--------------------------------------+--------------------------------------+\n| key | The name of the key that is used to |\n| | retrieve rows. NULL is no key was |\n| | used. |\n+--------------------------------------+--------------------------------------+\n| key_len | How many bytes of the key that was |\n| | used (shows if we are using only |\n| | parts of the multi-column key). |\n+--------------------------------------+--------------------------------------+\n| ref | The reference that is used as the |\n| | key value. |\n+--------------------------------------+--------------------------------------+\n| rows | An estimate of how many rows we |\n| | will find in the table for each key |\n| | lookup. |\n+--------------------------------------+--------------------------------------+\n| Extra | Extra information about this join. |\n+--------------------------------------+--------------------------------------+\n\nHere are descriptions of the values for some of the more complex columns in\nEXPLAIN ... SELECT:\n\n\"Select_type\" Column\n--------------------\n\nThe select_type column can have the following values:\n\n+-----------------+-----------------------------------+-----------------------+\n| Value | Description | Comment |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT | The SUBQUERY is DEPENDENT. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT UNION | The UNION is DEPENDENT. | |\n+-----------------+-----------------------------------+-----------------------+\n| DERIVED | The SELECT is DERIVED from the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| MATERIALIZED | The SUBQUERY is MATERIALIZED. | Materialized tables |\n| | | will be populated at |\n| | | first access and |\n| | | will be accessed by |\n| | | the primary key (= |\n| | | one key lookup). |\n| | | Number of rows in |\n| | | EXPLAIN shows the |\n| | | cost of populating |\n| | | the table |\n+-----------------+-----------------------------------+-----------------------+\n| PRIMARY | The SELECT is in the outermost | |\n| | query, but there is also a | |\n| | SUBQUERY within it. | |\n+-----------------+-----------------------------------+-----------------------+\n| SIMPLE | It is a simple SELECT query | |\n| | without any SUBQUERY or UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| SUBQUERY | The SELECT is a SUBQUERY of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The SUBQUERY is UNCACHEABLE. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The UNION is UNCACHEABLE. | |\n| UNION | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION | The SELECT is a UNION of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION RESULT | The result of the UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| LATERAL DERIVED | The SELECT uses a Lateral | |\n| | Derived optimization | |\n+-----------------+-----------------------------------+-----------------------+\n\n\"Type\" Column\n-------------\n\nThis column contains information on how the table is accessed.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| ALL | A full table scan is done for the table (all |\n| | rows are read). This is bad if the table is |\n| | large and the table is joined against a previous |\n| | table! This happens when the optimizer could |\n| | not find any usable index to access rows. |\n+------------------------+---------------------------------------------------+\n| const | There is only one possibly matching row in the |\n| | table. The row is read before the optimization |\n| | phase and all columns in the table are treated |\n| | as constants. |\n+------------------------+---------------------------------------------------+\n| eq_ref | A unique index is used to find the rows. This is |\n| | the best possible plan to find the row. |\n+------------------------+---------------------------------------------------+\n| fulltext | A fulltext index is used to access the rows. |\n+------------------------+---------------------------------------------------+\n| index_merge | A \'range\' access is done for for several index |\n| | and the found rows are merged. The key column |\n| | shows which keys are used. |\n+------------------------+---------------------------------------------------+\n| index_subquery | This is similar as ref, but used for sub queries |\n| | that are transformed to key lookups. |\n+------------------------+---------------------------------------------------+\n| index | A full scan over the used index. Better than |\n| | ALL but still bad if index is large and the |\n| | table is joined against a previous table. |\n+------------------------+---------------------------------------------------+\n| range | The table will be accessed with a key over one |\n| | or more value ranges. |\n+------------------------+---------------------------------------------------+\n| ref_or_null | Like \'ref\' but in addition another search for |\n| | the \'null\' value is done if the first value was |\n| | not found. This happens usually with sub queries. |\n+------------------------+---------------------------------------------------+\n| ref | A non unique index or prefix of an unique index |\n| | is used to find the rows. Good if the prefix |\n| | doesn\'t match many rows. |\n+------------------------+---------------------------------------------------+\n| system | The table has 0 or 1 rows. |\n+------------------------+---------------------------------------------------+\n| unique_subquery | This is similar as eq_ref, but used for sub |\n| | queries that are transformed to key lookups |\n+------------------------+---------------------------------------------------+\n\n\"Extra\" Column\n--------------\n\nThis column consists of one or more of the following values, separated by \';\'\n\nNote that some of these values are detected after the optimization phase.\n\nThe optimization phase can do the following changes to the WHERE clause:\n\n* Add the expressions from the ON and USING clauses to the WHERE\n clause.\n* Constant propagation: If there is column=constant, replace all column\n instances with this constant.\n* Replace all columns from \'const\' tables with their values.\n* Remove the used key columns from the WHERE (as this will be tested as\n part of the key lookup).\n* Remove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\n* Replace columns with other columns that has identical values:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\n* Add extra conditions to detect impossible row conditions earlier. This\n happens mainly with OUTER JOIN where we in some cases add detection\n of NULL values in the WHERE (Part of \'Not exists\' optimization).\n This can cause an unexpected \'Using where\' in the Extra column.\n* For each table level we remove expressions that have already been tested when\n we read the previous row. Example: When joining tables t1 with t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we don\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know that this\n expression is true.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| const row not found | The table was a system table (a table with |\n| | should exactly one row), but no row was found. |\n+------------------------+---------------------------------------------------+\n| Distinct | If distinct optimization (remove duplicates) was |','','https://mariadb.com/kb/en/explain/');
-update help_topic set description = CONCAT(description, '\n| | used. This is marked only for the last table in |\n| | the SELECT. |\n+------------------------+---------------------------------------------------+\n| Full scan on NULL key | The table is a part of the sub query and if the |\n| | value that is used to match the sub query will |\n| | be NULL, we will do a full table scan. |\n+------------------------+---------------------------------------------------+\n| Impossible HAVING | The used HAVING clause is always false so the |\n| | SELECT will return no rows. |\n+------------------------+---------------------------------------------------+\n| Impossible WHERE | The used WHERE clause is always false so the |\n| noticed after reading | SELECT will return no rows. This case was |\n| const tables. | detected after we had read all \'const\' tables |\n| | and used the column values as constant in the |\n| | WHERE clause. For example: WHERE const_column=5 |\n| | and const_column had a value of 4. |\n+------------------------+---------------------------------------------------+\n| Impossible WHERE | The used WHERE clause is always false so the |\n| | SELECT will return no rows. For example: WHERE |\n| | 1=2 |\n+------------------------+---------------------------------------------------+\n| No matching min/max | During early optimization of MIN()/MAX() values |\n| row | it was detected that no row could match the |\n| | WHERE clause. The MIN()/MAX() function will |\n| | return NULL. |\n+------------------------+---------------------------------------------------+\n| no matching row in | The table was a const table (a table with only |\n| const table | one possible matching row), but no row was found. |\n+------------------------+---------------------------------------------------+\n| No tables used | The SELECT was a sub query that did not use any |\n| | tables. For example a there was no FROM clause |\n| | or a FROM DUAL clause. |\n+------------------------+---------------------------------------------------+\n| Not exists | Stop searching after more row if we find one |\n| | single matching row. This optimization is used |\n| | with LEFT JOIN where one is explicitly searching |\n| | for rows that doesn\'t exists in the LEFT JOIN |\n| | TABLE. Example: SELECT * FROM t1 LEFT JOIN t2 on |\n| | (...) WHERE t2.not_null_column IS NULL. As |\n| | t2.not_null_column can only be NULL if there was |\n| | no matching row for on condition, we can stop |\n| | searching if we find a single matching row. |\n+------------------------+---------------------------------------------------+\n| Open_frm_only | For information_schema tables. Only the frm |\n| | (table definition file was opened) was opened |\n| | for each matching row. |\n+------------------------+---------------------------------------------------+\n| Open_full_table | For information_schema tables. A full table open |\n| | for each matching row is done to retrieve the |\n| | requested information. (Slow) |\n+------------------------+---------------------------------------------------+\n| Open_trigger_only | For information_schema tables. Only the trigger |\n| | file definition was opened for each matching row. |\n+------------------------+---------------------------------------------------+\n| Range checked for | This only happens when there was no good default |\n| each record (index | index to use but there may some index that could |\n| map: ...) | be used when we can treat all columns from |\n| | previous table as constants. For each row |\n| | combination the optimizer will decide which |\n| | index to use (if any) to fetch a row from this |\n| | table. This is not fast, but faster than a full |\n| | table scan that is the only other choice. The |\n| | index map is a bitmask that shows which index |\n| | are considered for each row condition. |\n+------------------------+---------------------------------------------------+\n| Scanned 0/1/all | For information_schema tables. Shows how many |\n| databases | times we had to do a directory scan. |\n+------------------------+---------------------------------------------------+\n| Select tables | All tables in the join was optimized away. This |\n| optimized away | happens when we are only using COUNT(*), MIN() |\n| | and MAX() functions in the SELECT and we where |\n| | able to replace all of these with constants. |\n+------------------------+---------------------------------------------------+\n| Skip_open_table | For information_schema tables. The queried table |\n| | didn\'t need to be opened. |\n+------------------------+---------------------------------------------------+\n| unique row not found | The table was detected to be a const table (a |\n| | table with only one possible matching row) |\n| | during the early optimization phase, but no row |\n| | was found. |\n+------------------------+---------------------------------------------------+\n| Using filesort | Filesort is needed to resolve the query. This |\n| | means an extra phase where we first collect all |\n| | columns to sort, sort them with a disk based |\n| | merge sort and then use the sorted set to |\n| | retrieve the rows in sorted order. If the column |\n| | set is small, we store all the columns in the |\n| | sort file to not have to go to the database to |\n| | retrieve them again. |\n+------------------------+---------------------------------------------------+\n| Using index | Only the index is used to retrieve the needed |\n| | information from the table. There is no need to |\n| | perform an extra seek to retrieve the actual |\n| | record. |\n+------------------------+---------------------------------------------------+\n| Using index condition | Like \'Using where\' but the where condition is |\n| | pushed down to the table engine for internal |\n| | optimization at the index level. |\n+------------------------+---------------------------------------------------+\n| Using index | Like \'Using index condition\' but in addition we |\n| condition(BKA) | use batch key access to retrieve rows. |\n+------------------------+---------------------------------------------------+\n| Using index for | The index is being used to resolve a GROUP BY or |\n| group-by | DISTINCT query. The rows are not read. This is |\n| | very efficient if the table has a lot of |\n| | identical index entries as duplicates are |\n| | quickly jumped over. |\n+------------------------+---------------------------------------------------+\n| Using intersect(...) | For index_merge joins. Shows which index are |\n| | part of the intersect. |\n+------------------------+---------------------------------------------------+\n| Using join buffer | We store previous row combinations in a row |\n| | buffer to be able to match each row against all |\n| | of the rows combinations in the join buffer at |\n| | one go. |\n+------------------------+---------------------------------------------------+\n| Using sort_union(...) | For index_merge joins. Shows which index are |\n| | part of the union. |\n+------------------------+---------------------------------------------------+\n| Using temporary | A temporary table is created to hold the result. |\n| | This typically happens if you are using GROUP |\n| | BY, DISTINCT or ORDER BY. |\n+------------------------+---------------------------------------------------+\n| Using where | A WHERE expression (in additional to the |\n| | possible key lookup) is used to check if the row |\n| | should be accepted. If you don\'t have \'Using |\n| | where\' together with a join type of ALL, you are |\n| | probably doing something wrong! |\n+------------------------+---------------------------------------------------+\n| Using where with | Like \'Using where\' but the where condition is |\n| pushed condition | pushed down to the table engine for internal |\n| | optimization at the row level. |\n+------------------------+---------------------------------------------------+\n| Using buffer | The UPDATE statement will first buffer the rows, |\n| | and then run the updates, rather than do updates |\n| | on the fly. See Using Buffer UPDATE Algorithm |\n| | for a detailed explanation. |\n+------------------------+---------------------------------------------------+\n\nEXPLAIN EXTENDED\n----------------\n\nThe EXTENDED keyword adds another column, filtered, to the output. This is a\npercentage estimate of the table rows that will be filtered by the condition.\n\nAn EXPLAIN EXTENDED will always throw a warning, as it adds extra Message\ninformation to a subsequent SHOW WARNINGS statement. This includes what the\nSELECT query would look like after optimizing and rewriting rules are applied\nand how the optimizer qualifies columns and tables.\n\nExamples\n--------\n\nAs synonym for DESCRIBE or SHOW COLUMNS FROM:\n\nDESCRIBE city;\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 poor 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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example;\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\n------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name \n | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |\nIndex_comment |\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\n------------+\n| employees_example | 0 | PRIMARY | 1 | id \n | A | 7 | NULL | NULL | | BTREE | |\n |\n| employees_example | 0 | employee_code | 1 |\nemployee_code | A | 7 | NULL | NULL | | BTREE \n | | |\n| employees_example | 1 | first_name | 1 | first_name \n | A | NULL | NULL | NULL | | BTREE | |\n |') WHERE help_topic_id = 466;
-update help_topic set description = CONCAT(description, '\n| employees_example | 1 | first_name | 2 | last_name \n | A | NULL | NULL | NULL | | BTREE | |\n |\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\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-----+-------+------+-------+\n| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY | 4\n | const | 1 | |\n+------+-------------+-------------------+-------+---------------+---------+---\n-----+-------+------+-------+\n\nThe type is const, which means that only one possible result could be\nreturned. Now, returning the same record but searching by their phone number:\n\nEXPLAIN SELECT * FROM employees_example WHERE home_phone=\'326-555-3492\';\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL \n | NULL | 6 | Using where |\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n\nHere, the type is All, which means no index could be used. Looking at the rows\ncount, a full table scan (all six rows) had to be performed in order to\nretrieve the record. If it\'s a requirement to search by phone number, an index\nwill have to be created.\n\nSHOW EXPLAIN example:\n\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len | ref |\nrows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL |\n1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nExample of ref_or_null Optimization\n-----------------------------------\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 subqueries with NOT\nIN as then one has to do an extra check for NULL values if the first value\ndidn\'t have a matching row.\n\nURL: https://mariadb.com/kb/en/explain/') WHERE help_topic_id = 466;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,28,'EXPLAIN ANALYZE','The syntax for the EXPLAIN ANALYZE feature was changed to ANALYZE statement,\navailable since MariaDB 10.1.0. See ANALYZE statement.\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 (468,28,'EXPLAIN FORMAT=JSON','Synopsis\n--------\n\nEXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in\nJSON form. The output always has one row which has only one column titled\n\"JSON\". The contents are a JSON representation of the query plan, formatted\nfor readability:\n\nEXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\\G\n\n*************************** 1. row ***************************\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------------------------------\n\nThe output of MariaDB\'s EXPLAIN FORMAT=JSON is different from EXPLAIN\nFORMAT=JSON in MySQL.The reasons for that are:\n\n* MySQL\'s output has deficiencies. Some are listed here: EXPLAIN FORMAT=JSON\nin MySQL\n* The output of MySQL\'s EXPLAIN FORMAT=JSON is not defined. Even MySQL\nWorkbench has trouble parsing it (see this blog post).\n* MariaDB has query optimizations that MySQL does not have. Ergo, MariaDB\ngenerates query plans that MySQL does not generate.\n\nA (as yet incomplete) list of how MariaDB\'s output is different from MySQL can\nbe found here: EXPLAIN FORMAT=JSON differences from MySQL.\n\nOutput Format\n-------------\n\nTODO: MariaDB\'s output format description.\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 (469,28,'DESCRIBE','Syntax\n------\n\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDescription\n-----------\n\nDESCRIBE provides information about the columns in a table. It is a shortcut\nfor SHOW COLUMNS FROM. These statements also display information for views.\n\ncol_name can be a column name, or a string containing the SQL \"%\" and \"_\"\nwildcard characters to obtain output only for the columns with names matching\nthe string. There is no need to enclose the string within quotes unless it\ncontains spaces or other special characters.\n\nDESCRIBE city;\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 more information about the output\ncolumns.\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 (470,29,'Identifier Names','Databases, tables, indexes, columns, aliases, views, stored routines,\ntriggers, events, variables, partitions, tablespaces, savepoints, labels,\nusers, roles, are collectively known as identifiers, and have certain rules\nfor naming.\n\nIdentifiers may be quoted using the backtick character - `. Quoting is\noptional for identifiers that don\'t contain special characters, or for\nidentifiers that are not reserved words. If the ANSI_QUOTES SQL_MODE flag is\nset, double quotes (\") can also be used to quote identifiers. If the MSSQL\nflag is set, square brackets ([ and ]) can be used for quoting.\n\nEven when using reserved words as names, fully qualified names do not need to\nbe quoted. For example, test.select has only one possible meaning, so it is\ncorrectly parsed even without quotes.\n\nUnquoted\n--------\n\nThe following characters are valid, and allow identifiers to be unquoted:\n\n* ASCII: [0-9,a-z,A-Z$_] (numerals 0-9, basic Latin letters, both lowercase\nand uppercase, dollar sign, underscore)\n* Extended: U+0080 .. U+FFFF\n\nQuoted\n------\n\nThe following characters are valid, but identifiers using them must be quoted:\n\n* ASCII: U+0001 .. U+007F (full Unicode Basic Multilingual Plane (BMP) except\nfor U+0000)\n* Extended: U+0080 .. U+FFFF \n* Identifier quotes can themselves be used as part of an identifier, as long\nas they are quoted.\n\nFurther Rules\n-------------\n\nThere are a number of other rules for identifiers:\n\n* Identifiers are stored as Unicode (UTF-8)\n* Identifiers may or may not be case-sensitive. See Indentifier\nCase-sensitivity.\n* Database, table and column names can\'t end with space characters\n* Identifier names may begin with a numeral, but can\'t only contain numerals\nunless quoted.\n* An identifier starting with a numeral, followed by an \'e\', may be parsed as\na floating point number, and needs to be quoted.\n* Identifiers are not permitted to contain the ASCII NUL character (U+0000)\nand supplementary characters (U+10000 and higher).\n* Names such as 5e6, 9e are not prohibited, but it\'s strongly recommended not\nto use them, as they could lead to ambiguity in certain contexts, being\ntreated as a number or expression.\n* User variables cannot be used as part of an identifier, or as an identifier\nin an SQL statement.\n\nQuote Character\n---------------\n\nThe regular quote character is the backtick character - `, but if the\nANSI_QUOTES SQL_MODE option is specified, a regular double quote - \" may be\nused as well.\n\nThe backtick character can be used as part of an identifier. In that case the\nidentifier needs to be quoted. The quote character can be the backtick, but in\nthat case, the backtick in the name must be escaped with another backtick.\n\nMaximum Length\n--------------\n\n* Databases, tables, columns, indexes, constraints, stored routines, triggers,\nevents, views, tablespaces, servers and log file groups have a maximum length\nof 64 characters.\n* Compound statement labels have a maximum length of 16 characters\n* Aliases have a maximum length of 256 characters, except for column aliases\nin CREATE VIEW statements, which are checked against the maximum column length\nof 64 characters (not the maximum alias length of 256 characters).\n* Users have a maximum length of 80 characters.\n* Roles have a maximum length of 128 characters.\n* Multi-byte characters do not count extra towards towards the character limit.\n\nMultiple Identifiers\n--------------------\n\nMariaDB allows the column name to be used on its own if the reference will be\nunambiguous, or the table name to be used with the column name, or all three\nof the database, table and column names. A period is used to separate the\nidentifiers, and the period can be surrounded by spaces.\n\nExamples\n--------\n\nUsing the period to separate identifiers:\n\nCREATE TABLE t1 (i int);\n\nINSERT INTO t1(i) VALUES (10);\n\nSELECT i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT test.t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nThe period can be separated by spaces:\n\nSELECT test . t1 . i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nResolving ambiguity:\n\nCREATE TABLE t2 (i int);\n\nSELECT i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\nERROR 1052 (23000): Column \'i\' in field list is ambiguous\n\nSELECT t1.i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nCreating a table with characters that require quoting:\n\nCREATE TABLE 123% (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'123% (i int)\' at line 1\n\nCREATE TABLE `123%` (i int);\nQuery OK, 0 rows affected (0.85 sec)\n\nCREATE TABLE `TABLE` (i int);\nQuery OK, 0 rows affected (0.36 sec)\n\nUsing double quotes as a quoting character:\n\nCREATE TABLE \"SELECT\" (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'\"SELECT\" (i int)\' at line 1\n\nSET sql_mode=\'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.03 sec)\n\nCREATE TABLE \"SELECT\" (i int);\nQuery OK, 0 rows affected (0.46 sec)\n\nUsing an identifier quote as part of an identifier name:\n\nSHOW VARIABLES LIKE \'sql_mode\';\n+---------------+-------------+\n| Variable_name | Value |\n+---------------+-------------+\n| sql_mode | ANSI_QUOTES |\n+---------------+-------------+\n\nCREATE TABLE \"fg`d\" (i int);\nQuery OK, 0 rows affected (0.34 sec)\n\nCreating the table named * (Unicode number: U+002A) requires quoting.\n\nCREATE TABLE `*` (a INT);\n\nFloating point ambiguity:\n\nCREATE TABLE 8984444cce5d (x INT);\nQuery OK, 0 rows affected (0.38 sec)\n\nCREATE TABLE 8981e56cce5d (x INT);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'8981e56cce5d (x INT)\' at line 1\n\nCREATE TABLE `8981e56cce5d` (x INT);\nQuery OK, 0 rows affected (0.39 sec)\n\nURL: https://mariadb.com/kb/en/identifier-names/','','https://mariadb.com/kb/en/identifier-names/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (471,29,'Identifier Case-sensitivity','Whether objects are case-sensitive or not is partly determined by the\nunderlying operating system. Unix-based systems are case-sensitive, Windows is\nnot, while Mac OS X is usually case-insensitive by default, but devices can be\nconfigured as case-sensitive using Disk Utility.\n\nDatabase, table, table aliases and trigger names are affected by the systems\ncase-sensitivity, while index, column, column aliases, stored routine and\nevent names are never case sensitive.\n\nLog file group name are case sensitive.\n\nThe lower_case_table_names server system variable plays a key role. It\ndetermines whether table names, aliases and database names are compared in a\ncase-sensitive manner. If set to 0 (the default on Unix-based systems), table\nnames and aliases and database names are compared in a case-sensitive manner.\nIf set to 1 (the default on Windows), names are stored in lowercase and not\ncompared in a case-sensitive manner. If set to 2 (the default on Mac OS X),\nnames are stored as declared, but compared in lowercase.\n\nIt is thus possible to make Unix-based systems behave like Windows and ignore\ncase-sensitivity, but the reverse is not true, as the underlying Windows\nfilesystem can not support this.\n\nEven on case-insensitive systems, you are required to use the same case\nconsistently within the same statement. The following statement fails, as it\nrefers to the table name in a different case.\n\nSELECT * FROM a_table WHERE A_table.id>10;\n\nFor a full list of identifier naming rules, see Identifier Names.\n\nPlease note that lower_case_table_names is a database initialization\nparameter. This means that, along with innodb_page_size, this variable must be\nset before running mysql_install_db, and will not change the behavior of\nservers unless applied before the creation of core system databases.\n\nURL: https://mariadb.com/kb/en/identifier-case-sensitivity/','','https://mariadb.com/kb/en/identifier-case-sensitivity/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,29,'Binary Literals','Binary literals can be written in one of the following formats: b\'value\',\nB\'value\' or 0bvalue, where value is a string composed by 0 and 1 digits.\n\nBinary literals are interpreted as binary strings, and are convenient to\nrepresent VARBINARY, BINARY or BIT values.\n\nTo convert a binary literal into an integer, just add 0.\n\nExamples\n--------\n\nPrinting the value as a binary string:\n\nSELECT 0b1000001;\n+-----------+\n| 0b1000001 |\n+-----------+\n| A |\n+-----------+\n\nConverting the same value into a number:\n\nSELECT 0b1000001+0;\n+-------------+\n| 0b1000001+0 |\n+-------------+\n| 65 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/binary-literals/','','https://mariadb.com/kb/en/binary-literals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,29,'Boolean Literals','In MariaDB, FALSE is a synonym of 0 and TRUE is a synonym of 1. These\nconstants are case insensitive, so TRUE, True, and true are equivalent.\n\nThese terms are not synonyms of 0 and 1 when used with the IS operator. So,\nfor example, 10 IS TRUE returns 1, while 10 = TRUE returns 0 (because 1 != 10).\n\nThe IS operator accepts a third constant exists: UNKNOWN. It is always a\nsynonym of NULL.\n\nTRUE and FALSE are reserved words, while UNKNOWN is not.\n\nURL: https://mariadb.com/kb/en/sql-language-structure-boolean-literals/','','https://mariadb.com/kb/en/sql-language-structure-boolean-literals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,29,'Date and Time Literals','Standard syntaxes\n-----------------\n\nMariaDB supports the SQL standard and ODBC syntaxes for DATE, TIME and\nTIMESTAMP literals.\n\nSQL standard syntax:\n\n* DATE \'string\'\n* TIME \'string\'\n* TIMESTAMP \'string\'\n\nODBC syntax:\n\n* {d \'string\'}\n* {t \'string\'}\n* {ts \'string\'}\n\nThe timestamp literals are treated as DATETIME literals, because in MariaDB\nthe range of DATETIME is closer to the TIMESTAMP range in the SQL standard.\n\nstring is a string in a proper format, as explained below.\n\nDATE literals\n-------------\n\nA DATE string is a string in one of the following formats: \'YYYY-MM-DD\' or\n\'YY-MM-DD\'. Note that any punctuation character can be used as delimiter. All\ndelimiters must consist of 1 character. Different delimiters can be used in\nthe same string. Delimiters are optional (but if one delimiter is used, all\ndelimiters must be used).\n\nA DATE literal can also be an integer, in one of the following formats:\nYYYYMMDD or YYMMDD.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'19940101\'\n\'940101\'\n\'1994-01-01\'\n\'94/01/01\'\n\'1994-01/01\'\n\'94:01!01\'\n19940101\n940101\n\nDATETIME literals\n-----------------\n\nA DATETIME string is a string in one of the following formats: \'YYYY-MM-DD\nHH:MM:SS\' or \'YY-MM-DD HH:MM:SS\'. Note that any punctuation character can be\nused as delimiter for the date part and for the time part. All delimiters must\nconsist of 1 character. Different delimiters can be used in the same string.\nThe hours, minutes and seconds parts can consist of one character. For this\nreason, delimiters are mandatory for DATETIME literals.\n\nThe delimiter between the date part and the time part can be a T or any\nsequence of space characters (including tabs, new lines and carriage returns).\n\nA DATETIME literal can also be a number, in one of the following formats:\nYYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD. In this case, all the time\nsubparts must consist of 2 digits.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'1994-01-01T12:30:03\'\n\'1994/01/01\\n\\t 12+30+03\'\n\'1994/01\\\\01\\n\\t 12+30-03\'\n\'1994-01-01 12:30:3\'\n\nTIME literals\n-------------\n\nA TIME string is a string in one of the following formats: \'D HH:MM:SS\',\n\'HH:MM:SS, \'D HH:MM\', \'HH:MM\', \'D HH\', or \'SS\'. D is a value from 0 to 34\nwhich represents days. : is the only allowed delimiter for TIME literals.\nDelimiters are mandatory, with an exception: the \'HHMMSS\' format is allowed.\nWhen delimiters are used, each part of the literal can consist of one\ncharacter.\n\nA TIME literal can also be a number in one of the following formats: HHMMSS,\nMMSS, or SS.\n\nThe following literals are equivalent:\n\n\'09:05:00\'\n\'9:05:0\'\n\'9:5:0\'\n\'090500\'\n\n2-digit years\n-------------\n\nThe year part in DATE and DATETIME literals is determined as follows:\n\n* 70 - 99 = 1970 - 1999\n* 00 - 69 = 2000 - 2069\n\nMicroseconds\n------------\n\nDATETIME and TIME literals can have an optional microseconds part. For both\nstring and numeric forms, it is expressed as a decimal part. Up to 6 decimal\ndigits are allowed. Examples:\n\n\'12:30:00.123456\'\n123000.123456\n\nSee Microseconds in MariaDB for details.\n\nDate and time literals and the SQL_MODE\n---------------------------------------\n\nUnless the SQL_MODE NO_ZERO_DATE flag is set, some special values are allowed:\nthe \'0000-00-00\' DATE, the \'00:00:00\' TIME, and the 0000-00-00 00:00:00\nDATETIME.\n\nIf the ALLOW_INVALID_DATES flag is set, the invalid dates (for example, 30th\nFebruary) are allowed. If not, if the NO_ZERO_DATE is set, an error is\nproduced; otherwise, a zero-date is returned.\n\nUnless the NO_ZERO_IN_DATE flag is set, each subpart of a date or time value\n(years, hours...) can be set to 0.\n\nURL: https://mariadb.com/kb/en/date-and-time-literals/','','https://mariadb.com/kb/en/date-and-time-literals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,29,'Hexadecimal Literals','Hexadecimal literals can be written using any of the following syntaxes:\n\n* x\'value\'\n* X\'value\' (SQL standard)\n* 0xvalue (ODBC)\n\nvalue is a sequence of hexadecimal digits (from 0 to 9 and from A to F). The\ncase of the digits does not matter. With the first two syntaxes, value must\nconsist of an even number of digits. With the last syntax, digits can be even,\nand they are treated as if they had an extra 0 at the beginning.\n\nNormally, hexadecimal literals are interpreted as binary string, where each\npair of digits represents a character. When used in a numeric context, they\nare interpreted as integers. (See the example below). In no case can a\nhexadecimal literal be a decimal number.\n\nThe first two syntaxes; X\'value\' and x\'value, follow the SQL standard, and\nbehave as a string in all contexts in MariaDB since MariaDB 10.0.3 and MariaDB\n5.5.31 (fixing MDEV-4489). The latter syntax, 0xvalue, is a MySQL/MariaDB\nextension for hex hybrids and behaves as a string or as a number depending on\ncontext. MySQL treats all syntaxes the same, so there may be different results\nin MariaDB and MySQL (see below).\n\nExamples\n--------\n\nRepresenting the a character with the three syntaxes explained above:\n\nSELECT x\'61\', X\'61\', 0x61;\n+-------+-------+------+\n| x\'61\' | X\'61\' | 0x61 |\n+-------+-------+------+\n| a | a | a |\n+-------+-------+------+\n\nHexadecimal literals in a numeric context:\n\nSELECT 0 + 0xF, -0xF;\n+---------+------+\n| 0 + 0xF | -0xF |\n+---------+------+\n| 15 | -15 |\n+---------+------+\n\nFun with Types\n--------------\n\nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31), COALESCE(0x61));\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n\nThe reason for the differing results above is that when 0x31 is inserted\ndirectly to the column, it\'s treated as a number, while when 0x31 is passed to\nCOALESCE(), it\'s treated as a string, because:\n\n* HEX values have a string data type by default.\n* COALESCE() has the same data type as the argument.\n\nDifferences Between MariaDB and MySQL\n-------------------------------------\n\nSELECT x\'0a\'+0;\n+---------+\n| x\'0a\'+0 |\n+---------+\n| 0 |\n+---------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect DOUBLE value: \'\\x0A\'\n\nSELECT X\'0a\'+0;\n+---------+\n| X\'0a\'+0 |\n+---------+\n| 0 |\n+---------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect DOUBLE value: \'\\x0A\'\n\nSELECT 0x0a+0;\n+--------+\n| 0x0a+0 |\n+--------+\n| 10 |\n+--------+\n\nIn MySQL (up until at least MySQL 8.0.26):\n\nSELECT x\'0a\'+0;\n+---------+\n| x\'0a\'+0 |\n+---------+\n| 10 |\n+---------+\n\nSELECT X\'0a\'+0;\n+---------+\n| X\'0a\'+0 |\n+---------+\n| 10 |\n+---------+\n\nSELECT 0x0a+0;\n+--------+\n| 0x0a+0 |\n+--------+\n| 10 |\n+--------+\n\nURL: https://mariadb.com/kb/en/hexadecimal-literals/','','https://mariadb.com/kb/en/hexadecimal-literals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,29,'Identifier Qualifiers','Qualifiers are used within SQL statements to reference data structures, such\nas databases, tables, or columns. For example, typically a SELECT query\ncontains references to some columns and at least one table.\n\nQualifiers can be composed by one or more identifiers, where the initial parts\naffect the context within which the final identifier is interpreted:\n\n* For a database, only the database identifier needs to be specified.\n* For objects which are contained in a database (like tables, views,\nfunctions, etc) the database identifier can be specified. If no database is\nspecified, the current database is assumed (see USE and DATABASE() for more\ndetails). If there is no default database and no database is specified, an\nerror is issued.\n* For column names, the table and the database are generally obvious from the\ncontext of the statement. It is however possible to specify the table\nidentifier, or the database identifier plus the table identifier.\n* An identifier is fully-qualified if it contains all possible qualifiers, for\nexample, the following column is fully qualified: db_name.tbl_name.col_name.\n\nIf a qualifier is composed by more than one identifier, a dot (.) must be used\nas a separator. All identifiers can be quoted individually. Extra spacing\n(including new lines and tabs) is allowed.\n\nAll the following examples are valid:\n\n* db_name.tbl_name.col_name\n* tbl_name\n* `db_name`.`tbl_name`.`col_name`\n* `db_name` . `tbl_name`\n* db_name. tbl_name\n\nIf a table identifier is prefixed with a dot (.), the default database is\nassumed. This syntax is supported for ODBC compliance, but has no practical\neffect on MariaDB. These qualifiers are equivalent:\n\n* tbl_name\n* . tbl_name\n* .`tbl_name`\n* . `tbl_name`\n\nFor DML statements, it is possible to specify a list of the partitions using\nthe PARTITION clause. See Partition Pruning and Selection for details.\n\nURL: https://mariadb.com/kb/en/identifier-qualifiers/','','https://mariadb.com/kb/en/identifier-qualifiers/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,29,'Identifier to File Name Mapping','Some identifiers map to a file name on the filesystem. Databases each have\ntheir own directory, while, depending on the storage engine, table names and\nindex names may map to a file name.\n\nNot all characters that are allowed in table names can be used in file names.\nEvery filesystem has its own rules of what characters can be used in file\nnames. To let the user create tables using all characters allowed in the SQL\nStandard and to not depend on whatever particular filesystem a particular\ndatabase resides, MariaDB encodes \"potentially unsafe\" characters in the table\nname to derive the corresponding file name.\n\nThis is implemented using a special character set. MariaDB converts a table\nname to the \"filename\" character set to get the file name for this table. And\nit converts the file name from the \"filename\" character set to, for example,\nutf8 to get the table name for this file name.\n\nThe conversion rules are as follows: if the identifier is made up only of\nbasic Latin numbers, letters and/or the underscore character, the encoding\nmatches the name (see however Identifier Case Sensitivity). Otherwise they are\nencoded according to the following table:\n\n+-----------------+------------+-----------+--------+-----------+-----------+\n| Code Range | Pattern | Number | Used | Unused | Blocks |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 00C0..017F | [@][0..4][ | 5*20= 100 | 97 | 3 | Latin-1 |\n| | ..z] | | | | Supplemen |\n| | | | | | + Latin |\n| | | | | | Extended- |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0370..03FF | [@][5..9][ | 5*20= 100 | 88 | 12 | Greek |\n| | ..z] | | | | and |\n| | | | | | Coptic |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0400..052F | [@][g..z][ | 20*7= 140 | 137 | 3 | Cyrillic |\n| | ..6] | | | | + |\n| | | | | | Cyrillic |\n| | | | | | Supplemen |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0530..058F | [@][g..z][ | 20*2= 40 | 38 | 2 | Armenian |\n| | ..8] | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 2160..217F | [@][g..z][ | 20*1= 20 | 16 | 4 | Number |\n| | ] | | | | Forms |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0180..02AF | [@][g..z][ | 20*11=220 | 203 | 17 | Latin |\n| | ..k] | | | | Extended- |\n| | | | | | + IPA |\n| | | | | | Extension |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 1E00..1EFF | [@][g..z][ | 20*7= 140 | 136 | 4 | Latin |\n| | ..r] | | | | Extended |\n| | | | | | Additiona |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 1F00..1FFF | [@][g..z][ | 20*8= 160 | 144 | 16 | Greek |\n| | ..z] | | | | Extended |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| .... .... | [@][a..f][ | 6*20= 120 | 0 | 120 | RESERVED |\n| | ..z] | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 24B6..24E9 | [@][@][a.. | 26 | 26 | 0 | Enclosed |\n| | ] | | | | Alphanume |\n| | | | | | ics |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| FF21..FF5A | [@][a..z][ | 26 | 26 | 0 | Halfwidth |\n| | ] | | | | and |\n| | | | | | Fullwidth |\n| | | | | | forms |\n+-----------------+------------+-----------+--------+-----------+-----------+\n\nCode Range values are UCS-2.\n\nAll of this encoding happens transparently at the filesystem level with one\nexception. Until MySQL 5.1.6, an old encoding was used. Identifiers created in\na version before MySQL 5.1.6, and which haven\'t been updated to the new\nencoding, the server prefixes mysql50 to their name.\n\nExamples\n--------\n\nFind the file name for a table with a non-Latin1 name:\n\nselect cast(convert(\"this_is_таблица\" USING filename) as binary);\n+------------------------------------------------------------------+\n| cast(convert(\"this_is_таблица\" USING filename) as binary) |\n+------------------------------------------------------------------+\n| this_is_@y0@g0@h0@r0@o0@i1@g0 |\n+------------------------------------------------------------------+\n\nFind the table name for a file name:\n\nselect convert(_filename \"this_is_@y0@g0@h0@r0@o0@i1@g0\" USING utf8);\n+---------------------------------------------------------------+\n| convert(_filename \"this_is_@y0@g0@h0@r0@o0@i1@g0\" USING utf8) |\n+---------------------------------------------------------------+\n| this_is_таблица |\n+---------------------------------------------------------------+\n\nAn old table created before MySQL 5.1.6, with the old encoding:\n\nSHOW TABLES;\n+--------------------+\n| Tables_in_test |\n+--------------------+\n| #mysql50#table@1 |\n+--------------------+\n\nThe prefix needs to be supplied to reference this table:\n\nSHOW COLUMNS FROM `table@1`;\nERROR 1146 (42S02): Table \'test.table@1\' doesn\'t exist\n\nSHOW COLUMNS FROM `#mysql50#table@1`;\n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| i | int(11) | YES | | NULL | |\n+-------+---------+------+-----+---------+-------+\n\nURL: https://mariadb.com/kb/en/identifier-to-file-name-mapping/','','https://mariadb.com/kb/en/identifier-to-file-name-mapping/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,29,'Numeric Literals','Numeric literals are written as a sequence of digits from 0 to 9. Initial\nzeros are ignored. A sign can always precede the digits, but it is optional\nfor positive numbers. In decimal numbers, the integer part and the decimal\npart are divided with a dot (.).\n\nIf the integer part is zero, it can be omitted, but the literal must begin\nwith a dot.\n\nThe notation with exponent can be used. The exponent is preceded by an E or e\ncharacter. The exponent can be preceded by a sign and must be an integer. A\nnumber N with an exponent part X, is calculated as N * POW(10, X).\n\nIn some cases, adding zeroes at the end of a decimal number can increment the\nprecision of the expression where the number is used. For example, PI() by\ndefault returns a number with 6 decimal digits. But the PI()+0.0000000000\nexpression (with 10 zeroes) returns a number with 10 decimal digits.\n\nHexadecimal literals are interpreted as numbers when used in numeric contexts.\n\nExamples\n--------\n\n10\n+10\n-10\n\nAll these literals are equivalent:\n\n0.1\n.1\n+0.1\n+.1\n\nWith exponents:\n\n0.2E3 -- 0.2 * POW(10, 3) = 200\n.2e3\n.2e+2\n1.1e-10 -- 0.00000000011\n-1.1e10 -- -11000000000\n\nURL: https://mariadb.com/kb/en/numeric-iterals/','','https://mariadb.com/kb/en/numeric-iterals/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,29,'Reserved Words','The following is a list of all reserved words in MariaDB.\n\nReserved words cannot be used as Identifiers, unless they are quoted.\n\nThe definitive list of reserved words for each version can be found by\nexamining the sql/lex.h and sql/sql_yacc.yy files.\n\nReserved Words\n--------------\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| ACCESSIBLE | |\n+--------------------------------------------+--------------------------------+\n| ADD | |\n+--------------------------------------------+--------------------------------+\n| ALL | |\n+--------------------------------------------+--------------------------------+\n| ALTER | |\n+--------------------------------------------+--------------------------------+\n| ANALYZE | |\n+--------------------------------------------+--------------------------------+\n| AND | |\n+--------------------------------------------+--------------------------------+\n| AS | |\n+--------------------------------------------+--------------------------------+\n| ASC | |\n+--------------------------------------------+--------------------------------+\n| ASENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| BEFORE | |\n+--------------------------------------------+--------------------------------+\n| BETWEEN | |\n+--------------------------------------------+--------------------------------+\n| BIGINT | |\n+--------------------------------------------+--------------------------------+\n| BINARY | |\n+--------------------------------------------+--------------------------------+\n| BLOB | |\n+--------------------------------------------+--------------------------------+\n| BOTH | |\n+--------------------------------------------+--------------------------------+\n| BY | |\n+--------------------------------------------+--------------------------------+\n| CALL | |\n+--------------------------------------------+--------------------------------+\n| CASCADE | |\n+--------------------------------------------+--------------------------------+\n| CASE | |\n+--------------------------------------------+--------------------------------+\n| CHANGE | |\n+--------------------------------------------+--------------------------------+\n| CHAR | |\n+--------------------------------------------+--------------------------------+\n| CHARACTER | |\n+--------------------------------------------+--------------------------------+\n| CHECK | |\n+--------------------------------------------+--------------------------------+\n| COLLATE | |\n+--------------------------------------------+--------------------------------+\n| COLUMN | |\n+--------------------------------------------+--------------------------------+\n| CONDITION | |\n+--------------------------------------------+--------------------------------+\n| CONSTRAINT | |\n+--------------------------------------------+--------------------------------+\n| CONTINUE | |\n+--------------------------------------------+--------------------------------+\n| CONVERT | |\n+--------------------------------------------+--------------------------------+\n| CREATE | |\n+--------------------------------------------+--------------------------------+\n| CROSS | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_DATE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_ROLE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIME | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_USER | |\n+--------------------------------------------+--------------------------------+\n| CURSOR | |\n+--------------------------------------------+--------------------------------+\n| DATABASE | |\n+--------------------------------------------+--------------------------------+\n| DATABASES | |\n+--------------------------------------------+--------------------------------+\n| DAY_HOUR | |\n+--------------------------------------------+--------------------------------+\n| DAY_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| DAY_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| DAY_SECOND | |\n+--------------------------------------------+--------------------------------+\n| DEC | |\n+--------------------------------------------+--------------------------------+\n| DECIMAL | |\n+--------------------------------------------+--------------------------------+\n| DECLARE | |\n+--------------------------------------------+--------------------------------+\n| DEFAULT | |\n+--------------------------------------------+--------------------------------+\n| DELAYED | |\n+--------------------------------------------+--------------------------------+\n| DELETE | |\n+--------------------------------------------+--------------------------------+\n| DELETE_DOMAIN_ID | |\n+--------------------------------------------+--------------------------------+\n| DESC | |\n+--------------------------------------------+--------------------------------+\n| DESCRIBE | |\n+--------------------------------------------+--------------------------------+\n| DETERMINISTIC | |\n+--------------------------------------------+--------------------------------+\n| DISTINCT | |\n+--------------------------------------------+--------------------------------+\n| DISTINCTROW | |\n+--------------------------------------------+--------------------------------+\n| DIV | |\n+--------------------------------------------+--------------------------------+\n| DO_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| DOUBLE | |\n+--------------------------------------------+--------------------------------+\n| DROP | |\n+--------------------------------------------+--------------------------------+\n| DUAL | |\n+--------------------------------------------+--------------------------------+\n| EACH | |\n+--------------------------------------------+--------------------------------+\n| ELSE | |\n+--------------------------------------------+--------------------------------+\n| ELSEIF | |\n+--------------------------------------------+--------------------------------+\n| ENCLOSED | |\n+--------------------------------------------+--------------------------------+\n| ESCAPED | |\n+--------------------------------------------+--------------------------------+\n| EXCEPT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| EXISTS | |\n+--------------------------------------------+--------------------------------+\n| EXIT | |\n+--------------------------------------------+--------------------------------+\n| EXPLAIN | |\n+--------------------------------------------+--------------------------------+\n| FALSE | |\n+--------------------------------------------+--------------------------------+\n| FETCH | |\n+--------------------------------------------+--------------------------------+\n| FLOAT | |\n+--------------------------------------------+--------------------------------+\n| FLOAT4 | |\n+--------------------------------------------+--------------------------------+\n| FLOAT8 | |\n+--------------------------------------------+--------------------------------+\n| FOR | |\n+--------------------------------------------+--------------------------------+\n| FORCE | |\n+--------------------------------------------+--------------------------------+\n| FOREIGN | |\n+--------------------------------------------+--------------------------------+\n| FROM | |\n+--------------------------------------------+--------------------------------+\n| FULLTEXT | |\n+--------------------------------------------+--------------------------------+\n| GENERAL | |\n+--------------------------------------------+--------------------------------+\n| GRANT | |\n+--------------------------------------------+--------------------------------+\n| GROUP | |\n+--------------------------------------------+--------------------------------+\n| HAVING | |\n+--------------------------------------------+--------------------------------+\n| HIGH_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| HOUR_SECOND | |','','https://mariadb.com/kb/en/reserved-words/');
-update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| IF | |\n+--------------------------------------------+--------------------------------+\n| IGNORE | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_SERVER_IDS | |\n+--------------------------------------------+--------------------------------+\n| IN | |\n+--------------------------------------------+--------------------------------+\n| INDEX | |\n+--------------------------------------------+--------------------------------+\n| INFILE | |\n+--------------------------------------------+--------------------------------+\n| INNER | |\n+--------------------------------------------+--------------------------------+\n| INOUT | |\n+--------------------------------------------+--------------------------------+\n| INSENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| INSERT | |\n+--------------------------------------------+--------------------------------+\n| INT | |\n+--------------------------------------------+--------------------------------+\n| INT1 | |\n+--------------------------------------------+--------------------------------+\n| INT2 | |\n+--------------------------------------------+--------------------------------+\n| INT3 | |\n+--------------------------------------------+--------------------------------+\n| INT4 | |\n+--------------------------------------------+--------------------------------+\n| INT8 | |\n+--------------------------------------------+--------------------------------+\n| INTEGER | |\n+--------------------------------------------+--------------------------------+\n| INTERSECT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| INTERVAL | |\n+--------------------------------------------+--------------------------------+\n| INTO | |\n+--------------------------------------------+--------------------------------+\n| IS | |\n+--------------------------------------------+--------------------------------+\n| ITERATE | |\n+--------------------------------------------+--------------------------------+\n| JOIN | |\n+--------------------------------------------+--------------------------------+\n| KEY | |\n+--------------------------------------------+--------------------------------+\n| KEYS | |\n+--------------------------------------------+--------------------------------+\n| KILL | |\n+--------------------------------------------+--------------------------------+\n| LEADING | |\n+--------------------------------------------+--------------------------------+\n| LEAVE | |\n+--------------------------------------------+--------------------------------+\n| LEFT | |\n+--------------------------------------------+--------------------------------+\n| LIKE | |\n+--------------------------------------------+--------------------------------+\n| LIMIT | |\n+--------------------------------------------+--------------------------------+\n| LINEAR | |\n+--------------------------------------------+--------------------------------+\n| LINES | |\n+--------------------------------------------+--------------------------------+\n| LOAD | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIME | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| LOCK | |\n+--------------------------------------------+--------------------------------+\n| LONG | |\n+--------------------------------------------+--------------------------------+\n| LONGBLOB | |\n+--------------------------------------------+--------------------------------+\n| LONGTEXT | |\n+--------------------------------------------+--------------------------------+\n| LOOP | |\n+--------------------------------------------+--------------------------------+\n| LOW_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| MASTER_HEARTBEAT_PERIOD | |\n+--------------------------------------------+--------------------------------+\n| MASTER_SSL_VERIFY_SERVER_CERT | |\n+--------------------------------------------+--------------------------------+\n| MATCH | |\n+--------------------------------------------+--------------------------------+\n| MAXVALUE | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMBLOB | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMINT | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMTEXT | |\n+--------------------------------------------+--------------------------------+\n| MIDDLEINT | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_SECOND | |\n+--------------------------------------------+--------------------------------+\n| MOD | |\n+--------------------------------------------+--------------------------------+\n| MODIFIES | |\n+--------------------------------------------+--------------------------------+\n| NATURAL | |\n+--------------------------------------------+--------------------------------+\n| NOT | |\n+--------------------------------------------+--------------------------------+\n| NO_WRITE_TO_BINLOG | |\n+--------------------------------------------+--------------------------------+\n| NULL | |\n+--------------------------------------------+--------------------------------+\n| NUMERIC | |\n+--------------------------------------------+--------------------------------+\n| OFFSET | Added in MariaDB 10.6.0 |\n+--------------------------------------------+--------------------------------+\n| ON | |\n+--------------------------------------------+--------------------------------+\n| OPTIMIZE | |\n+--------------------------------------------+--------------------------------+\n| OPTION | |\n+--------------------------------------------+--------------------------------+\n| OPTIONALLY | |\n+--------------------------------------------+--------------------------------+\n| OR | |\n+--------------------------------------------+--------------------------------+\n| ORDER | |\n+--------------------------------------------+--------------------------------+\n| OUT | |\n+--------------------------------------------+--------------------------------+\n| OUTER | |\n+--------------------------------------------+--------------------------------+\n| OUTFILE | |\n+--------------------------------------------+--------------------------------+\n| OVER | |\n+--------------------------------------------+--------------------------------+\n| PAGE_CHECKSUM | |\n+--------------------------------------------+--------------------------------+\n| PARSE_VCOL_EXPR | |\n+--------------------------------------------+--------------------------------+\n| PARTITION | |\n+--------------------------------------------+--------------------------------+\n| POSITION | |\n+--------------------------------------------+--------------------------------+\n| PRECISION | |\n+--------------------------------------------+--------------------------------+\n| PRIMARY | |\n+--------------------------------------------+--------------------------------+\n| PROCEDURE | |\n+--------------------------------------------+--------------------------------+\n| PURGE | |\n+--------------------------------------------+--------------------------------+\n| RANGE | |\n+--------------------------------------------+--------------------------------+\n| READ | |\n+--------------------------------------------+--------------------------------+\n| READS | |\n+--------------------------------------------+--------------------------------+\n| READ_WRITE | |\n+--------------------------------------------+--------------------------------+\n| REAL | |\n+--------------------------------------------+--------------------------------+\n| RECURSIVE | |\n+--------------------------------------------+--------------------------------+\n| REF_SYSTEM_ID | |\n+--------------------------------------------+--------------------------------+\n| REFERENCES | |\n+--------------------------------------------+--------------------------------+\n| REGEXP | |\n+--------------------------------------------+--------------------------------+\n| RELEASE | |\n+--------------------------------------------+--------------------------------+\n| RENAME | |') WHERE help_topic_id = 479;
-update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| REPEAT | |\n+--------------------------------------------+--------------------------------+\n| REPLACE | |\n+--------------------------------------------+--------------------------------+\n| REQUIRE | |\n+--------------------------------------------+--------------------------------+\n| RESIGNAL | |\n+--------------------------------------------+--------------------------------+\n| RESTRICT | |\n+--------------------------------------------+--------------------------------+\n| RETURN | |\n+--------------------------------------------+--------------------------------+\n| RETURNING | |\n+--------------------------------------------+--------------------------------+\n| REVOKE | |\n+--------------------------------------------+--------------------------------+\n| RIGHT | |\n+--------------------------------------------+--------------------------------+\n| RLIKE | |\n+--------------------------------------------+--------------------------------+\n| ROWS | |\n+--------------------------------------------+--------------------------------+\n| SCHEMA | |\n+--------------------------------------------+--------------------------------+\n| SCHEMAS | |\n+--------------------------------------------+--------------------------------+\n| SECOND_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| SELECT | |\n+--------------------------------------------+--------------------------------+\n| SENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| SEPARATOR | |\n+--------------------------------------------+--------------------------------+\n| SET | |\n+--------------------------------------------+--------------------------------+\n| SHOW | |\n+--------------------------------------------+--------------------------------+\n| SIGNAL | |\n+--------------------------------------------+--------------------------------+\n| SLOW | |\n+--------------------------------------------+--------------------------------+\n| SMALLINT | |\n+--------------------------------------------+--------------------------------+\n| SPATIAL | |\n+--------------------------------------------+--------------------------------+\n| SPECIFIC | |\n+--------------------------------------------+--------------------------------+\n| SQL | |\n+--------------------------------------------+--------------------------------+\n| SQLEXCEPTION | |\n+--------------------------------------------+--------------------------------+\n| SQLSTATE | |\n+--------------------------------------------+--------------------------------+\n| SQLWARNING | |\n+--------------------------------------------+--------------------------------+\n| SQL_BIG_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SQL_CALC_FOUND_ROWS | |\n+--------------------------------------------+--------------------------------+\n| SQL_SMALL_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SSL | |\n+--------------------------------------------+--------------------------------+\n| STARTING | |\n+--------------------------------------------+--------------------------------+\n| STATS_AUTO_RECALC | |\n+--------------------------------------------+--------------------------------+\n| STATS_PERSISTENT | |\n+--------------------------------------------+--------------------------------+\n| STATS_SAMPLE_PAGES | |\n+--------------------------------------------+--------------------------------+\n| STRAIGHT_JOIN | |\n+--------------------------------------------+--------------------------------+\n| TABLE | |\n+--------------------------------------------+--------------------------------+\n| TERMINATED | |\n+--------------------------------------------+--------------------------------+\n| THEN | |\n+--------------------------------------------+--------------------------------+\n| TINYBLOB | |\n+--------------------------------------------+--------------------------------+\n| TINYINT | |\n+--------------------------------------------+--------------------------------+\n| TINYTEXT | |\n+--------------------------------------------+--------------------------------+\n| TO | |\n+--------------------------------------------+--------------------------------+\n| TRAILING | |\n+--------------------------------------------+--------------------------------+\n| TRIGGER | |\n+--------------------------------------------+--------------------------------+\n| TRUE | |\n+--------------------------------------------+--------------------------------+\n| UNDO | |\n+--------------------------------------------+--------------------------------+\n| UNION | |\n+--------------------------------------------+--------------------------------+\n| UNIQUE | |\n+--------------------------------------------+--------------------------------+\n| UNLOCK | |\n+--------------------------------------------+--------------------------------+\n| UNSIGNED | |\n+--------------------------------------------+--------------------------------+\n| UPDATE | |\n+--------------------------------------------+--------------------------------+\n| USAGE | |\n+--------------------------------------------+--------------------------------+\n| USE | |\n+--------------------------------------------+--------------------------------+\n| USING | |\n+--------------------------------------------+--------------------------------+\n| UTC_DATE | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIME | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| VALUES | |\n+--------------------------------------------+--------------------------------+\n| VARBINARY | |\n+--------------------------------------------+--------------------------------+\n| VARCHAR | |\n+--------------------------------------------+--------------------------------+\n| VARCHARACTER | |\n+--------------------------------------------+--------------------------------+\n| VARYING | |\n+--------------------------------------------+--------------------------------+\n| WHEN | |\n+--------------------------------------------+--------------------------------+\n| WHERE | |\n+--------------------------------------------+--------------------------------+\n| WHILE | |\n+--------------------------------------------+--------------------------------+\n| WINDOW | Only disallowed for table |\n| | aliases. |\n+--------------------------------------------+--------------------------------+\n| WITH | |\n+--------------------------------------------+--------------------------------+\n| WRITE | |\n+--------------------------------------------+--------------------------------+\n| XOR | |\n+--------------------------------------------+--------------------------------+\n| YEAR_MONTH | |\n+--------------------------------------------+--------------------------------+\n| ZEROFILL | |\n+--------------------------------------------+--------------------------------+\n\nExceptions\n----------\n\nSome keywords are exceptions for historical reasons, and are permitted as\nunquoted identifiers. These include:\n\n+-----------------------------------------------------------------------------+\n| Keyword |\n+-----------------------------------------------------------------------------+\n| ACTION |\n+-----------------------------------------------------------------------------+\n| BIT |\n+-----------------------------------------------------------------------------+\n| DATE |\n+-----------------------------------------------------------------------------+\n| ENUM |\n+-----------------------------------------------------------------------------+\n| NO |\n+-----------------------------------------------------------------------------+\n| TEXT |\n+-----------------------------------------------------------------------------+\n| TIME |\n+-----------------------------------------------------------------------------+\n| TIMESTAMP |\n+-----------------------------------------------------------------------------+\n\nOracle Mode\n-----------\n\nIn Oracle mode, from MariaDB 10.3, there are a number of extra reserved words:\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| BODY | |\n+--------------------------------------------+--------------------------------+\n| ELSIF | |\n+--------------------------------------------+--------------------------------+\n| GOTO | |\n+--------------------------------------------+--------------------------------+\n| HISTORY | <= MariaDB 10.3.6 only |') WHERE help_topic_id = 479;
-update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| MINUS | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| OTHERS | |\n+--------------------------------------------+--------------------------------+\n| PACKAGE | |\n+--------------------------------------------+--------------------------------+\n| PERIOD | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| RAISE | |\n+--------------------------------------------+--------------------------------+\n| ROWNUM | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| ROWTYPE | |\n+--------------------------------------------+--------------------------------+\n| SYSDATE | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| SYSTEM | <= MariaDB 10.3.6 only. Note |\n| | however that SYSTEM sometimes |\n| | needs to be quoted to avoid |\n| | confusion with |\n| | System-versioned tables. |\n+--------------------------------------------+--------------------------------+\n| SYSTEM_TIME | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| VERSIONING | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| WITHOUT | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n\nFunction Names\n--------------\n\nIf the IGNORE_SPACE SQL_MODE flag is set, function names become reserved words.\n\nURL: https://mariadb.com/kb/en/reserved-words/') WHERE help_topic_id = 479;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,29,'String Literals','Strings are sequences of characters and are enclosed with quotes.\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 quotes (the same\ncharacter must be used to both open and close the string).\n\nThe ANSI SQL-standard does not permit double quotes for enclosing strings, and\nalthough MariaDB does by default, if the MariaDB server has enabled the\nANSI_QUOTES_SQL SQL_MODE, double quotes will be treated as being used for\nidentifiers instead of strings.\n\nStrings that are next to each other are automatically concatenated. For\nexample:\n\n\'The \' \'MariaDB \' \'Foundation\'\n\nand\n\n\'The MariaDB Foundation\'\n\nare equivalent.\n\nThe \\ (backslash character) is used to escape characters (unless the SQL_MODE\nhasn\'t been set to NO_BACKSLASH_ESCAPES). For example:\n\n\'MariaDB\'s new features\'\n\nis not a valid string because of the single quote in the middle of the string,\nwhich is treated as if it closes the string, but is actually meant as part of\nthe string, an apostrophe. 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 the 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 twice:\n\nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n\nEscape Sequences\n----------------\n\nThere are other escape sequences also. Here is a full list:\n\n+-----------------------------------------------+-----------------------------+\n| Escape 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 |\n| | note following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\\\ | Backslash (\"\\\"). |\n+-----------------------------------------------+-----------------------------+\n| \\% | \"%\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\_ | A \"_\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n\nEscaping the % and _ characters can be necessary when using the LIKE operator,\nwhich treats them as special characters.\n\nThe ASCII 26 character (\\Z) needs to be escaped when included in a batch file\nwhich needs to be executed in Windows. The reason is that ASCII 26, in\nWindows, is the end of file (EOF).\n\nBackslash (\\), if not used as an escape character, must always be escaped.\nWhen followed by a character that is not in the above table, backslashes will\nsimply be ignored.\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 (481,29,'Table Value Constructors','MariaDB starting with 10.3.3\n----------------------------\nTable Value Constructors were introduced in MariaDB 10.3.3\n\nSyntax\n------\n\nVALUES ( row_value[, row_value...]), (...)...\n\nDescription\n-----------\n\nIn Unions, Views, and sub-queries, a Table Value Constructor (TVC) allows you\nto inject arbitrary values into the result-set. The given values must have the\nsame number of columns as the result-set, otherwise it returns Error 1222.\n\nExamples\n--------\n\nUsing TVC\'s with UNION operations:\n\nCREATE TABLE test.t1 (val1 INT, val2 INT);\nINSERT INTO test.t1 VALUES(5, 8), (3, 4), (1, 2);\n\nSELECT * FROM test.t1\nUNION\nVALUES (70, 90), (100, 110);\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 5 | 8 | \n| 3 | 4 |\n| 1 | 2 |\n| 70 | 90 |\n| 100 | 110 |\n+------+------+\n\nUsing TVC\'s with a CREATE VIEW statement:\n\nCREATE VIEW v1 AS VALUES (7, 9), (9, 10);\n\nSELECT * FROM v1;\n+---+----+\n| 7 | 9 |\n+---+----+\n| 7 | 9 |\n| 9 | 10 |\n+---+----+\n\nUsing TVC with an ORDER BY clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nORDER BY val1 DESC;\n\nUsing TVC with LIMIT clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nLIMIT 2 OFFSET 4;\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 30 | 40 | \n| 50 | 60 |\n+------+------+\n\nURL: https://mariadb.com/kb/en/table-value-constructors/','','https://mariadb.com/kb/en/table-value-constructors/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,29,'User-Defined Variables','User-defined variables are variables which can be created by the user and\nexist in the session. This means that no one can access user-defined variables\nthat have been set by another user, and when the session is closed these\nvariables expire. However, these variables can be shared between several\nqueries and stored programs.\n\nUser-defined variables names must be preceded by a single at character (@).\nWhile it is safe to use a reserved word as a user-variable name, the only\nallowed characters are ASCII letters, digits, dollar sign ($), underscore (_)\nand dot (.). If other characters are used, the name can be quoted in one of\nthe following ways:\n\n* @`var_name`\n* @\'var_name\'\n* @\"var_name\"\n\nThese characters can be escaped as usual.\n\nUser-variables names are case insensitive, though they were case sensitive in\nMySQL 4.1 and older versions.\n\nUser-defined variables cannot be declared. They can be read even if no value\nhas been set yet; in that case, they are NULL. To set a value for a\nuser-defined variable you can use:\n\n* SET statement;\n* := operator within a SQL statement;\n* SELECT ... INTO.\n\nSince user-defined variables type cannot be declared, the only way to force\ntheir type is using CAST() or CONVERT():\n\nSET @str = CAST(123 AS CHAR(5));\n\nIf a variable has not been used yet, its value is NULL:\n\nSELECT @x IS NULL;\n+------------+\n| @x IS NULL |\n+------------+\n| 1 |\n+------------+\n\nIt is unsafe to read a user-defined variable and set its value in the same\nstatement (unless the command is SET), because the order of these actions is\nundefined.\n\nUser-defined variables can be used in most MariaDB\'s statements and clauses\nwhich accept an SQL expression. However there are some exceptions, like the\nLIMIT clause.\n\nThey must be used to PREPARE a prepared statement:\n\n@sql = \'DELETE FROM my_table WHERE c>1;\';\nPREPARE stmt FROM @sql;\nEXECUTE stmt;\nDEALLOCATE PREPARE stmt;\n\nAnother common use is to include a counter in a query:\n\nSET @var = 0;\nSELECT a, b, c, (@var:=@var+1) AS counter FROM my_table;\n\nInformation Schema\n------------------\n\nUser-defined variables can be viewed in the Information Schema USER_VARIABLES\nTable (as part of the User Variables plugin) from MariaDB 10.2.\n\nFlushing User-Defined Variables\n-------------------------------\n\nUser-defined variables are reset and the Information Schema table emptied with\nthe FLUSH USER_VARIABLES statement.\n\nSET @str = CAST(123 AS CHAR(5));\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\n+---------------+----------------+---------------+--------------------+\n| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |\n+---------------+----------------+---------------+--------------------+\n| str | 123 | VARCHAR | utf8mb3 |\n+---------------+----------------+---------------+--------------------+\n\nFLUSH USER_VARIABLES;\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\nEmpty set (0.000 sec)\n\nURL: https://mariadb.com/kb/en/user-defined-variables/','','https://mariadb.com/kb/en/user-defined-variables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,29,'Delimiters','The default delimiter in the mysql client (from MariaDB 10.4.6, also called\nmariadb) is the semicolon.\n\nWhen creating stored programs from the command-line, it is likely you will\nneed to differentiate between the regular delimiter and a delimiter inside a\nBEGIN END block. To understand better, consider the following example:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND;\n\nIf you enter the above line by line, the mysql client will treat the first\nsemicolon, at the end of the DECLARE x TINYINT line, as the end of the\nstatement. Since that\'s only a partial definition, it will throw a syntax\nerror, as follows:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\nDECLARE x TINYINT;\nERROR 1064 (42000): You have an error in your SQL syntax; \ncheck the manual that corresponds to your MariaDB server version\n for the right syntax to use near \'\' at line 3\n\nThe solution is to specify a distinct delimiter for the duration of the\nprocess, using the DELIMITER command. The delimiter can be any set of\ncharacters you choose, but it needs to be a distinctive set of characters that\nwon\'t cause further confusion. // is a common choice, and used throughout the\nknowledgebase.\n\nHere\'s how the function could be successfully entered from the mysql client\nwith the new delimiter.\n\nDELIMITER //\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND\n\n//\n\nDELIMITER ;\n\nAt the end, the delimiter is restored to the default semicolon. The \\g and \\G\ndelimiters can always be used, even when a custom delimiter is specified.\n\nURL: https://mariadb.com/kb/en/delimiters/','','https://mariadb.com/kb/en/delimiters/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,29,'SQL_MODE=ORACLE','From MariaDB 10.3, setting the sql_mode system variable to Oracle allows the\nserver to understand a subset of Oracle\'s PL/SQL language. For example:\n\nSET SQL_MODE=\'ORACLE\';\n\nAll traditional MariaDB SQL/PSM syntax should work as before, as long as it\ndoes not conflict with Oracle\'s PL/SQL syntax. All MariaDB functions should be\nsupported in both normal and Oracle modes.\n\nPrior to MariaDB 10.3, MariaDB does not support Oracle\'s PL/SQL language, and\nSET SQL_MODE=ORACLE is only an alias for the following sql_mode in those\nversions:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER\';\n\nFrom MariaDB 10.3, SET SQL_MODE=ORACLE is same as:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT\';\n\nSupported Syntax in Oracle Mode\n-------------------------------\n\nStored Procedures and Stored Functions\n--------------------------------------\n\nOracle mode makes the following changes to Stored Procedures and Stored\nFunctions:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (param OUT INT) | ANSI uses (OUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (a IN OUT INT) | ANSI uses (INOUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| AS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | AS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| IS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | IS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| If function has no parameters then | Example: CREATE PROCEDURE p1 AS |\n| parentheses must be omitted | BEGIN NULL; END; |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS BEGIN END p1; | Optional routine name after END |\n| | keyword. MDEV-12089 |\n+-----------------------------------------+-----------------------------------+\n| CREATE FUNCTION f1(a VARCHAR) | VARCHAR can be used without |\n| | length for routine parameters |\n| | and RETURN clause. The length is |\n| | inherited from the argument at |\n| | call time. MDEV-10596 |\n+-----------------------------------------+-----------------------------------+\n| CREATE AGGREGATE FUNCTION f1( ) | Creates an aggregate function, |\n| | which performs the function |\n| | against a set of rows and |\n| | returns one aggregate result. |\n+-----------------------------------------+-----------------------------------+\n| No CALL needed in Stored Procedures | In Oracle mode one can call |\n| | other stored procedures with |\n| | name only. MDEV-12107 |\n+-----------------------------------------+-----------------------------------+\n| RETURN. Can also be used in stored | ANSI uses RETURNS. MariaDB mode |\n| procedures | only supports RETURNS in stored |\n| | functions |\n+-----------------------------------------+-----------------------------------+\n\nCursors\n-------\n\nOracle mode makes the following changes to Cursors:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS CURSOR cur IS | Explicit cursor with FOR loop. |\n| (SELECT a, b FROM t1); BEGIN FOR rec | MDEV-10581 |\n| IN cur ... | |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS rec IN (SELECT | Implicit cursor with FOR loop. |\n| a, b FROM t1) | MDEV-12098 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters. |\n| VARCHAR2) ... OPEN c(1,2) | MDEV-10597 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters and FOR |\n| VARCHAR2) ... FOR rec in c(1,2) | loop. MDEV-12314 |\n+-----------------------------------------+-----------------------------------+\n| s %ISOPEN, %ROWCOUNT, %FOUND, %NOTFOUND | Explicit cursor attributes. |\n| | MDEV-10582 |\n+-----------------------------------------+-----------------------------------+\n\nLOOP\n----\n\nOracle mode makes the following changes to LOOP:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| FOR i IN 1..10 LOOP ... END LOOP | Numeric FOR loop. MDEV-10580 |\n+-----------------------------------------+-----------------------------------+\n| GOTO | GOTO statement. MDEV-10697 |\n+-----------------------------------------+-----------------------------------+\n| <<label>> used with GOTO | ANSI uses label:. MDEV-10697 |\n+-----------------------------------------+-----------------------------------+\n| To leave loop block: EXIT [ label ] [ | ANSI syntax is IF bool_expr THEN |\n| WHEN bool_expr ] | LEAVE label |\n+-----------------------------------------+-----------------------------------+\n| [<<label>>] WHILE boolean_expression | Oracle style WHILE loop |\n| LOOP statement... END LOOP [ label ] ; | |\n+-----------------------------------------+-----------------------------------+\n| CONTINUE [ label ] [ WHEN | CONTINUE is only valid inside a |\n| boolean_expression] | loop |\n+-----------------------------------------+-----------------------------------+\n\nVariables\n---------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| var:= 10; Can also be used | 10.3 | MariaDB uses SET var= |\n| with MariaDB systemvariables | | 10; |\n+------------------------------+-----------------+--------------------------+\n| var INT := 10 | 10.3 | Default variable value |\n+------------------------------+-----------------+--------------------------+\n| var1 | 10.3 | Take data type from a |\n| table_name.column_name%TYPE | | table column. MDEV-10577 |\n+------------------------------+-----------------+--------------------------+\n| var2 var1%TYPE | 10.3 | Take data type from |\n| | | another variable |\n+------------------------------+-----------------+--------------------------+\n| rec1 table_name%ROWTYPE | 10.3 | Take ROW structure from |\n| | | a table. MDEV-12133 |\n+------------------------------+-----------------+--------------------------+\n| rec2 rec1%ROWTYPE | 10.3 | Take ROW structure from |\n| | | ROW variable |\n+------------------------------+-----------------+--------------------------+\n| CURSOR c1 IS SELECT a,b | 10.3 | Take ROW structure from |\n| FROM t1; rec1 c1%ROWTYPE; | | a cursor. MDEV-12011 |\n+------------------------------+-----------------+--------------------------+\n| Variables can be declared | 10.3 | In MariaDB mode, |\n| after cursor declarations | | variables must be |\n| | | declared before |\n| | | cursors. MDEV-10598 |\n+------------------------------+-----------------+--------------------------+\n| Triggers uses :NEW and :OLD | 10.3 | ANSI uses NEW and OLD. |\n| | | MDEV-10579 |\n+------------------------------+-----------------+--------------------------+\n| SQLCODE | 10.3 | Returns the number code |\n| | | of the most recent |\n| | | exception. Can only be |\n| | | used in Stored |\n| | | Procedures. MDEV-10578 |\n+------------------------------+-----------------+--------------------------+\n| SQLERRM | 10.3 | Returns the error |\n| | | message associdated to |\n| | | it\'s error number |\n| | | argument or SQLCODE if |\n| | | no argument is given. |\n| | | Can only be used in |\n| | | Stored Procedures. |\n| | | MDEV-10578 |\n+------------------------------+-----------------+--------------------------+\n| SQL%ROWCOUNT | 10.3 | Almost same as |\n| | | ROW_COUNT(). MDEV-10583 |\n+------------------------------+-----------------+--------------------------+\n| ROWNUM | 10.6.1 | Returns number of |\n| | | accepted rows |\n+------------------------------+-----------------+--------------------------+\n\nExceptions\n----------\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| BEGIN ... EXCEPTION WHEN OTHERS THEN | Exception handlers are declared |\n| BEGIN .. END; END; | at the end of a block |\n+-----------------------------------------+-----------------------------------+\n| TOO_MANY_ROWS, NO_DATA_FOUND, | Predefined exceptions. MDEV-10839 |\n| DUP_VAL_ON_INDEX | |\n+-----------------------------------------+-----------------------------------+\n| RAISE TOO_MANY_ROWS ; .... EXCEPTION | Exception can be used with RAISE |\n| WHEN TOO_MANY_ROWS THEN ... | and EXCEPTION...WHEN. MDEV-10840 |\n+-----------------------------------------+-----------------------------------+\n| CREATE OR REPLACE FUNCTION f1 (a INT) | User defined exceptions. |\n| RETURN INT AS e1 EXCEPTION... | MDEV-10587 |\n+-----------------------------------------+-----------------------------------+\n\nBEGIN Blocks\n------------\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| BEGIN to start a block | MariaDB uses BEGIN NOT ATOMIC |\n| | for anyonymous blocks. MDEV-10655 |\n+-----------------------------------------+-----------------------------------+\n| DECLARE is used before BEGIN | DECLARE a INT; b VARCHAR(10); |\n| | BEGIN v:= 10; END; |\n+-----------------------------------------+-----------------------------------+\n| WHEN DUP_VAL_ON_INDEX THEN NULL ; | Do not require BEGIN..END in |\n| NULL; WHEN OTHERS THEN NULL | multi-statement exception |\n| | handlers in THEN clause. |\n| | MDEV-12088 |\n+-----------------------------------------+-----------------------------------+\n\nSimple Syntax Compatibility\n---------------------------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| ELSIF | 10.3 | ANSI uses ELSEIF |\n+------------------------------+-----------------+--------------------------+\n| SELECT UNIQUE | 10.3 | Same as SELECT |\n| | | DISTINCT. MDEV-12086 |','','https://mariadb.com/kb/en/sql_modeoracle/');
-update help_topic set description = CONCAT(description, '\n+------------------------------+-----------------+--------------------------+\n| TRUNCATE TABLE t1 [DROP | 10.3 | DROP STORAGE and REUSE |\n| STORAGE] or [REUSE STORAGE] | | STORAGE are allowed as |\n| | | optional keywords for |\n| | | TRUNCATE TABLE. |\n| | | MDEV-10588 |\n+------------------------------+-----------------+--------------------------+\n| Subqueries in a FROM clause | 10.6 | SELECT * FROM (SELECT 1 |\n| without an alias | | FROM DUAL), (SELECT 2 |\n| | | FROM DUAL) |\n+------------------------------+-----------------+--------------------------+\n| UNION, EXCEPT and INTERSECT | 10.3 | INTERSECT has higher |\n| all have the same | | precedence than UNION |\n| precedence. | | and EXCEPT in |\n| | | non-Oracle modes. |\n+------------------------------+-----------------+--------------------------+\n| MINUS | 10.6 | MINUS is a synonym for |\n| | | EXCEPT. |\n+------------------------------+-----------------+--------------------------+\n\nFunctions\n---------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| ADD_MONTHS() | 10.6.1 | Added as a wrapper for |\n| | | DATE_ADD() to enhance |\n| | | Oracle compatibility. |\n| | | All modes. |\n+------------------------------+-----------------+--------------------------+\n| CAST(expr as VARCHAR(N)) | 10.3 | Cast expression to a |\n| | | VARCHAR(N). MDEV-11275 |\n+------------------------------+-----------------+--------------------------+\n| DECODE | 10.3 | In Oracle mode, |\n| | | compares and matches |\n| | | search expressions |\n+------------------------------+-----------------+--------------------------+\n| LENGTH() is same as | 10.3 | MariaDB translates |\n| CHAR_LENGTH() | | LENGTH() to |\n| | | OCTET_LENGTH(). In all |\n| | | modes one can use |\n| | | LENGTHB() as a synonym |\n| | | to OCTET_LENGTH() |\n+------------------------------+-----------------+--------------------------+\n| CHR(num) | 10.3 | Returns a VARCHAR(1) |\n| | | with character set and |\n| | | collation according to |\n| | | @@character_set_database |\n| | | and @@collation_database |\n+------------------------------+-----------------+--------------------------+\n| substr(\'abc\',0 ,3) same as | 10.3 | Position 0 for substr() |\n| substr(\'abc\', 1 ,3) | | is same as position 1 |\n+------------------------------+-----------------+--------------------------+\n| SYS_GUID | 10.6.1 | Generates a globally |\n| | | unique identifier. |\n| | | Similar to UUID but |\n| | | without the -. All |\n| | | modes. |\n+------------------------------+-----------------+--------------------------+\n| TO_CHAR | 10.6.1 | Added to enhance Oracle |\n| | | compatibility. All |\n| | | modes. |\n+------------------------------+-----------------+--------------------------+\n| TRIM, LTRIM, RTRIM, LPAD | 10.3 | Returns NULL instead of |\n| and RPAD | | an empty string if |\n| | | returning an empty |\n| | | result. These functions |\n| | | can also be accessed |\n| | | outside of ORACLE mode |\n| | | by suffixing _ORACLE |\n| | | onto the end of the |\n| | | function name, such as |\n| | | TRIM_ORACLE. |\n+------------------------------+-----------------+--------------------------+\n\nPrepared Statements\n-------------------\n\nOracle mode makes the following changes to Prepared Statements:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| PREPARE stmt FROM \'SELECT :1, :2\' | ANSI uses ?. MDEV-10801 |\n+-----------------------------------------+-----------------------------------+\n| EXECUTE IMMEDIATE \'INSERT INTO t1 | Dynamic placeholders. MDEV-10801 |\n| SELECT (:x,:y) FROM DUAL\' USING 10,20 | |\n+-----------------------------------------+-----------------------------------+\n\nSynonyms for Basic SQL Types\n----------------------------\n\n+--------------------------------+-------------------------------------------+\n| Oracle type | MariaDB synonym |\n+--------------------------------+-------------------------------------------+\n| VARCHAR2 | VARCHAR |\n+--------------------------------+-------------------------------------------+\n| NUMBER | DECIMAL |\n+--------------------------------+-------------------------------------------+\n| DATE (with time portion) | MariaDB DATETIME |\n+--------------------------------+-------------------------------------------+\n| RAW | VARBINARY |\n+--------------------------------+-------------------------------------------+\n| CLOB | LONGTEXT |\n+--------------------------------+-------------------------------------------+\n| BLOB | LONGBLOB |\n+--------------------------------+-------------------------------------------+\n\nThis was implemented as part of MDEV-10343.\n\nIf one does a SHOW CREATE TABLE in ORACLE mode on a table that has a native\nMariaDB DATE column, it will be displayed as mariadb_schema.date to not\nconflict with the Oracle DATE type.\n\nPackages\n--------\n\nThe following syntax has been supported since MariaDB 10.3.5:\n\n* CREATE PACKAGE\n* CREATE PACKAGE BODY\n* DROP PACKAGE\n* DROP PACKAGE BODY\n* SHOW CREATE PACKAGE\n* SHOW CREATE PACKAGE BODY\n\nNULL Handling\n-------------\n\nOracle mode makes the following changes to NULL handling:\n\nNULL As a Statement\n-------------------\n\nNULL can be used as a statement:\n\nIF a=10 THEN NULL; ELSE NULL; END IF\n\nTranslating Empty String Literals to NULL\n-----------------------------------------\n\nIn Oracle, empty string (\'\') and NULL are the same thing,\n\nBy using sql_mode=EMPTY_STRING_IS_NULL you can get a similar experience in\nMariaDB:\n\nSET sql_mode=EMPTY_STRING_IS_NULL;\nSELECT \'\' IS NULL; -- returns TRUE\nINSERT INTO t1 VALUES (\'\'); -- inserts NULL\n\nConcat Operator Ignores NULL\n----------------------------\n\nCONCAT() and || ignore NULL in Oracle mode. Can also be accessed outside of\nORACLE mode by using CONCAT_OPERATOR_ORACLE. MDEV-11880 and MDEV-12143.\n\nReserved Words\n--------------\n\nThere are a number of extra reserved words in Oracle mode.\n\nSHOW CREATE TABLE\n-----------------\n\nThe SHOW CREATE TABLE statement will not display MariaDB-specific table\noptions, such as AUTO_INCREMENT or CHARSET, when Oracle mode is set.\n\nURL: https://mariadb.com/kb/en/sql_modeoracle/') WHERE help_topic_id = 484;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,30,'CONTAINS','Syntax\n------\n\nContains(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2. CONTAINS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_CONTAINS() uses object shapes.\n\nThis tests the opposite relationship to Within().\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 (486,30,'CROSSES','Syntax\n------\n\nCrosses(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon or a\nMultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise, returns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nCROSSES() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_CROSSES() uses object shapes.\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 (487,30,'DISJOINT','Syntax\n------\n\nDisjoint(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does not\nintersect) g2.\n\nDISJOINT() tests the opposite relationship to INTERSECTS().\n\nDISJOINT() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_DISJOINT() uses object shapes.\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 (488,30,'EQUALS','Syntax\n------\n\nEquals(g1,g2)\n\nFrom MariaDB 10.2.3:\n\nMBREQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nEQUALS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_EQUALS() uses object shapes.\n\nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\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 (489,30,'INTERSECTS','Syntax\n------\n\nINTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nINTERSECTS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_INTERSECTS() uses object shapes.\n\nINTERSECTS() tests the opposite relationship to DISJOINT().\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 (490,30,'OVERLAPS','Syntax\n------\n\nOVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their intersection\nresults in a geometry of the same dimension but not equal to either of the\ngiven geometries.\n\nOVERLAPS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_OVERLAPS() uses object shapes.\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 (491,30,'ST_CONTAINS','Syntax\n------\n\nST_CONTAINS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2.\n\nST_CONTAINS() uses object shapes, while CONTAINS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (492,30,'ST_CROSSES','Syntax\n------\n\nST_CROSSES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if geometry g1 spatially crosses geometry g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nST_CROSSES() uses object shapes, while CROSSES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n\nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (493,30,'ST_DIFFERENCE','Syntax\n------\n\nST_DIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry representing the point set difference of the given geometry\nvalues.\n\nExample\n-------\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\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 (494,30,'ST_DISJOINT','Syntax\n------\n\nST_DISJOINT(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially disjoint from\n(does not intersect with) geometry g2.\n\nST_DISJOINT() uses object shapes, while DISJOINT(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_DISJOINT() tests the opposite relationship to ST_INTERSECTS().\n\nExamples\n--------\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\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 (495,30,'ST_DISTANCE','Syntax\n------\n\nST_DISTANCE(g1,g2)\n\nDescription\n-----------\n\nReturns the distance between two geometries, or null if not given valid inputs.\n\nExample\n-------\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\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 (496,30,'ST_DISTANCE_SPHERE','MariaDB starting with 10.2.38\n-----------------------------\nST_DISTANCE_SPHERE was introduced in MariaDB 10.2.38, MariaDB 10.3.29, MariaDB\n10.4.19 and MariaDB 10.5.10.\n\nSyntax\n------\n\nST_DISTANCE_SPHERE(g1,g2,[r])\n\nDescription\n-----------\n\nReturns the spherical distance between two geometries (point or multipoint) on\na sphere with the optional radius r (default is the Earth radius if r is not\nspecified), or NULL if not given valid inputs.\n\nExample\n-------\n\nset @zenica = ST_GeomFromText(\'POINT(17.907743 44.203438)\');\nset @sarajevo = ST_GeomFromText(\'POINT(18.413076 43.856258)\');\nSELECT ST_Distance_Sphere(@zenica, @sarajevo);\n55878.59337591705\n\nURL: https://mariadb.com/kb/en/st_distance_sphere/','','https://mariadb.com/kb/en/st_distance_sphere/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (497,30,'ST_EQUALS','Syntax\n------\n\nST_EQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially equal to geometry\ng2.\n\nST_EQUALS() uses object shapes, while EQUALS(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\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\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 (498,30,'ST_INTERSECTS','Syntax\n------\n\nST_INTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nST_INTERSECTS() uses object shapes, while INTERSECTS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_INTERSECTS() tests the opposite relationship to ST_DISJOINT().\n\nExamples\n--------\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\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 (499,30,'ST_LENGTH','Syntax\n------\n\nST_LENGTH(ls)\n\nDescription\n-----------\n\nReturns as a double-precision number the length of the LineString value ls in\nits associated spatial reference.\n\nExamples\n--------\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\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 (500,30,'ST_OVERLAPS','Syntax\n------\n\nST_OVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially overlaps geometry g2.\n\nThe term spatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal to\neither of the given geometries.\n\nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on the original\nMySQL implementation, uses object bounding rectangles.\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 (501,30,'ST_TOUCHES','Syntax\n------\n\nST_TOUCHES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially touches geometry g2.\nTwo geometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either the\nboundary or the interior of the other.\n\nST_TOUCHES() uses object shapes, while TOUCHES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\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\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 (502,30,'ST_WITHIN','Syntax\n------\n\nST_WITHIN(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially within geometry g2.\n\nThis tests the opposite relationship as ST_CONTAINS().\n\nST_WITHIN() uses object shapes, while WITHIN(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n\nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (503,30,'TOUCHES','Syntax\n------\n\nTouches(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two geometries\nspatially touch if the interiors of the geometries do not intersect, but the\nboundary of one of the geometries intersects either the boundary or the\ninterior of the other.\n\nTOUCHES() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_TOUCHES() uses object shapes.\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 (504,30,'WITHIN','Syntax\n------\n\nWithin(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This tests the\nopposite relationship as Contains().\n\nWITHIN() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_WITHIN() uses object shapes.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT(\'POINT(174 149)\');\nSET @g2 = GEOMFROMTEXT(\'POINT(176 151)\');\nSET @g3 = GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 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\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 (505,31,'Microseconds in MariaDB','The TIME, DATETIME, and TIMESTAMP types, along with the temporal functions,\nCAST and dynamic columns, support microseconds. The datetime precision of a\ncolumn can be specified when creating the table with CREATE TABLE, for example:\n\nCREATE TABLE example(\n col_microsec DATETIME(6),\n col_millisec TIME(3)\n);\n\nGenerally, the precision can be specified for any TIME, DATETIME, or TIMESTAMP\ncolumn, in parentheses, after the type name. The datetime precision specifies\nnumber of digits after the decimal dot and can be any integer number from 0 to\n6. If no precision is specified it is assumed to be 0, for backward\ncompatibility reasons.\n\nA datetime precision can be specified wherever a type name is used. For\nexample:\n\n* when declaring arguments of stored routines.\n* when specifying a return type of a stored function.\n* when declaring variables.\n* in a CAST function:create function example(x datetime(5)) returns time(4)\nbegin\n declare y timestamp(6);\n return cast(x as time(2));\nend;\n\n%f is used as the formatting option for microseconds in the STR_TO_DATE,\nDATE_FORMAT and FROM_UNIXTIME functions, for example:\n\nSELECT STR_TO_DATE(\'20200809 020917076\',\'%Y%m%d %H%i%s%f\');\n+-----------------------------------------------------+\n| STR_TO_DATE(\'20200809 020917076\',\'%Y%m%d %H%i%s%f\') |\n+-----------------------------------------------------+\n| 2020-08-09 02:09:17.076000 |\n+-----------------------------------------------------+\n\nAdditional Information\n----------------------\n\n* when comparing anything to a temporal value (DATETIME, TIME, DATE, or\nTIMESTAMP), both values are compared as temporal values, not as strings.\n* The INFORMATION_SCHEMA.COLUMNS table has a new column DATETIME_PRECISION\n* NOW(), CURTIME(), UTC_TIMESTAMP(), UTC_TIME(), CURRENT_TIME(),\nCURRENT_TIMESTAMP(), LOCALTIME() and LOCALTIMESTAMP() now accept datetime\nprecision as an optional argument. For example:SELECT CURTIME(4);\n--> 10:11:12.3456\n\n* TIME_TO_SEC() and UNIX_TIMESTAMP() preserve microseconds of the argument.\nThese functions will return a decimal number if the result non-zero datetime\nprecision and an integer otherwise (for backward compatibility).SELECT\nTIME_TO_SEC(\'10:10:10.12345\');\n--> 36610.12345\n\n* Current versions of this patch fix a bug in the following optimization: in\n certain queries with DISTINCT MariaDB can ignore this clause if it can\n prove that all result rows are unique anyway, for example, when a primary key\n is compared with a constant. Sometimes this optimization was applied\n incorrectly, though — for example, when comparing a\n string with a date constant. This is now fixed.\n* DATE_ADD() and DATE_SUB() functions can now take a TIME\n expression as an argument (not just DATETIME as before).SELECT\nTIME(\'10:10:10\') + INTERVAL 100 MICROSECOND;\n--> 10:10:10.000100\n\n* The event_time field in the mysql.general_log table and the start_time,\nquery_time, and lock_time fields in the mysql.slow_log table now store values\nwith microsecond precision.\n* This patch fixed a bug when comparing a temporal value using the BETWEEN\noperator and one of the operands is NULL.\n* The old syntax TIMESTAMP(N), where N is the display width, is no longer\nsupported. It was deprecated in MySQL 4.1.0 (released on\n 2003-04-03).\n* when a DATETIME value is compared to a TIME value, the latter is treated as\na full datetime with a zero date part, similar to comparing DATE to a\nDATETIME, or to comparing DECIMAL numbers.\n Earlier versions of MariaDB used to compare only the time part of both\noperands in such a case.\n* In MariaDB, an extra column TIME_MS has been added to the\nINFORMATION_SCHEMA.PROCESSLIST table, as well as to the output of SHOW FULL\nPROCESSLIST.\n\nNote: When you convert a temporal value to a value with a smaller precision,\nit will be truncated, not rounded. This is done to guarantee that the date\npart is not changed. For example:\n\nSELECT CAST(\'2009-12-31 23:59:59.998877\' as DATETIME(3));\n-> 2009-12-31 23:59:59.998\n\nMySQL 5.6 Microseconds\n----------------------\n\nMySQL 5.6 introduced microseconds using a slightly different implementation to\nMariaDB 5.3. Since MariaDB 10.1, MariaDB has defaulted to the MySQL format, by\nmeans of the --mysql56-temporal-format variable. The MySQL version requires\nslightly more storage but has some advantages in permitting the eventual\nsupport of negative dates, and in replication.\n\nURL: https://mariadb.com/kb/en/microseconds-in-mariadb/','','https://mariadb.com/kb/en/microseconds-in-mariadb/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (506,31,'Date and Time Units','The INTERVAL keyword can be used to add or subtract a time interval of time to\na DATETIME, DATE or TIME value.\n\nThe syntax is:\n\nINTERVAL time_quantity time_unit\n\nFor example, the SECOND unit is used below by the DATE_ADD() function:\n\nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n+-------------------------------------------+\n| \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n\nThe following units are valid:\n\n+---------------------+------------------------------------------------------+\n| Unit | Description |\n+---------------------+------------------------------------------------------+\n| MICROSECOND | Microseconds |\n+---------------------+------------------------------------------------------+\n| SECOND | Seconds |\n+---------------------+------------------------------------------------------+\n| MINUTE | Minutes |\n+---------------------+------------------------------------------------------+\n| HOUR | Hours |\n+---------------------+------------------------------------------------------+\n| DAY | Days |\n+---------------------+------------------------------------------------------+\n| WEEK | Weeks |\n+---------------------+------------------------------------------------------+\n| MONTH | Months |\n+---------------------+------------------------------------------------------+\n| QUARTER | Quarters |\n+---------------------+------------------------------------------------------+\n| YEAR | Years |\n+---------------------+------------------------------------------------------+\n| SECOND_MICROSECOND | Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| MINUTE_MICROSECOND | Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| MINUTE_SECOND | Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| HOUR_MICROSECOND | Hours.Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| HOUR_SECOND | Hours.Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| HOUR_MINUTE | Hours.Minutes |\n+---------------------+------------------------------------------------------+\n| DAY_MICROSECOND | Days Hours.Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| DAY_SECOND | Days Hours.Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| DAY_MINUTE | Days Hours.Minutes |\n+---------------------+------------------------------------------------------+\n| DAY_HOUR | Days Hours |\n+---------------------+------------------------------------------------------+\n| YEAR_MONTH | Years-Months |\n+---------------------+------------------------------------------------------+\n\nThe time units containing an underscore are composite; that is, they consist\nof multiple base time units. For base time units, time_quantity is an integer\nnumber. For composite units, the quantity must be expressed as a string with\nmultiple integer numbers separated by any punctuation character.\n\nExample of composite units:\n\nINTERVAL \'2:2\' YEAR_MONTH\nINTERVAL \'1:30:30\' HOUR_SECOND\nINTERVAL \'1!30!30\' HOUR_SECOND -- same as above\n\nTime units can be used in the following contexts:\n\n* after a + or a - operator;\n* with the following DATE or TIME functions: ADDDATE(), SUBDATE(), DATE_ADD(),\nDATE_SUB(), TIMESTAMPADD(), TIMESTAMPDIFF(), EXTRACT();\n* in the ON SCHEDULE clause of CREATE EVENT and ALTER EVENT.\n* when defining a partitioning BY SYSTEM_TIME\n\nURL: https://mariadb.com/kb/en/date-and-time-units/','','https://mariadb.com/kb/en/date-and-time-units/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,31,'ADD_MONTHS','MariaDB starting with 10.6.1\n----------------------------\nThe ADD_MONTHS function was introduced in MariaDB 10.6.1 to enhance Oracle\ncompatibility. Similar functionality can be achieved with the DATE_ADD\nfunction.\n\nSyntax\n------\n\nADD_MONTHS(date, months)\n\nDescription\n-----------\n\nADD_MONTHS adds an integer months to a given date (DATE, DATETIME or\nTIMESTAMP), returning the resulting date.\n\nmonths can be positive or negative.\n\nThe resulting day component will remain the same as that specified in date,\nunless the resulting month has fewer days than the day component of the given\ndate, in which case the day will be the last day of the resulting month.\n\nReturns NULL if given an invalid date, or a NULL argument.\n\nExamples\n--------\n\nSELECT ADD_MONTHS(\'2012-01-31\', 2);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', -5);\n+------------------------------+\n| ADD_MONTHS(\'2012-01-31\', -5) |\n+------------------------------+\n| 2011-08-31 |\n+------------------------------+\n\nSELECT ADD_MONTHS(\'2011-01-31\', 1);\n+-----------------------------+\n| ADD_MONTHS(\'2011-01-31\', 1) |\n+-----------------------------+\n| 2011-02-28 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 1);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 1) |\n+-----------------------------+\n| 2012-02-29 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 2);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 3);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 3) |\n+-----------------------------+\n| 2012-04-30 |\n+-----------------------------+\n\nURL: https://mariadb.com/kb/en/add_months/','','https://mariadb.com/kb/en/add_months/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (508,31,'ADDDATE','Syntax\n------\n\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE() is a\nsynonym for DATE_ADD(). The related function SUBDATE() is a synonym for\nDATE_SUB(). For information on the INTERVAL unit argument, see the discussion\nfor DATE_ADD().\n\nWhen invoked with the days form of the second argument, MariaDB treats it as\nan integer number of days to be added to expr.\n\nExamples\n--------\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| 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| 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\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 (509,31,'ADDTIME','Syntax\n------\n\nADDTIME(expr1,expr2)\n\nDescription\n-----------\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time or\ndatetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n+---------------------------------------------------------+\n| ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1: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\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 (510,31,'CONVERT_TZ','Syntax\n------\n\nCONVERT_TZ(dt,from_tz,to_tz)\n\nDescription\n-----------\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by from_tz\nto the time zone given by to_tz and returns the resulting value.\n\nIn order to use named time zones, such as GMT, MET or Africa/Johannesburg, the\ntime_zone tables must be loaded (see mysql_tzinfo_to_sql).\n\nNo conversion will take place if the value falls outside of the supported\nTIMESTAMP range (\'1970-01-01 00:00:01\' to \'2038-01-19 05:14:07\' UTC) when\nconverted from from_tz to UTC.\n\nThis function returns NULL if the arguments are invalid (or named time zones\nhave not been loaded).\n\nSee time zones for more information.\n\nExamples\n--------\n\nSELECT CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\') |\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 12:00:00\',\'GMT\',\'Africa/Johannesburg\');\n+---------------------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12: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 takes place:\n\nSELECT CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\') |\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\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 (511,31,'CURDATE','Syntax\n------\n\nCURDATE()\nCURRENT_DATE\nCURRENT_DATE()\n\nDescription\n-----------\n\nCURDATE returns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or numeric\ncontext.\n\nCURRENT_DATE and CURRENT_DATE() are synonyms.\n\nExamples\n--------\n\nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n\nIn a numeric context (note this is not performing date calculations):\n\nSELECT CURDATE() +0;\n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n\nData calculation:\n\nSELECT CURDATE() - INTERVAL 5 DAY;\n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\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 (512,31,'CURRENT_DATE','Syntax\n------\n\nCURRENT_DATE, CURRENT_DATE()\n\nDescription\n-----------\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\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 (513,31,'CURRENT_TIME','Syntax\n------\n\nCURRENT_TIME\nCURRENT_TIME([precision])\n\nDescription\n-----------\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\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 (514,31,'CURRENT_TIMESTAMP','Syntax\n------\n\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n\nDescription\n-----------\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\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 (515,31,'CURTIME','Syntax\n------\n\nCURTIME([precision])\n\nDescription\n-----------\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context. The\nvalue is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n\nSELECT CURTIME() + 0;\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\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 (516,31,'DATE FUNCTION','Syntax\n------\n\nDATE(expr)\n\nDescription\n-----------\n\nExtracts the date part of the date or datetime expression expr.\n\nExamples\n--------\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--------------\n\nUntil MariaDB 5.5.32, some versions of MariaDB returned 0000-00-00 when passed\nan invalid date. From 5.5.32, NULL is returned.\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 (517,31,'DATEDIFF','Syntax\n------\n\nDATEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nDATEDIFF() returns (expr1 – expr2) expressed as a value in days from one date\nto the other. expr1 and expr2 are date or date-and-time expressions. Only the\ndate parts of the values are used in the calculation.\n\nExamples\n--------\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| 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\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 (518,31,'DATE_ADD','Syntax\n------\n\nDATE_ADD(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a \"-\" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nExamples\n--------\n\nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\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| INTERVAL 1 DAY + \'2008-12-31\' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n\nSELECT \'2005-01-01\' - INTERVAL 1 SECOND;\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\' MINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\' MINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n\nSELECT DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\' DAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\' DAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n\nSELECT DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL \'1.999999\'\nSECOND_MICROSECOND);\n+------------------------------------------------------------------------------\n-+\n| DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL \'1.999999\'\nSECOND_MICROSECOND) |\n+------------------------------------------------------------------------------\n-+\n| 1993-01-01 00:00:01.000001 \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 (519,31,'DATE_FORMAT','Syntax\n------\n\nDATE_FORMAT(date, format[, locale])\n\nDescription\n-----------\n\nFormats the date value according to the format string.\n\nThe language used for the names is controlled by the value of the\nlc_time_names system variable. See server locale for more on the supported\nlocales.\n\nThe options that can be used by DATE_FORMAT(), as well as its inverse\nSTR_TO_DATE() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Monday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nTo get a date in one of the standard formats, GET_FORMAT() can be used.\n\nExamples\n--------\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 %b %j\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m %b %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 %S %w\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T %S %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\nMariaDB starting with 10.3.2\n----------------------------\nOptionally, the locale can be explicitly specified as the third DATE_FORMAT()\nargument. Doing so makes the function independent from the session settings,\nand the three argument version of DATE_FORMAT() can be used in virtual indexed\nand 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\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 (520,31,'DATE_SUB','Syntax\n------\n\nDATE_SUB(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a \"-\" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nSee also DATE_ADD().\n\nExamples\n--------\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 1:1:1\' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1 1:1:1\' DAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\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 (521,31,'DAY','Syntax\n------\n\nDAY(date)\n\nDescription\n-----------\n\nDAY() is a synonym for DAYOFMONTH().\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 (522,31,'DAYNAME','Syntax\n------\n\nDAYNAME(date)\n\nDescription\n-----------\n\nReturns the name of the weekday for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\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| 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\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 (523,31,'DAYOFMONTH','Syntax\n------\n\nDAYOFMONTH(date)\n\nDescription\n-----------\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for dates\nsuch as \'0000-00-00\' or \'2008-00-00\' which have a zero day part.\n\nDAY() is a synonym.\n\nExamples\n--------\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| 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\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 (524,31,'DAYOFWEEK','Syntax\n------\n\nDAYOFWEEK(date)\n\nDescription\n-----------\n\nReturns the day of the week index for the date (1 = Sunday, 2 = Monday, ..., 7\n= Saturday). These index values correspond to the ODBC standard.\n\nThis contrasts with WEEKDAY() which follows a different index numbering (0 =\nMonday, 1 = Tuesday, ... 6 = Sunday).\n\nExamples\n--------\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| 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\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 (525,31,'DAYOFYEAR','Syntax\n------\n\nDAYOFYEAR(date)\n\nDescription\n-----------\n\nReturns the day of the year for date, in the range 1 to 366.\n\nExamples\n--------\n\nSELECT DAYOFYEAR(\'2018-02-16\');\n+-------------------------+\n| DAYOFYEAR(\'2018-02-16\') |\n+-------------------------+\n| 47 |\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 (526,31,'EXTRACT','Syntax\n------\n\nEXTRACT(unit FROM date)\n\nDescription\n-----------\n\nThe EXTRACT() function extracts the required unit from the date. See Date and\nTime Units for a complete list of permitted units.\n\nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM ...) was changed to\nreturn a value from 0 to 23, adhering to the SQL standard. Until MariaDB\n10.0.6 and MariaDB 5.5.34, and in all versions of MySQL at least as of MySQL\n5.7, it could return a value > 23. HOUR() is not a standard function, so\ncontinues to adhere to the old behaviour inherited from MySQL.\n\nExamples\n--------\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 10: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 FROM...) returns a value\nfrom 0 to 23, as per the SQL standard. HOUR is not a standard function, so\ncontinues to adhere 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\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 (527,31,'FROM_DAYS','Syntax\n------\n\nFROM_DAYS(N)\n\nDescription\n-----------\n\nGiven a day number N, returns a DATE value. The day count is based on the\nnumber of days from the start of the standard calendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the\nGregorian calendar in October 1582. Results will not be reliable since it\ndoesn\'t account for the lost days when the calendar changed from the Julian\ncalendar.\n\nThis is the converse of the TO_DAYS() function.\n\nExamples\n--------\n\nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\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 (528,31,'FROM_UNIXTIME','Syntax\n------\n\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nDescription\n-----------\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether\nthe function is used in a string or numeric context. The value is expressed in\nthe current time zone. unix_timestamp is an internal timestamp value such as\nis produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format string,\nwhich is used the same way as listed in the entry for the DATE_FORMAT()\nfunction.\n\nTimestamps in MariaDB have a maximum value of 2147483647, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a timestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond this.\n\nThe options that can be used by FROM_UNIXTIME(), as well as DATE_FORMAT() and\nSTR_TO_DATE(), are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Sunday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nPerformance Considerations\n--------------------------\n\nIf your session time zone is set to SYSTEM (the default), FROM_UNIXTIME() will\ncall the OS function to convert the data using the system time zone. At least\non Linux, the corresponding function (localtime_r) uses a global mutex inside\nglibc that can cause contention under high concurrent load.\n\nSet your time zone to a named time zone to avoid this issue. See mysql time\nzone tables for details on how to do this.\n\nExamples\n--------\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| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n\nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\') |\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\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 (529,31,'GET_FORMAT','Syntax\n------\n\nGET_FORMAT({DATE|DATETIME|TIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nDescription\n-----------\n\nReturns a format string. This function is useful in combination with the\nDATE_FORMAT() and the STR_TO_DATE() functions.\n\nPossible result formats are:\n\n+--------------------------------------+--------------------------------------+\n| Function Call | Result Format |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'EUR\') | \'%d.%m.%Y\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'USA\') | \'%m.%d.%Y\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'JIS\') | \'%Y-%m-%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'ISO\') | \'%Y-%m-%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'INTERNAL\') | \'%Y%m%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'EUR\') | \'%Y-%m-%d %H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'USA\') | \'%Y-%m-%d %H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'JIS\') | \'%Y-%m-%d %H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'ISO\') | \'%Y-%m-%d %H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'INTERNAL\') | \'%Y%m%d%H%i%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'EUR\') | \'%H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'USA\') | \'%h:%i:%s %p\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'JIS\') | \'%H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'ISO\') | \'%H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'INTERNAL\') | \'%H%i%s\' |\n+--------------------------------------+--------------------------------------+\n\nExamples\n--------\n\nObtaining the string matching to the standard European date format:\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\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 (530,31,'HOUR','Syntax\n------\n\nHOUR(time)\n\nDescription\n-----------\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much larger,\nso HOUR can return values greater than 23.\n\nThe return value is always positive, even if a negative TIME value is provided.\n\nExamples\n--------\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 10.0.7 and MariaDB\n5.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\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 (531,31,'LAST_DAY','Syntax\n------\n\nLAST_DAY(date)\n\nDescription\n-----------\n\nTakes a date or datetime value and returns the corresponding value for the\nlast day of the month. Returns NULL if the argument is invalid.\n\nExamples\n--------\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: \'2003-03-32\'\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 (532,31,'LOCALTIME','Syntax\n------\n\nLOCALTIME\nLOCALTIME([precision])\n\nDescription\n-----------\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\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 (533,31,'LOCALTIMESTAMP','Syntax\n------\n\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\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 (534,31,'MAKEDATE','Syntax\n------\n\nMAKEDATE(year,dayofyear)\n\nDescription\n-----------\n\nReturns a date, given year and day-of-year values. dayofyear must be greater\nthan 0 or the result is NULL.\n\nExamples\n--------\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\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 (535,31,'MAKETIME','Syntax\n------\n\nMAKETIME(hour,minute,second)\n\nDescription\n-----------\n\nReturns a time value calculated from the hour, minute, and second arguments.\n\nIf minute or second are out of the range 0 to 60, NULL is returned. The hour\ncan be in the range -838 to 838, outside of which the value is truncated with\na warning.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'-1000:57:33\' |\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 (536,31,'MICROSECOND','Syntax\n------\n\nMICROSECOND(expr)\n\nDescription\n-----------\n\nReturns the microseconds from the time or datetime expression expr as a number\nin the range from 0 to 999999.\n\nIf expr is a time with no microseconds, zero is returned, while if expr is a\ndate with no time, zero with a warning is returned.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'2013-08-07\' |\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 (537,31,'MINUTE','Syntax\n------\n\nMINUTE(time)\n\nDescription\n-----------\n\nReturns the minute for time, in the range 0 to 59.\n\nExamples\n--------\n\nSELECT MINUTE(\'2013-08-03 11:04:03\');\n+-------------------------------+\n| MINUTE(\'2013-08-03 11:04:03\') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n\nSELECT MINUTE (\'23:12:50\');\n+---------------------+\n| MINUTE (\'23:12:50\') |\n+---------------------+\n| 12 |\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 (538,31,'MONTH','Syntax\n------\n\nMONTH(date)\n\nDescription\n-----------\n\nReturns the month for date in the range 1 to 12 for January to December, or 0\nfor dates such as \'0000-00-00\' or \'2008-00-00\' that have a zero month part.\n\nExamples\n--------\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\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 (539,31,'MONTHNAME','Syntax\n------\n\nMONTHNAME(date)\n\nDescription\n-----------\n\nReturns the full name of the month for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\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\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 (540,31,'NOW','Syntax\n------\n\nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context. The value is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nNOW() (or its synonyms) can be used as the default value for TIMESTAMP columns\nas well as, since MariaDB 10.0.1, DATETIME columns. Before MariaDB 10.0.1, it\nwas only possible for a single TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n\nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a default CURRENT\nTIMESTAMP is displayed as CURRENT_TIMESTAMP up until MariaDB 10.2.2, and as\ncurrent_timestamp() from MariaDB 10.2.3, due to to MariaDB 10.2 accepting\nexpressions in the DEFAULT clause.\n\nExamples\n--------\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n\nSELECT NOW() + 0;\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 CURRENT_TIMESTAMP);\n\nFrom MariaDB 10.2.2:\n\nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row ***************************\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<= MariaDB 10.2.1\n\nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row ***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: createdTS\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: CURRENT_TIMESTAMP\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 (541,31,'PERIOD_ADD','Syntax\n------\n\nPERIOD_ADD(P,N)\n\nDescription\n-----------\n\nAdds N months to period P. P is in the format YYMM or YYYYMM, and is not a\ndate value. If P contains a two-digit year, values from 00 to 69 are converted\nto from 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nReturns a value in the format YYYYMM.\n\nExamples\n--------\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\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 (542,31,'PERIOD_DIFF','Syntax\n------\n\nPERIOD_DIFF(P1,P2)\n\nDescription\n-----------\n\nReturns the number of months between periods P1 and P2. P1 and P2 can be in\nthe format YYMM or YYYYMM, and are not date values.\n\nIf P1 or P2 contains a two-digit year, values from 00 to 69 are converted to\nfrom 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nExamples\n--------\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\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 (543,31,'QUARTER','Syntax\n------\n\nQUARTER(date)\n\nDescription\n-----------\n\nReturns the quarter of the year for date, in the range 1 to 4. Returns 0 if\nmonth contains a zero value, or NULL if the given value is not otherwise a\nvalid date (zero values are accepted).\n\nExamples\n--------\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\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 (544,31,'SECOND','Syntax\n------\n\nSECOND(time)\n\nDescription\n-----------\n\nReturns the second for a given time (which can include microseconds), in the\nrange 0 to 59, or NULL if not given a valid time value.\n\nExamples\n--------\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\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 (545,31,'SEC_TO_TIME','Syntax\n------\n\nSEC_TO_TIME(seconds)\n\nDescription\n-----------\n\nReturns the seconds argument, converted to hours, minutes, and seconds, as a\nTIME value. The range of the result is constrained to that of the TIME data\ntype. A warning occurs if the argument corresponds to a value outside that\nrange.\n\nThe time will be returned in the format hh:mm:ss, or hhmmss if used in a\nnumeric calculation.\n\nExamples\n--------\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| 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| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'9999999\' |\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 (546,31,'STR_TO_DATE','Syntax\n------\n\nSTR_TO_DATE(str,format)\n\nDescription\n-----------\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string str and a\nformat string format. STR_TO_DATE() returns a DATETIME value if the format\nstring contains both date and time parts, or a DATE or TIME value if the\nstring contains only date or time parts.\n\nThe date, time, or datetime values contained in str should be given in the\nformat indicated by format. If str contains an illegal date, time, or datetime\nvalue, STR_TO_DATE() returns NULL. An illegal value also produces a warning.\n\nThe options that can be used by STR_TO_DATE(), as well as its inverse\nDATE_FORMAT() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Monday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nExamples\n--------\n\nSELECT STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e, %Y\');\n+---------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e, %Y\') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n\nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e, %Y\');\n+--------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e, %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+---------+------+-------------------------------------------------------------\n---------------------+\n| Warning | 1411 | Incorrect datetime value: \'Wednesday23423, June 2, 2014\'\nfor function str_to_date |\n+---------+------+-------------------------------------------------------------\n---------------------+\n\nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M %e, %Y\');\n+----------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M %e, %Y\') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\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 (547,31,'SUBDATE','Syntax\n------\n\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE() is a\nsynonym for DATE_SUB(). See Date and Time Units for a complete list of\npermitted units.\n\nThe second form allows the use of an integer value for days. In such cases, it\nis interpreted as the number of days to be subtracted from the date or\ndatetime expression expr.\n\nExamples\n--------\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| 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| 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\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 (548,31,'SUBTIME','Syntax\n------\n\nSUBTIME(expr1,expr2)\n\nDescription\n-----------\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format as\nexpr1. expr1 is a time or datetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n+--------------------------------------------------------+\n| SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\') |\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\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 (549,31,'SYSDATE','Syntax\n------\n\nSYSDATE([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the time at\nwhich the statement began to execute. (Within a stored routine or trigger,\nNOW() returns the time at which the routine or triggering statement began to\nexecute.)\n\nIn addition, changing the timestamp system variable with a SET timestamp\nstatement affects the value returned by NOW() but not by SYSDATE(). This means\nthat timestamp settings in the binary log have no effect on invocations of\nSYSDATE().\n\nBecause SYSDATE() can return different values even within the same statement,\nand is not affected by SET TIMESTAMP, it is non-deterministic and therefore\nunsafe for replication if statement-based binary logging is used. If that is a\nproblem, you can use row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias for NOW(). The\nnon-deterministic nature of SYSDATE() also means that indexes cannot be used\nfor evaluating expressions that refer to it, and that statements using the\nSYSDATE() function are unsafe for statement-based replication.\n\nExamples\n--------\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\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 (550,31,'TIME Function','Syntax\n------\n\nTIME(expr)\n\nDescription\n-----------\n\nExtracts the time part of the time or datetime expression expr and returns it\nas a string.\n\nExamples\n--------\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\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 (551,31,'TIMEDIFF','Syntax\n------\n\nTIMEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and expr2\nare time or date-and-time expressions, but both must be of the same type.\n\nExamples\n--------\n\nSELECT TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01 00:00:00.000001\');\n+---------------------------------------------------------------+\n| TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01 00:00:00.000001\') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n\nSELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30 01:01:01.000002\');\n+----------------------------------------------------------------------+\n| TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30 01:01:01.000002\') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\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 (552,31,'TIMESTAMP FUNCTION','Syntax\n------\n\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nDescription\n-----------\n\nWith a single argument, this function returns the date or datetime expression\nexpr as a datetime value. With two arguments, it adds the time expression\nexpr2 to the date or datetime expression expr1 and returns the result as a\ndatetime value.\n\nExamples\n--------\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\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 (553,31,'TIMESTAMPADD','Syntax\n------\n\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nDescription\n-----------\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument, which\nshould be one of the following values: MICROSECOND, SECOND, MINUTE, HOUR, DAY,\nWEEK, MONTH, QUARTER, or YEAR.\n\nThe unit value may be specified using one of keywords as shown, or with a\nprefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nBefore MariaDB 5.5, FRAC_SECOND was permitted as a synonym for MICROSECOND.\n\nExamples\n--------\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\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 (554,31,'TIMESTAMPDIFF','Syntax\n------\n\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nDescription\n-----------\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be a date\nand the other a datetime; a date value is treated as a datetime having the\ntime part \'00:00:00\' where necessary. The unit for the result (an integer) is\ngiven by the unit argument. The legal values for unit are the same as those\nlisted in the description of the TIMESTAMPADD() function, i.e MICROSECOND,\nSECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n\nTIMESTAMPDIFF can also be used to calculate age.\n\nExamples\n--------\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 12:05:55\');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12: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 age;\n+------+\n| age |\n+------+\n| 47 |\n+------+\n\nSELECT TIMESTAMPDIFF(YEAR, \'1971-05-06\', CURDATE()) AS age;\n+------+\n| age |\n+------+\n| 48 |\n+------+\n\nAge as of 2014-08-02:\n\nSELECT name, date_of_birth, TIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS\nage \n FROM student_details;\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\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 (555,31,'TIME_FORMAT','Syntax\n------\n\nTIME_FORMAT(time,format)\n\nDescription\n-----------\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, and seconds. Other\nspecifiers produce a NULL value or 0.\n\nExamples\n--------\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\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 (556,31,'TIME_TO_SEC','Syntax\n------\n\nTIME_TO_SEC(time)\n\nDescription\n-----------\n\nReturns the time argument, converted to seconds.\n\nThe value returned by TIME_TO_SEC is of type DOUBLE. Before MariaDB 5.3 (and\nMySQL 5.6), the type was INT. The returned value preserves microseconds of the\nargument. See also Microseconds in MariaDB.\n\nExamples\n--------\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\nSELECT TIME_TO_SEC(\'09:12:55.2355\');\n+------------------------------+\n| TIME_TO_SEC(\'09:12:55.2355\') |\n+------------------------------+\n| 33175.2355 |\n+------------------------------+\n1 row in set (0.000 sec)\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 (557,31,'TO_DAYS','Syntax\n------\n\nTO_DAYS(date)\n\nDescription\n-----------\n\nGiven a date date, returns the number of days since the start of the current\ncalendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the\nGregorian calendar in October 1582. Results will not be reliable since it\ndoesn\'t account for the lost days when the calendar changed from the Julian\ncalendar.\n\nThis is the converse of the FROM_DAYS() function.\n\nExamples\n--------\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\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 (558,31,'TO_SECONDS','Syntax\n------\n\nTO_SECONDS(expr)\n\nDescription\n-----------\n\nReturns the number of seconds from year 0 till expr, or NULL if expr is not a\nvalid date or datetime.\n\nExamples\n--------\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\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 (559,31,'UNIX_TIMESTAMP','Syntax\n------\n\nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n\nDescription\n-----------\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is\ncalled with a date argument, it returns the value of the argument as seconds\nsince \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a DATETIME string,\na TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server\ninterprets date as a value in the current time zone and converts it to an\ninternal value in UTC. Clients can set their time zone as described in time\nzones.\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, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a date beyond this will result in NULL being returned. Use\nDATETIME as a storage type if you require dates beyond this.\n\nError Handling\n--------------\n\nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In MySQL and MariaDB\nbefore 5.3 wrong arguments to UNIX_TIMESTAMP() returned 0.\n\nCompatibility\n-------------\n\nAs you can see in the examples above, UNIX_TIMESTAMP(constant-date-string)\nreturns a timestamp with 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using UNIX_TIMESTAMP()\nas a partitioning function. You can fix this by using\nFLOOR(UNIX_TIMESTAMP(..)) or changing the date string to a date number, like\n20080101000000.\n\nExamples\n--------\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 10: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 10:30:19\')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30 10:30:19\'))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\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 (560,31,'UTC_DATE','Syntax\n------\n\nUTC_DATE, UTC_DATE()\n\nDescription\n-----------\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric context.\n\nExamples\n--------\n\nSELECT UTC_DATE(), UTC_DATE() + 0;\n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\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 (561,31,'UTC_TIME','Syntax\n------\n\nUTC_TIME\nUTC_TIME([precision])\n\nDescription\n-----------\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIME(), UTC_TIME() + 0;\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\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 (562,31,'UTC_TIMESTAMP','Syntax\n------\n\nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\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\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 (563,31,'WEEK','Syntax\n------\n\nWEEK(date[,mode])\n\nDescription\n-----------\n\nThis function returns the week number for date. The two-argument form of\nWEEK() allows you to specify whether the week starts on Sunday or Monday and\nwhether the return value should be in the range from 0 to 53 or from 1 to 53.\nIf the mode argument is omitted, the value of the default_week_format system\nvariable is used.\n\nModes\n-----\n\n+-------+---------------------+--------+------------------------------------+\n| Mode | 1st day of week | Range | Week 1 is the 1st week with |\n+-------+---------------------+--------+------------------------------------+\n| 0 | Sunday | 0-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 1 | Monday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 2 | Sunday | 1-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 3 | Monday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 4 | Sunday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 5 | Monday | 0-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 6 | Sunday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 7 | Monday | 1-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n\nWith the mode value of 3, which means \'more than 3 days this year\', weeks are\nnumbered according to ISO 8601:1988.\n\nExamples\n--------\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\nSELECT WEEK(\'2019-12-30\',3);\n+----------------------+\n| WEEK(\'2019-12-30\',3) |\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, WEEK(d,0), WEEK(d,1) from t1;\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\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 (564,31,'WEEKDAY','Syntax\n------\n\nWEEKDAY(date)\n\nDescription\n-----------\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n\nThis contrasts with DAYOFWEEK() which follows the ODBC standard (1 = Sunday, 2\n= Monday, ..., 7 = Saturday).\n\nExamples\n--------\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| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\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 (565,31,'WEEKOFYEAR','Syntax\n------\n\nWEEKOFYEAR(date)\n\nDescription\n-----------\n\nReturns the calendar week of the date as a number in the range from 1 to 53.\nWEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).\n\nExamples\n--------\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\nselect * from t1;\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| 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\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 (566,31,'YEAR','Syntax\n------\n\nYEAR(date)\n\nDescription\n-----------\n\nReturns the year for the given date, in the range 1000 to 9999, or 0 for the\n\"zero\" date.\n\nExamples\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| 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| 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\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 (567,31,'YEARWEEK','Syntax\n------\n\nYEARWEEK(date), YEARWEEK(date,mode)\n\nDescription\n-----------\n\nReturns year and week for a date. The mode argument works exactly like the\nmode argument to WEEK(). The year in the result may be different from the year\nin the date argument for the first and the last week of the year.\n\nExamples\n--------\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| 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| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\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 (568,32,'Well-Known Binary (WKB) Format','WKB stands for Well-Known Binary, a format for representing geographical and\ngeometrical data.\n\nWKB uses 1-byte unsigned integers, 4-byte unsigned integers, and 8-byte\ndouble-precision numbers.\n\n* The first byte indicates the byte order. 00 for big endian, or 01 for little\nendian.\n* The next 4 bytes indicate the geometry type. Values from 1 to 7 indicate\nwhether the type is Point, LineString, Polygon, MultiPoint, MultiLineString,\nMultiPolygon, or GeometryCollection respectively. \n* The 8-byte floats represent the co-ordinates.\n\nTake the following example, a sequence of 21 bytes each represented by two hex\ndigits:\n\n000000000140000000000000004010000000000000\n\n* It\'s big endian\n000000000140000000000000004010000000000000\n\n* It\'s a POINT\n000000000140000000000000004010000000000000\n\n* The X co-ordinate is 2.0\n000000000140000000000000004010000000000000\n\n* The Y-co-ordinate is 4.0\n000000000140000000000000004010000000000000\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 (569,32,'AsBinary','A synonym for ST_AsBinary().\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 (570,32,'AsWKB','A synonym for ST_AsBinary().\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 (571,32,'MLineFromWKB','Syntax\n------\n\nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTILINESTRING value using its WKB representation and SRID.\n\nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16\n0,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\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 (572,32,'MPointFromWKB','Syntax\n------\n\nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4,\n6 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\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 (573,32,'MPolyFromWKB','Syntax\n------\n\nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(\'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 13,59 18)))\'));\n\nSELECT ST_AsText(MPolyFromWKB(@g))\\G\n*************************** 1. row ***************************\nST_AsText(MPolyFromWKB(@g)): MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\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 (574,32,'GeomCollFromWKB','A synonym for ST_GeomCollFromWKB.\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 (575,32,'GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\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 (576,32,'GeometryFromWKB','A synonym for ST_GeomFromWKB.\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 (577,32,'GeomFromWKB','A synonym for ST_GeomFromWKB.\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 (578,32,'LineFromWKB','A synonym for ST_LineFromWKB.\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 (579,32,'LineStringFromWKB','A synonym for ST_LineFromWKB.\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 (580,32,'MultiLineStringFromWKB','A synonym for MLineFromWKB().\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 (581,32,'MultiPointFromWKB','A synonym for MPointFromWKB.\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 (582,32,'MultiPolygonFromWKB','Synonym for MPolyFromWKB.\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 (583,32,'PointFromWKB','A synonym for ST_PointFromWKB.\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 (584,32,'PolyFromWKB','A synonym for ST_PolyFromWKB.\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 (585,32,'PolygonFromWKB','A synonym for ST_PolyFromWKB.\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 (586,32,'ST_AsBinary','Syntax\n------\n\nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n\nDescription\n-----------\n\nConverts a value in internal geometry format to its WKB representation and\nreturns the binary result.\n\nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are synonyms,\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText(\'POLYGON((0 0,0 1,1 1,1 0,0 0))\');\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\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 (587,32,'ST_AsWKB','A synonym for ST_AsBinary().\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 (588,32,'ST_GeomCollFromWKB','Syntax\n------\n\nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and SRID.\n\nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(), GeomCollFromWKB() and\nGeometryCollectionFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_GeomFromText(\'GEOMETRYCOLLECTION(\n POLYGON((5 5,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 10)) |\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 (589,32,'ST_GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\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 (590,32,'ST_GeometryFromWKB','A synonym for ST_GeomFromWKB.\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 (591,32,'ST_GeomFromWKB','Syntax\n------\n\nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a geometry value of any type using its WKB representation and SRID.\n\nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and GeometryFromWKB()\nare synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(\'LINESTRING(0 4, 4 6)\'));\n\nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\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 (592,32,'ST_LineFromWKB','Syntax\n------\n\nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(\'LineString(0 4,4 6)\'));\n\nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\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 (593,32,'ST_LineStringFromWKB','A synonym for ST_LineFromWKB.\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 (594,32,'ST_PointFromWKB','Syntax\n------\n\nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POINT value using its WKB representation and SRID.\n\nST_PointFromWKB() and PointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PointFromText(\'POINT(0 4)\'));\n\nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n+------------+\n| p |\n+------------+\n| POINT(0 4) |\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 (595,32,'ST_PolyFromWKB','Syntax\n------\n\nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and PolygonFromWKB() are\nsynonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PolyFromText(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1\n1))\'));\n\nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\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 (596,32,'ST_PolygonFromWKB','A synonym for ST_PolyFromWKB.\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 (597,34,'Geometry Types','Description\n-----------\n\nMariaDB provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently, spatial\ncolumns are supported for MyISAM, InnoDB and ARCHIVE tables. See also SPATIAL\nINDEX.\n\nThe basic geometry type is GEOMETRY. But the type can be more specific. The\nfollowing types are supported:\n\n+-----------------------------------------------------------------------------+\n| Geometry Types |\n+-----------------------------------------------------------------------------+\n| POINT |\n+-----------------------------------------------------------------------------+\n| LINESTRING |\n+-----------------------------------------------------------------------------+\n| POLYGON |\n+-----------------------------------------------------------------------------+\n| MULTIPOINT |\n+-----------------------------------------------------------------------------+\n| MULTILINESTRING |\n+-----------------------------------------------------------------------------+\n| MULTIPOLYGON |\n+-----------------------------------------------------------------------------+\n| GEOMETRYCOLLECTION |\n+-----------------------------------------------------------------------------+\n| GEOMETRY |\n+-----------------------------------------------------------------------------+\n\nExamples\n--------\n\nNote: For clarity, only one type is listed per table in the examples below,\nbut a table row can contain multiple types. For example:\n\nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n\nPOINT\n-----\n\nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_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\nLINESTRING\n----------\n\nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\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 10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nPOLYGON\n-------\n\nCREATE TABLE gis_polygon (g POLYGON);\nSHOW FIELDS FROM gis_polygon;\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10 10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30,\n30), Point(0, 0))))));\n\nMULTIPOINT\n----------\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20 20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nMULTILINESTRING\n---------------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16 0,16\n23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)),\nLineString(Point(2, 5), Point(5, 8), Point(21, 7))))));\n\nMULTIPOLYGON\n------------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromText(\'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 (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3,\n3), Point(3, 0), Point(0, 3)))))));\n\nGEOMETRYCOLLECTION\n------------------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n\nGEOMETRY\n--------\n\nCREATE TABLE gis_geometry (g GEOMETRY);\nSHOW FIELDS FROM gis_geometry;\nINSERT into gis_geometry SELECT * FROM gis_point;\nINSERT into gis_geometry SELECT * FROM gis_line;\nINSERT into gis_geometry SELECT * FROM gis_polygon;\nINSERT into gis_geometry SELECT * FROM gis_multi_point;\nINSERT into gis_geometry SELECT * FROM gis_multi_line;\nINSERT into gis_geometry SELECT * FROM gis_multi_polygon;\nINSERT into gis_geometry SELECT * FROM gis_geometrycollection;\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 (598,34,'Geometry Hierarchy','Description\n-----------\n\nGeometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and two-dimensional\ngeometric objects that exist in two-dimensional coordinate space. All\ninstantiable geometry classes are defined so that valid instances of a\ngeometry class are topologically closed (that is, all defined geometries\ninclude their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\n* Point represents zero-dimensional objects.\n* Curve represents one-dimensional objects, and has subclass LineString, with\nsub-subclasses Line and LinearRing.\n* Surface is designed for two-dimensional objects and has subclass Polygon.\n* GeometryCollection has specialized zero-, one-, and two-dimensional\ncollection classes named MultiPoint, MultiLineString, and MultiPolygon for\nmodeling geometries corresponding to collections of Points, LineStrings, and\nPolygons, respectively. MultiCurve and MultiSurface are introduced as abstract\nsuperclasses that generalize the collection interfaces to handle Curves and\nSurfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnon-instantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint, MultiLineString,\nand MultiPolygon are instantiable classes.\n\nURL: https://mariadb.com/kb/en/geometry-hierarchy/','','https://mariadb.com/kb/en/geometry-hierarchy/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (599,34,'SPATIAL INDEX','Description\n-----------\n\nOn MyISAM, Aria and InnoDB tables, MariaDB can create spatial indexes (an\nR-tree index) using syntax similar to that for creating regular indexes, but\nextended with the SPATIAL keyword. Currently, columns in spatial indexes must\nbe declared NOT NULL.\n\nSpatial indexes can be created when the table is created, or added after the\nfact like so:\n\n* with CREATE TABLE: CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));\n\n* with ALTER TABLE: ALTER TABLE geom ADD SPATIAL INDEX(g);\n\n* with CREATE INDEX: CREATE SPATIAL INDEX sp_index ON geom (g);\n\nSPATIAL INDEX creates an R-tree index. For storage engines that support\nnon-spatial indexing of spatial columns, the engine creates a B-tree index. A\nB-tree index on spatial values is useful for exact-value lookups, but not for\nrange scans.\n\nFor more information on indexing spatial columns, see CREATE INDEX.\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\n* with ALTER TABLE: ALTER TABLE geom DROP INDEX g;\n\n* with DROP INDEX: DROP INDEX sp_index ON geom;\n\nData-at-Rest Encyption\n----------------------\n\nBefore MariaDB 10.4.3, InnoDB\'s spatial indexes could not be encrypted. If an\nInnoDB table was encrypted and if it contained spatial indexes, then those\nindexes would be unencrypted.\n\nIn MariaDB 10.4.3 and later, if innodb_checksum_algorithm is set to full_crc32\nor strict_full_crc32, and if the table does not use ROW_FORMAT=COMPRESSED,\nthen InnoDB spatial indexes will be encrypted if the table is encrypted.\n\nSee MDEV-12026 for more information.\n\nURL: https://mariadb.com/kb/en/spatial-index/','','https://mariadb.com/kb/en/spatial-index/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (600,35,'BOUNDARY','A synonym for ST_BOUNDARY.\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 (601,35,'DIMENSION','A synonym for ST_DIMENSION.\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 (602,35,'ENVELOPE','A synonym for ST_ENVELOPE.\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 (603,35,'GeometryN','A synonym for ST_GeometryN.\n\nURL: https://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 (604,35,'GeometryType','A synonym for ST_GeometryType.\n\nURL: https://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 (605,35,'IsClosed','A synonym for ST_IsClosed.\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 (606,35,'IsEmpty','A synonym for ST_IsEmpty.\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 (607,35,'IsRing','A synonym for ST_IsRing.\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 (608,35,'IsSimple','A synonym for ST_IsSImple.\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 (609,35,'NumGeometries','A synonym for ST_NumGeometries.\n\nURL: https://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 (610,35,'SRID','A synonym for ST_SRID.\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 (611,35,'ST_BOUNDARY','MariaDB starting with 10.1.2\n----------------------------\nThe ST_BOUNDARY function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_BOUNDARY(g)\nBOUNDARY(g)\n\nDescription\n-----------\n\nReturns a geometry that is the closure of the combinatorial boundary of the\ngeometry value g.\n\nBOUNDARY() is a synonym.\n\nExamples\n--------\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0 0, -3 3)\')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0 0, -3 3)\'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0, -3 3, 3\n3))\')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0, -3 3, 3 3))\'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\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 (612,35,'ST_DIMENSION','Syntax\n------\n\nST_Dimension(g)\nDimension(g)\n\nDescription\n-----------\n\nReturns the inherent dimension of the geometry value g. The result can be\n\n+------------------------------------+---------------------------------------+\n| Dimension | Definition |\n+------------------------------------+---------------------------------------+\n| -1 | empty geometry |\n+------------------------------------+---------------------------------------+\n| 0 | geometry with no length or area |\n+------------------------------------+---------------------------------------+\n| 1 | geometry with no area but nonzero |\n| | length |\n+------------------------------------+---------------------------------------+\n| 2 | geometry with nonzero area |\n+------------------------------------+---------------------------------------+\n\nST_Dimension() and Dimension() are synonyms.\n\nExamples\n--------\n\nSELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\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 (613,35,'ST_ENVELOPE','Syntax\n------\n\nST_ENVELOPE(g)\nENVELOPE(g)\n\nDescription\n-----------\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g. The\nresult is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nST_ENVELOPE() and ENVELOPE() are synonyms.\n\nExamples\n--------\n\nSELECT AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\'))) |\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\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 (614,35,'ST_GEOMETRYN','Syntax\n------\n\nST_GeometryN(gc,N)\nGeometryN(gc,N)\n\nDescription\n-----------\n\nReturns the N-th geometry in the GeometryCollection gc. Geometries are\nnumbered beginning with 1.\n\nST_GeometryN() and GeometryN() are synonyms.\n\nExample\n-------\n\nSET @gc = \'GeometryCollection(Point(1 1),LineString(12 14, 9 11))\';\n\nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\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 (615,35,'ST_GEOMETRYTYPE','Syntax\n------\n\nST_GeometryType(g)\nGeometryType(g)\n\nDescription\n-----------\n\nReturns as a string the name of the geometry type of which the geometry\ninstance g is a member. The name corresponds to one of the instantiable\nGeometry subclasses.\n\nST_GeometryType() and GeometryType() are synonyms.\n\nExamples\n--------\n\nSELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\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 (616,35,'ST_ISCLOSED','Syntax\n------\n\nST_IsClosed(g)\nIsClosed(g)\n\nDescription\n-----------\n\nReturns 1 if a given LINESTRING\'s start and end points are the same, or 0 if\nthey are not the same. Before MariaDB 10.1.5, returns NULL if not given a\nLINESTRING. After MariaDB 10.1.5, returns -1.\n\nST_IsClosed() and IsClosed() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 0)\';\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)\';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\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 (617,35,'ST_ISEMPTY','Syntax\n------\n\nST_IsEmpty(g)\nIsEmpty(g)\n\nDescription\n-----------\n\nIsEmpty is a function defined by the OpenGIS specification, but is not fully\nimplemented by MariaDB or MySQL.\n\nSince MariaDB and MySQL do not support GIS EMPTY values such as POINT EMPTY,\nas implemented it simply returns 1 if the geometry value g is invalid, 0 if it\nis valid, and NULL if the argument is NULL.\n\nST_IsEmpty() and IsEmpty() are synonyms.\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 (618,35,'ST_IsRing','MariaDB starting with 10.1.2\n----------------------------\nThe ST_IsRing function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_IsRing(g)\nIsRing(g)\n\nDescription\n-----------\n\nReturns true if a given LINESTRING is a ring, that is, both ST_IsClosed and\nST_IsSimple. A simple curve does not pass through the same point more than\nonce. However, see MDEV-7510.\n\nSt_IsRing() and IsRing() are synonyms.\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 (619,35,'ST_IsSimple','Syntax\n------\n\nST_IsSimple(g)\nIsSimple(g)\n\nDescription\n-----------\n\nReturns true if the given Geometry has no anomalous geometric points, false if\nit does, or NULL if given a NULL value.\n\nST_IsSimple() and IsSimple() are synonyms.\n\nExamples\n--------\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\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 (620,35,'ST_NUMGEOMETRIES','Syntax\n------\n\nST_NumGeometries(gc)\nNumGeometries(gc)\n\nDescription\n-----------\n\nReturns the number of geometries in the GeometryCollection gc.\n\nST_NumGeometries() and NumGeometries() are synonyms.\n\nExample\n-------\n\nSET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\n\nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\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 (621,35,'ST_RELATE','MariaDB starting with 10.1.2\n----------------------------\nThe ST_RELATE() function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_Relate(g1, g2, i)\n\nDescription\n-----------\n\nReturns true if Geometry g1 is spatially related to Geometryg2 by testing for\nintersections between the interior, boundary and exterior of the two\ngeometries as specified by the values in intersection matrix pattern i.\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 (622,35,'ST_SRID','Syntax\n------\n\nST_SRID(g)\nSRID(g)\n\nDescription\n-----------\n\nReturns an integer indicating the Spatial Reference System ID for the geometry\nvalue g.\n\nIn MariaDB, the SRID value is just an integer associated with the geometry\nvalue. All calculations are done assuming Euclidean (planar) geometry.\n\nST_SRID() and SRID() are synonyms.\n\nExamples\n--------\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\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 (623,36,'LOAD_FILE','Syntax\n------\n\nLOAD_FILE(file_name)\n\nDescription\n-----------\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify the\nfull path name to the file, and you must have the FILE privilege. The file\nmust be readable by all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv system variable is\nset to a non-empty directory name, the file to be loaded must be located in\nthat directory.\n\nIf the file does not exist or cannot be read because one of the preceding\nconditions is not satisfied, the function returns NULL.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nStatements using the LOAD_FILE() function are not safe for statement based\nreplication. This is because the slave will execute the LOAD_FILE() command\nitself. If the file doesn\'t exist on the slave, the function will return NULL.\n\nExamples\n--------\n\nUPDATE t SET blob_col=LOAD_FILE(\'/tmp/picture\') WHERE id=1;\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 (624,36,'NOT REGEXP','Syntax\n------\n\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nDescription\n-----------\n\nThis is the same as NOT (expr REGEXP pat).\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 (625,36,'REGEXP','Syntax\n------\n\nexpr REGEXP pat, expr RLIKE pat\n\nDescription\n-----------\n\nPerforms a pattern match of a string expression expr against a pattern pat.\nThe pattern can be an extended regular expression. See Regular Expressions\nOverview for details on the syntax for regular expressions (see also PCRE\nRegular Expressions).\n\nReturns 1 if expr matches pat or 0 if it doesn\'t match. If either expr or pat\nare NULL, the result is NULL.\n\nThe negative form NOT REGEXP also exists, as an alias for NOT (string REGEXP\npattern). RLIKE and NOT RLIKE are synonyms for REGEXP and NOT REGEXP,\noriginally provided for mSQL compatibility.\n\nThe pattern need not be a literal string. For example, it can be specified as\na string expression or table column.\n\nNote: Because MariaDB uses the C escape syntax in strings (for example, \"\\n\"\nto represent the newline character), you must double any \"\\\" that you use in\nyour REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nMariaDB 10.0.5 moved to the PCRE regex library - see PCRE Regular Expressions\nfor enhancements to REGEXP introduced in MariaDB 10.0.5.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT \'Monty!\' REGEXP \'m%y%%\';\n+-------------------------+\n| \'Monty!\' REGEXP \'m%y%%\' |\n+-------------------------+\n| 0 |\n+-------------------------+\n\nSELECT \'Monty!\' REGEXP \'.*\';\n+----------------------+\n| \'Monty!\' REGEXP \'.*\' |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n+---------------------------------------+\n| \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\' |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n\nSELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n+----------------+-----------------------+\n| \'a\' REGEXP \'A\' | \'a\' REGEXP BINARY \'A\' |\n+----------------+-----------------------+\n| 1 | 0 |\n+----------------+-----------------------+\n\nSELECT \'a\' REGEXP \'^[a-d]\';\n+---------------------+\n| \'a\' REGEXP \'^[a-d]\' |\n+---------------------+\n| 1 |\n+---------------------+\n\ndefault_regex_flags examples\n----------------------------\n\nMariaDB 10.0.11 introduced the default_regex_flags variable to address the\nremaining compatibilities between PCRE and the old regex library.\n\nThe default behaviour (multiline match is off)\n\nSELECT \'a\\nb\\nc\' RLIKE \'^b$\';\n+---------------------------+\n| \'(?m)a\\nb\\nc\' RLIKE \'^b$\' |\n+---------------------------+\n| 0 |\n+---------------------------+\n\nEnabling the multiline option using the PCRE option syntax:\n\nSELECT \'a\\nb\\nc\' RLIKE \'(?m)^b$\';\n+---------------------------+\n| \'a\\nb\\nc\' RLIKE \'(?m)^b$\' |\n+---------------------------+\n| 1 |\n+---------------------------+\n\nEnabling the multiline option using default_regex_flags\n\nSET default_regex_flags=\'MULTILINE\';\nSELECT \'a\\nb\\nc\' RLIKE \'^b$\';\n+-----------------------+\n| \'a\\nb\\nc\' RLIKE \'^b$\' |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/regexp/','','https://mariadb.com/kb/en/regexp/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (626,36,'REGEXP_INSTR','Syntax\n------\n\nREGEXP_INSTR(subject, pattern)\n\nReturns the position of the first occurrence of the regular expression pattern\nin the string subject, or 0 if pattern was not found.\n\nThe positions start with 1 and are measured in characters (i.e. not in bytes),\nwhich is important for multi-byte character sets. You can cast a multi-byte\ncharacter set to BINARY to get offsets in bytes.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_INSTR was introduced as part of this\nenhancement.\n\nExamples\n--------\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 in bytes:\n\nSELECT REGEXP_INSTR(BINARY \'BJÖRN\',\'N\') AS cast_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\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 (627,36,'REGEXP_REPLACE','Syntax\n------\n\nREGEXP_REPLACE(subject, pattern, replace)\n\nDescription\n-----------\n\nREGEXP_REPLACE returns the string subject with all occurrences of the regular\nexpression pattern replaced by the string replace. If no occurrences are\nfound, then subject is returned as is.\n\nThe replace string can have backreferences to the subexpressions in the form\n\\N, where N is a number from 1 to 9.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_REPLACE was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_REPLACE(\'ab12cd\',\'[0-9]\',\'\') AS remove_digits;\n-> abcd\n\nSELECT\nREGEXP_REPLACE(\'<html><head><title>title</title><body>body</body></htm>\',\n\'<.+?>\',\' \')\nAS strip_html;\n-> title body\n\nBackreferences to the subexpressions in the form \\N, where N is a number from\n1 to 9:\n\nSELECT REGEXP_REPLACE(\'James Bond\',\'^(.*) (.*)$\',\'\\\\2, \\\\1\') AS reorder_name;\n-> Bond, James\n\nCase insensitive and case sensitive matches:\n\nSELECT REGEXP_REPLACE(\'ABC\',\'b\',\'-\') AS case_insensitive;\n-> A-C\n\nSELECT REGEXP_REPLACE(\'ABC\' COLLATE utf8_bin,\'b\',\'-\') AS case_sensitive;\n-> ABC\n\nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'b\',\'-\') AS binary_data;\n-> ABC\n\nOverwriting the collation case sensitivity using the (?i) and (?-i) PCRE flags.\n\nSELECT REGEXP_REPLACE(\'ABC\',\'(?-i)b\',\'-\') AS force_case_sensitive;\n-> ABC\n\nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'(?i)b\',\'-\') AS force_case_insensitive;\n-> A-C\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 (628,36,'REGEXP_SUBSTR','Syntax\n------\n\nREGEXP_SUBSTR(subject,pattern)\n\nDescription\n-----------\n\nReturns the part of the string subject that matches the regular expression\npattern, or an empty string if pattern was not found.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_SUBSTR was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\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\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 (629,36,'ASCII','Syntax\n------\n\nASCII(str)\n\nDescription\n-----------\n\nReturns the numeric ASCII value of the leftmost character of the string\nargument. Returns 0 if the given string is empty and NULL if it is NULL.\n\nASCII() works for 8-bit characters.\n\nExamples\n--------\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\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 (630,36,'BIN','Syntax\n------\n\nBIN(N)\n\nDescription\n-----------\n\nReturns a string representation of the binary value of the given longlong\n(that is, BIGINT) number. This is equivalent to CONV(N,10,2). The argument\nshould be positive. If it is a FLOAT, it will be truncated. Returns NULL if\nthe argument is NULL.\n\nExamples\n--------\n\nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\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 (631,36,'BINARY Operator','This page describes the BINARY operator. For details about the data type, see\nBinary Data Type.\n\nSyntax\n------\n\nBINARY\n\nDescription\n-----------\n\nThe BINARY operator casts the string following it to a binary string. This is\nan easy way to force a column comparison to be done byte by byte rather than\ncharacter by character. This causes the comparison to be case sensitive even\nif the column isn\'t defined as BINARY or BLOB.\n\nBINARY also causes trailing spaces to be significant.\n\nExamples\n--------\n\nSELECT \'a\' = \'A\';\n+-----------+\n| \'a\' = \'A\' |\n+-----------+\n| 1 |\n+-----------+\n\nSELECT BINARY \'a\' = \'A\';\n+------------------+\n| BINARY \'a\' = \'A\' |\n+------------------+\n| 0 |\n+------------------+\n\nSELECT \'a\' = \'a \';\n+------------+\n| \'a\' = \'a \' |\n+------------+\n| 1 |\n+------------+\n\nSELECT BINARY \'a\' = \'a \';\n+-------------------+\n| BINARY \'a\' = \'a \' |\n+-------------------+\n| 0 |\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 (632,36,'BIT_LENGTH','Syntax\n------\n\nBIT_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument in bits. If the argument is\nnot a string, it will be converted to string. If the argument is NULL, it\nreturns NULL.\n\nExamples\n--------\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-------------\n\nPostgreSQL and Sybase support BIT_LENGTH().\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 (633,36,'CAST','Syntax\n------\n\nCAST(expr AS type)\n\nDescription\n-----------\n\nThe CAST() function takes a value of one type and produces a value of another\ntype, similar to the CONVERT() function.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nThe main difference between CAST and CONVERT() is that CONVERT(expr,type) is\nODBC syntax while CAST(expr as type) and CONVERT(... USING ...) are SQL92\nsyntax.\n\nIn MariaDB 10.4 and later, you can use the CAST() function with the INTERVAL\nkeyword.\n\nUntil MariaDB 5.5.31, X\'HHHH\', the standard SQL syntax for binary string\nliterals, erroneously worked in the same way as 0xHHHH. In 5.5.31 it was\nintentionally changed to behave as a string in all contexts (and never as a\nnumber).\n\nThis introduced an incompatibility with previous versions of MariaDB, and all\nversions of MySQL (see the example below).\n\nExamples\n--------\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 character set, the\ncollation_connection character set collation will be used. When used with CHAR\nCHARACTER SET, the 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 the 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 utf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n\nUsing CAST() to order an ENUM field as a CHAR rather than the internal\nnumerical 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| 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, since x\'aa\' and\n\'X\'aa\' no longer behave as a number. Previously, and in all versions of MySQL,\nno warnings are triggered since they did erroneously behave as a number:\n\nSELECT CAST(0xAA AS UNSIGNED), CAST(x\'aa\' AS UNSIGNED), CAST(X\'aa\' AS\nUNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x\'aa\' AS UNSIGNED) | CAST(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: \'\\xAA\'\nWarning (Code 1292): Truncated incorrect INTEGER value: \'\\xAA\'\n\nCasting to intervals:\n\nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS \"Cast\";\n\n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\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 (634,36,'CHAR Function','Syntax\n------\n\nCHAR(N,... [USING charset_name])\n\nDescription\n-----------\n\nCHAR() interprets each argument as an INT and returns a string consisting of\nthe characters given by the code values of those integers. NULL values are\nskipped. By default, CHAR() 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 given character\nset, a warning is issued. Also, if strict SQL mode is enabled, the result from\nCHAR() becomes NULL.\n\nExamples\n--------\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: \'77.3\'\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 (635,36,'CHAR_LENGTH','Syntax\n------\n\nCHAR_LENGTH(str)\nCHARACTER_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument, measured in characters. A\nmulti-byte character counts as a single character. This means that for a\nstring containing five two-byte characters, LENGTH() (or OCTET_LENGTH() in\nOracle mode) returns 10, whereas CHAR_LENGTH() returns 5. If the argument is\nNULL, it returns NULL.\n\nIf the argument is not a string value, it is converted into a string.\n\nIt is synonymous with the CHARACTER_LENGTH() function.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH(\'MariaDB\');\n+------------------------+\n| CHAR_LENGTH(\'MariaDB\') |\n+------------------------+\n| 7 |\n+------------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (636,36,'CHR','MariaDB starting with 10.3.1\n----------------------------\nThe CHR() function was introduced in MariaDB 10.3.1 to provide Oracle\ncompatibility\n\nSyntax\n------\n\nCHR(N)\n\nDescription\n-----------\n\nCHR() interprets each argument N as an integer and returns a VARCHAR(1) string\nconsisting of the character given by the code values of the integer. The\ncharacter set and collation of the string are set according to the values of\nthe character_set_database and collation_database system variables.\n\nCHR() is similar to the CHAR() function, but only accepts a single argument.\n\nCHR() is available in all sql_modes.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: \'C\' |\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 (637,36,'CONCAT','Syntax\n------\n\nCONCAT(str1,str2,...)\n\nDescription\n-----------\n\nReturns the string that results from concatenating the arguments. May have one\nor more arguments. If all arguments are non-binary strings, the result is a\nnon-binary string. If the arguments include any binary strings, the result is\na binary string. A numeric argument is converted to its equivalent binary\nstring form; if you want to avoid that, you can use an explicit type cast, as\nin 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 parameters from the\nresult. Sometimes this is not desirable; to avoid this, you can:\n\n* Use the CONCAT_WS() function with an empty separator, because that function\nis NULL-safe.\n* Use IFNULL() to turn NULLs into empty strings.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n\nExamples\n--------\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\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 (638,36,'CONCAT_WS','Syntax\n------\n\nCONCAT_WS(separator,str1,str2,...)\n\nDescription\n-----------\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form of\nCONCAT(). The first argument is the separator for the rest of the arguments.\nThe separator is added 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 values are\nskipped. This makes CONCAT_WS() suitable when you want to concatenate some\nvalues and avoid losing all information if one of them is NULL.\n\nExamples\n--------\n\nSELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n+-------------------------------------------------------+\n| CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\') |\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 string:\n\nSET @a = \'gnu\', @b = \'penguin\', @c = \'sea lion\';\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\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 (639,36,'CONVERT','Syntax\n------\n\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nDescription\n-----------\n\nThe CONVERT() and CAST() functions take a value of one type and produce a\nvalue of another type.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nNote that in MariaDB, INT and INTEGER are the same thing.\n\nBINARY produces a string with the BINARY data type. If the optional length is\ngiven, BINARY(N) causes the cast to use no more than N bytes of the argument.\nValues shorter than the given number in bytes are padded with 0x00 bytes to\nmake them equal the length value.\n\nCHAR(N) causes the cast to use no more than the number of characters given in\nthe argument.\n\nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type) and CONVERT(...\nUSING ...) are SQL92 syntax.\n\nCONVERT() with USING is used to convert data between different character sets.\nIn MariaDB, transcoding names are the same as the corresponding character set\nnames. For example, this statement converts the string \'abc\' in the default\ncharacter set to the corresponding string in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nExamples\n--------\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 to 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\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 (640,36,'ELT','Syntax\n------\n\nELT(N, str1[, str2, str3,...])\n\nDescription\n-----------\n\nTakes a numeric argument and a series of string arguments. Returns the string\nthat corresponds to the given numeric position. For instance, it returns str1\nif N is 1, str2 if N is 2, and so on. If the numeric argument is a FLOAT,\nMariaDB rounds it to the nearest INTEGER. If the numeric argument is less than\n1, greater than the total number of arguments, or not a number, ELT() returns\nNULL. It must have at least two arguments.\n\nIt is complementary to the FIELD() function.\n\nExamples\n--------\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\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 (641,36,'EXPORT_SET','Syntax\n------\n\nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n\nDescription\n-----------\n\nTakes a minimum of three arguments. Returns a string where each bit in the\ngiven bits argument is returned, with the string values given for on and off.\n\nBits are examined from right to left, (from low-order to high-order bits).\nStrings are added to the result from left to right, separated by a separator\nstring (defaults as \',\'). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits option.\n\nIf any of the arguments are set as NULL, the function returns NULL.\n\nExamples\n--------\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\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 (642,36,'EXTRACTVALUE','Syntax\n------\n\nEXTRACTVALUE(xml_frag, xpath_expr)\n\nDescription\n-----------\n\nThe EXTRACTVALUE() function takes two string arguments: a fragment of XML\nmarkup and an XPath expression, (also known as a locator). It returns the text\n(That is, CDDATA), of the first text node which is a child of the element or\nelements matching the XPath expression.\n\nIn cases where a valid XPath expression does not match any text nodes in a\nvalid XML fragment, (including the implicit /text() expression), the\nEXTRACTVALUE() function returns an empty string.\n\nInvalid Arguments\n-----------------\n\nWhen either the XML fragment or the XPath expression is NULL, the\nEXTRACTVALUE() function returns NULL. When the XML fragment is invalid, it\nraises a warning Code 1525:\n\nWarning (Code 1525): Incorrect XML value: \'parse error at line 1 pos 11:\nunexpected 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---------------------------\n\nThis function is the equivalent of performing a match using the XPath\nexpression after appending /text(). In other words:\n\nSELECT\n EXTRACTVALUE(\'<cases><case>example</case></cases>\', \'/cases/case\')\n AS \'Base Example\',\n EXTRACTVALUE(\'<cases><case>example</case></cases>\', \'/cases/case/text()\')\n AS \'text() Example\';\n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n\nCount Matches\n-------------\n\nWhen EXTRACTVALUE() returns multiple matches, it returns the content of the\nfirst child text node of each matching element, in the matched order, as a\nsingle, space-delimited string.\n\nBy design, the EXTRACTVALUE() function makes no distinction between a match on\nan empty element and no match at all. If you need to determine whether no\nmatching element was found in the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count() function.\n\nFor instance, when looking for a value that exists, but contains no child text\nnodes, you would get a count of the number of matching instances:\n\nSELECT\n EXTRACTVALUE(\'<cases><case/></cases>\', \'/cases/case\')\n AS \'Empty Example\',\n EXTRACTVALUE(\'<cases><case/></cases>\', \'count(/cases/case)\')\n AS \'count() Example\';\n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n\nAlternatively, when looking for a value that doesn\'t exist, count() returns 0.\n\nSELECT\n EXTRACTVALUE(\'<cases><case/></cases>\', \'/cases/person\')\n AS \'No Match Example\',\n EXTRACTVALUE(\'<cases><case/></cases>\', \'count(/cases/person)\')\n AS \'count() Example\';\n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n\nMatches\n-------\n\nImportant: The EXTRACTVALUE() function only returns CDDATA. It does not return\ntags that the element might contain or the text that these child elements\ncontain.\n\nSELECT\n\nEXTRACTVALUE(\'<cases><case>Person<email>x@example.com</email></case></cases>\',\n\'/cases\')\n AS Case;\n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n\nNote, in the above example, while the XPath expression matches to the parent\n<case> instance, it does not return the contained <email> tag or its content.\n\nExamples\n--------\n\nSELECT\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\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 (643,36,'FIELD','Syntax\n------\n\nFIELD(pattern, str1[,str2,...])\n\nDescription\n-----------\n\nReturns the index position of the string or number matching the given pattern.\nReturns 0 in the event that none of the arguments match the pattern. Raises an\nError 1582 if not given at least two arguments.\n\nWhen all arguments given to the FIELD() function are strings, they are treated\nas case-insensitive. When all the arguments are numbers, they are treated as\nnumbers. Otherwise, they are treated as doubles.\n\nIf the given pattern occurs more than once, the FIELD() function only returns\nthe index of the first instance. If the given pattern is NULL, the function\nreturns 0, as a NULL pattern always fails to match.\n\nThis function is complementary to the ELT() function.\n\nExamples\n--------\n\nSELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\') \n AS \'Field Results\';\n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n\nSELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\')\n AS \'Field Results\';\n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD(1, 2, 3, 4, 5, 1) AS \'Field Results\';\n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n\nSELECT FIELD(NULL, 2, 3) AS \'Field Results\';\n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD(\'fail\') AS \'Field Results\';\nError 1582 (42000): Incorrect parameter count in call\nto native function \'field\'\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 (644,36,'FIND_IN_SET','Syntax\n------\n\nFIND_IN_SET(pattern, strlist)\n\nDescription\n-----------\n\nReturns the index position where the given pattern occurs in a string list.\nThe first argument is the pattern you want to search for. The second argument\nis a string containing comma-separated variables. If the second argument is of\nthe SET data-type, the function is optimized to use bit arithmetic.\n\nIf the pattern does not occur in the string list or if the string list is an\nempty string, the function returns 0. If either argument is NULL, the function\nreturns NULL. The function does not return the correct result if the pattern\ncontains a comma (\",\") character.\n\nExamples\n--------\n\nSELECT FIND_IN_SET(\'b\',\'a,b,c,d\') AS \"Found Results\";\n+---------------+\n| Found Results |\n+---------------+\n| 2 |\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 (645,36,'FORMAT','Syntax\n------\n\nFORMAT(num, decimal_position[, locale])\n\nDescription\n-----------\n\nFormats the given number for display as a string, adding separators to\nappropriate position and rounding the results to the given decimal position.\nFor instance, it would format 15233.345 to 15,233.35.\n\nIf the given decimal position is 0, it rounds to return no decimal point or\nfractional part. You can optionally specify a locale value to format numbers\nto the pattern appropriate for the given region.\n\nExamples\n--------\n\nSELECT FORMAT(1234567890.09876543210, 4) AS \'Format\';\n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n\nSELECT FORMAT(1234567.89, 4) AS \'Format\';\n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n\nSELECT FORMAT(1234567.89, 0) AS \'Format\';\n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n\nSELECT FORMAT(123456789,2,\'rm_CH\') AS \'Format\';\n+----------------+\n| Format |\n+----------------+\n| 123\'456\'789,00 |\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 (646,36,'FROM_BASE64','Syntax\n------\n\nFROM_BASE64(str)\n\nDescription\n-----------\n\nDecodes the given base-64 encode string, returning the result as a binary\nstring. Returns NULL if the given string is 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. MariaDB uses the\nfollowing:\n\n* It encodes alphabet value 64 as \'+\'.\n* It encodes alphabet value 63 as \'/\'.\n* It codes output in groups of four printable characters. Each three byte of\ndata encoded uses four characters. If the final group is incomplete, it pads\nthe difference with the \'=\' character.\n* It divides long output, adding a new line very 76 characters.\n* In decoding, it recognizes and ignores newlines, carriage returns, tabs and\nspace whitespace characters.\n\nSELECT TO_BASE64(\'Maria\') AS \'Input\';\n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n\nSELECT FROM_BASE64(\'TWFyaWE=\') AS \'Output\';\n+--------+\n| Output |\n+--------+\n| Maria |\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 (647,36,'HEX','Syntax\n------\n\nHEX(N_or_S)\n\nDescription\n-----------\n\nIf N_or_S is a number, returns a string representation of the hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,16).\n\nIf N_or_S is a string, returns a hexadecimal string representation of N_or_S\nwhere each byte of each character in N_or_S is converted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this operation is\nperformed by the UNHEX() function.\n\nMariaDB starting with 10.5.0\n----------------------------\nHEX() with an INET6 argument returns a hexadecimal representation of the\nunderlying 16-byte binary string.\n\nExamples\n--------\n\nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n\nSELECT 0x4D617269614442;\n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n\nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n\nFrom MariaDB 10.5.0:\n\nSELECT HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6));\n+----------------------------------------------+\n| HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6)) |\n+----------------------------------------------+\n| 20010DB8000000000000FF0000428329 |\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 (648,36,'INSTR','Syntax\n------\n\nINSTR(str,substr)\n\nDescription\n-----------\n\nReturns the position of the first occurrence of substring substr in string\nstr. This is the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nINSTR() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\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\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 (649,36,'LCASE','Syntax\n------\n\nLCASE(str)\n\nDescription\n-----------\n\nLCASE() is a synonym for LOWER().\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 (650,36,'LEFT','Syntax\n------\n\nLEFT(str,len)\n\nDescription\n-----------\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT LEFT(\'MariaDB\', 5);\n+--------------------+\n| LEFT(\'MariaDB\', 5) |\n+--------------------+\n| Maria |\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 (651,36,'INSERT Function','Syntax\n------\n\nINSERT(str,pos,len,newstr)\n\nDescription\n-----------\n\nReturns the string str, with the substring beginning at position pos and len\ncharacters long replaced by the string newstr. Returns the original string if\npos is not within the length of the string. Replaces the rest of the string\nfrom position pos if len is not within the length of the rest of the string.\nReturns NULL if any argument is NULL.\n\nExamples\n--------\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\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 (652,36,'LENGTH','Syntax\n------\n\nLENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the string str.\n\nIn the default mode, when Oracle mode from MariaDB 10.3 is not set, the length\nis measured in bytes. In this case, a multi-byte character counts as multiple\nbytes. This means that for a string containing five two-byte characters,\nLENGTH() returns 10, whereas CHAR_LENGTH() returns 5.\n\nWhen running Oracle mode from MariaDB 10.3, the length is measured in\ncharacters, and LENGTH is a synonym for CHAR_LENGTH().\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nSELECT LENGTH(\'MariaDB\');\n+-------------------+\n| LENGTH(\'MariaDB\') |\n+-------------------+\n| 7 |\n+-------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (653,36,'LENGTHB','MariaDB starting with 10.3.1\n----------------------------\nIntroduced in MariaDB 10.3.1 as part of the Oracle compatibility enhancements.\n\nSyntax\n------\n\nLENGTHB(str)\n\nDescription\n-----------\n\nLENGTHB() returns the length of the given string, in bytes. When Oracle mode\nis not set, this is a synonym for LENGTH.\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, LENGTHB() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (654,36,'LIKE','Syntax\n------\n\nexpr LIKE pat [ESCAPE \'escape_char\']\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nDescription\n-----------\n\nTests whether expr matches the pattern pat. Returns either 1 (TRUE) or 0\n(FALSE). Both expr and pat may be any valid expression and are evaluated to\nstrings. Patterns may use the following wildcard characters:\n\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. This is equivalent\nto using the NOT operator on the entire LIKE expression.\n\nIf either the expression or the pattern is NULL, the result is NULL.\n\nLIKE performs case-insensitive substring matches if the collation for the\nexpression and pattern is case-insensitive. For case-sensitive matches,\ndeclare either argument to use a binary collation using COLLATE, or coerce\neither of them to a BINARY string using CAST. Use SHOW COLLATION to get a list\nof available collations. Collations ending in _bin are case-sensitive.\n\nNumeric arguments are coerced to binary strings.\n\nThe _ wildcard matches a single character, not byte. It will only match a\nmulti-byte character if it is valid in the expression\'s character set. For\nexample, _ will match _utf8\"€\", but it will not match _latin1\"€\" because the\nEuro sign is not a valid latin1 character. If necessary, use CONVERT to use\nthe expression in a different character set.\n\nIf you need to match the characters _ or %, you must escape them. By default,\nyou can prefix the wildcard characters the backslash character \\ to escape\nthem. The backslash is used both to encode special characters like newlines\nwhen a string is parsed as well as to escape wildcards in a pattern after\nparsing. Thus, to match an actual backslash, you sometimes need to\ndouble-escape it as \"\\\\\\\\\".\n\nTo avoid difficulties with the backslash character, you can change the\nwildcard escape character using ESCAPE in a LIKE expression. The argument to\nESCAPE must be a single-character string.\n\nExamples\n--------\n\nSelect the days that begin with \"T\":\n\nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES \n (\"Monday\"), (\"Tuesday\"), (\"Wednesday\"),\n (\"Thursday\"), (\"Friday\"), (\"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 case-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 match. Select\ndates based 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---------------\n\n* MariaDB can use indexes for LIKE on string columns in the case where the\nLIKE doesn\'t start with % or _.\n* Starting from MariaDB 10.0, one can set the\noptimizer_use_condition_selectivity variable to 5. If this is done, then the\noptimizer will read optimizer_selectivity_sampling_limit rows to calculate the\nselectivity of the LIKE expression before starting to calculate the query\nplan. This can help speed up some LIKE queries by providing the optimizer with\nmore information about your data.\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 (655,36,'LOCATE','Syntax\n------\n\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nDescription\n-----------\n\nThe first syntax returns the position of the first occurrence of substring\nsubstr in string str. The second syntax returns the position of the first\noccurrence of substring substr in string str, starting at position pos.\nReturns 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 the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nExamples\n--------\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\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 (656,36,'LOWER','Syntax\n------\n\nLOWER(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to lowercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nExamples\n--------\n\nSELECT LOWER(\'QUADRATICALLY\');\n+------------------------+\n| LOWER(\'QUADRATICALLY\') |\n+------------------------+\n| quadratically |\n+------------------------+\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings (BINARY,\nVARBINARY, BLOB). To 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\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 (657,36,'LPAD','Syntax\n------\n\nLPAD(str, len [,padstr])\n\nDescription\n-----------\n\nReturns the string str, left-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the LPAD 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 empty (zero length),\nreturns either an empty string or, from MariaDB 10.3.6 with SQL_MODE=Oracle,\nNULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LPAD_ORACLE as the function name.\n\nExamples\n--------\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 space.\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\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 (658,36,'LTRIM','Syntax\n------\n\nLTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with leading space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LTRIM_ORACLE as the function name.\n\nExamples\n--------\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\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 (659,36,'MAKE_SET','Syntax\n------\n\nMAKE_SET(bits,str1,str2,...)\n\nDescription\n-----------\n\nReturns a set value (a string containing substrings separated by \",\"\ncharacters) consisting of the strings that have the corresponding bit in bits\nset. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL values in str1,\nstr2, ... are not appended to the result.\n\nExamples\n--------\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\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 (660,36,'MATCH AGAINST','Syntax\n------\n\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nDescription\n-----------\n\nA special construct used to perform a fulltext search on a fulltext index.\n\nSee Fulltext Index Overview for a full description, and Full-text Indexes for\nmore articles on the topic.\n\nExamples\n--------\n\nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy)) ENGINE=MyISAM;\n\nINSERT INTO ft_myisam(copy) VALUES (\'Once upon a time\'), (\'There was a wicked\nwitch\'), \n (\'Who ate everybody up\');\n\nSELECT * FROM ft_myisam WHERE MATCH(copy) AGAINST(\'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| 6 | When configured properly, MySQL ... | 1.3114095926285 |\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 (661,36,'MID','Syntax\n------\n\nMID(str,pos,len)\n\nDescription\n-----------\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nExamples\n--------\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\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 (662,36,'NOT LIKE','Syntax\n------\n\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nDescription\n-----------\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\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 (663,36,'OCTET_LENGTH','Syntax\n------\n\nOCTET_LENGTH(str)\n\nDescription\n-----------\n\nOCTET_LENGTH() returns the length of the given string, in octets (bytes). This\nis a synonym for LENGTHB(), and, when Oracle mode from MariaDB 10.3 is not\nset, a synonym for LENGTH().\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, OCTET_LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (664,36,'ORD','Syntax\n------\n\nORD(str)\n\nDescription\n-----------\n\nIf the leftmost character of the string str is a multi-byte character, returns\nthe code for that character, calculated from the numeric values of its\nconstituent 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, ORD() returns the\nsame value as the ASCII() function.\n\nExamples\n--------\n\nSELECT ORD(\'2\');\n+----------+\n| ORD(\'2\') |\n+----------+\n| 50 |\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 (665,36,'POSITION','Syntax\n------\n\nPOSITION(substr IN str)\n\nDescription\n-----------\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nIt\'s part of ODBC 3.0.\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 (666,36,'QUOTE','Syntax\n------\n\nQUOTE(str)\n\nDescription\n-----------\n\nQuotes a string to produce a result that can be used as a properly escaped\ndata value in an SQL statement. The string is returned enclosed by single\nquotes and with each instance of single quote (\"\'\"), backslash (\"\\\"), ASCII\nNUL, and Control-Z preceded by a backslash. If the argument is NULL, the\nreturn value is the word \"NULL\" without enclosing single quotes.\n\nExamples\n--------\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\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 (667,36,'REPEAT Function','Syntax\n------\n\nREPEAT(str,count)\n\nDescription\n-----------\n\nReturns a string consisting of the string str repeated count times. If count\nis less than 1, returns an empty string. Returns NULL if str or count are NULL.\n\nExamples\n--------\n\nSELECT QUOTE(REPEAT(\'MariaDB \',4));\n+------------------------------------+\n| QUOTE(REPEAT(\'MariaDB \',4)) |\n+------------------------------------+\n| \'MariaDB MariaDB MariaDB MariaDB \' |\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 (668,36,'REPLACE Function','Syntax\n------\n\nREPLACE(str,from_str,to_str)\n\nDescription\n-----------\n\nReturns the string str with all occurrences of the string from_str replaced by\nthe string to_str. REPLACE() performs a case-sensitive match when searching\nfor from_str.\n\nExamples\n--------\n\nSELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n+---------------------------------------+\n| REPLACE(\'www.mariadb.org\', \'w\', \'Ww\') |\n+---------------------------------------+\n| WwWwWw.mariadb.org |\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 (669,36,'REVERSE','Syntax\n------\n\nREVERSE(str)\n\nDescription\n-----------\n\nReturns the string str with the order of the characters reversed.\n\nExamples\n--------\n\nSELECT REVERSE(\'desserts\');\n+---------------------+\n| REVERSE(\'desserts\') |\n+---------------------+\n| stressed |\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 (670,36,'RIGHT','Syntax\n------\n\nRIGHT(str,len)\n\nDescription\n-----------\n\nReturns the rightmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\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 (671,36,'RPAD','Syntax\n------\n\nRPAD(str, len [, padstr])\n\nDescription\n-----------\n\nReturns the string str, right-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the RPAD 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 empty (a length of\nzero), returns either an empty string, or, from MariaDB 10.3.6 with\nSQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RPAD_ORACLE as the function name.\n\nExamples\n--------\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 space.\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\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 (672,36,'RTRIM','Syntax\n------\n\nRTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with trailing space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RTRIM_ORACLE as the function name.\n\nExamples\n--------\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\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 (673,36,'SOUNDEX','Syntax\n------\n\nSOUNDEX(str)\n\nDescription\n-----------\n\nReturns a soundex string from str. Two strings that sound almost the same\nshould have identical soundex strings. A standard soundex string is four\ncharacters long, but the SOUNDEX() function returns an arbitrarily long\nstring. You can use SUBSTRING() on the result to get a standard soundex\nstring. All non-alphabetic characters in str are ignored. All international\nalphabetic characters outside the A-Z range are treated as vowels.\n\nImportant: When using SOUNDEX(), you should be aware of the following details:\n\n* This function, as currently implemented, is intended to work well with\n strings that are in the English language only. Strings in other languages may\n not produce reasonable results.\n\n* This function implements the original Soundex algorithm, not the more\npopular enhanced version (also described by D. Knuth). The difference is that\noriginal version discards vowels first and duplicates second, whereas the\nenhanced version discards duplicates first and vowels second.\n\nExamples\n--------\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 SOUNDEX(givenname) =\nSOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\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 (674,36,'SOUNDS LIKE','Syntax\n------\n\nexpr1 SOUNDS LIKE expr2\n\nDescription\n-----------\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nExample\n-------\n\nSELECT givenname, surname FROM users WHERE givenname SOUNDS LIKE \"robert\";\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\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 (675,36,'SPACE','Syntax\n------\n\nSPACE(N)\n\nDescription\n-----------\n\nReturns a string consisting of N space characters. If N is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\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 (676,36,'STRCMP','Syntax\n------\n\nSTRCMP(expr1,expr2)\n\nDescription\n-----------\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first argument is\nsmaller than the second according to the current sort order, and 1 if the\nstrings are otherwise not the same. Returns NULL is either argument is NULL.\n\nExamples\n--------\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\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 (677,36,'SUBSTR','Description\n-----------\n\nSUBSTR() is a synonym for SUBSTRING().\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 (678,36,'SUBSTRING','Syntax\n------\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-----------\n\nThe forms without a len argument return a substring from string str starting\nat position pos.\n\nThe forms with a len argument return a substring len characters long from\nstring 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 case, the\nbeginning of the substring is pos characters from the end of the string,\nrather than the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nBy default, the position of the first character in the string from which the\nsubstring is to be extracted is reckoned as 1. For Oracle-compatibility, from\nMariaDB 10.3.3, when sql_mode is set to \'oracle\', position zero is treated as\nposition 1 (although the first character is still reckoned as 1).\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\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\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 (679,36,'SUBSTRING_INDEX','Syntax\n------\n\nSUBSTRING_INDEX(str,delim,count)\n\nDescription\n-----------\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the final\ndelimiter (counting from the left) is returned. If count is negative,\neverything to the right of the final delimiter (counting from the right) is\nreturned. SUBSTRING_INDEX() performs a case-sensitive match when searching for\ndelim.\n\nIf any argument is NULL, returns NULL.\n\nFor example\n\nSUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2)\n\nmeans \"Return all of the characters up to the 2nd occurrence of .\"\n\nExamples\n--------\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\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 (680,36,'TO_BASE64','Syntax\n------\n\nTO_BASE64(str)\n\nDescription\n-----------\n\nConverts the string argument str to its base-64 encoded form, returning the\nresult as a character string in the connection character set and collation.\n\nThe argument str will be converted to string first if it is not a string. A\nNULL argument will return a NULL result.\n\nThe reverse function, FROM_BASE64(), decodes an encoded base-64 string.\n\nThere are a numerous different methods to base-64 encode a string. The\nfollowing are used by MariaDB and MySQL:\n\n* Alphabet value 64 is encoded as \'+\'.\n* Alphabet value 63 is encoded as \'/\'.\n* Encoding output is made up of groups of four printable characters, with each\nthree bytes of data encoded using four characters. If the final group is not\ncomplete, it is padded with \'=\' characters to make up a length of four.\n* To divide long output, a newline is added after every 76 characters.\n* Decoding will recognize and ignore newlines, carriage returns, tabs, and\nspaces.\n\nExamples\n--------\n\nSELECT TO_BASE64(\'Maria\');\n+--------------------+\n| TO_BASE64(\'Maria\') |\n+--------------------+\n| TWFyaWE= |\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 (681,36,'TO_CHAR','MariaDB starting with 10.6.1\n----------------------------\nThe TO_CHAR function was introduced in MariaDB 10.6.1 to enhance Oracle\ncompatibility.\n\nSyntax\n------\n\nTO_CHAR(expr[, fmt])\n\nDescription\n-----------\n\nThe TO_CHAR function converts an expr of type date, datetime, time or\ntimestamp to a string. The optional fmt argument supports\nYYYY/YYY/YY/RRRR/RR/MM/MON/MONTH/MI/DD/DY/HH/HH12/HH24/SS and special\ncharacters. The default value is \"YYYY-MM-DD HH24:MI:SS\".\n\nIn Oracle, TO_CHAR can also be used to convert numbers to strings, but this is\nnot supported in MariaDB and will give an error.\n\nExamples\n--------\n\nSELECT TO_CHAR(\'1980-01-11 04:50:39\', \'YYYY-MM-DD\');\n+----------------------------------------------+\n| TO_CHAR(\'1980-01-11 04:50:39\', \'YYYY-MM-DD\') |\n+----------------------------------------------+\n| 1980-01-11 |\n+----------------------------------------------+\n\nSELECT TO_CHAR(\'1980-01-11 04:50:39\', \'HH24-MI-SS\');\n+----------------------------------------------+\n| TO_CHAR(\'1980-01-11 04:50:39\', \'HH24-MI-SS\') |\n+----------------------------------------------+\n| 04-50-39 |\n+----------------------------------------------+\n\nSELECT TO_CHAR(\'00-01-01 00:00:00\', \'YY-MM-DD HH24:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'00-01-01 00:00:00\', \'YY-MM-DD HH24:MI:SS\') |\n+-----------------------------------------------------+\n| 00-01-01 00:00:00 |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(\'99-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'99-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\') |\n+-----------------------------------------------------+\n| 99-12-31 23:59:59 |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(\'9999-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\');\n+-------------------------------------------------------+\n| TO_CHAR(\'9999-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\') |\n+-------------------------------------------------------+\n| 99-12-31 23:59:59 |\n+-------------------------------------------------------+\n\nSELECT TO_CHAR(\'21-01-03 08:30:00\', \'Y-MONTH-DY HH:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'21-01-03 08:30:00\', \'Y-MONTH-DY HH:MI:SS\') |\n+-----------------------------------------------------+\n| 1-January -Sun 08:30:00 |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/to_char/','','https://mariadb.com/kb/en/to_char/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (682,36,'TRIM','Syntax\n------\n\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str)\n\nFrom MariaDB 10.3.6\n\nTRIM_ORACLE([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nDescription\n-----------\n\nReturns the string str with all remstr prefixes or suffixes removed. If none\nof the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. remstr\nis optional and, if not specified, spaces are removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\nSQL_MODE=Oracle is not set by default.\n\nThe Oracle mode version of the function can be accessed in any mode by using\nTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT TRIM(\' bar \')\\G\n*************************** 1. row ***************************\nTRIM(\' bar \'): bar\n\nSELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row ***************************\nTRIM(LEADING \'x\' FROM \'xxxbarxxx\'): barxxx\n\nSELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row ***************************\nTRIM(BOTH \'x\' FROM \'xxxbarxxx\'): bar\n\nSELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\')\\G\n*************************** 1. row ***************************\nTRIM(TRAILING \'xyz\' FROM \'barxxyz\'): barx\n\nFrom MariaDB 10.3.6, with SQL_MODE=Oracle not set:\n\nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| | NULL |\n+----------+-----------------+\n\nFrom MariaDB 10.3.6, with SQL_MODE=Oracle set:\n\nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| NULL | NULL |\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 (683,36,'UCASE','Syntax\n------\n\nUCASE(str)\n\nDescription\n-----------\n\nUCASE() is a synonym for UPPER().\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 (684,36,'UNCOMPRESSED_LENGTH','Syntax\n------\n\nUNCOMPRESSED_LENGTH(compressed_string)\n\nDescription\n-----------\n\nReturns the length that the compressed string had before being compressed with\nCOMPRESS().\n\nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if the string is not\ncompressed.\n\nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or bigint(10), in all\ncases. From MariaDB 10.3.1, returns MYSQL_TYPE_LONG, or int(10), when the\nresult would fit within 32-bits.\n\nExamples\n--------\n\nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30))) |\n+-----------------------------------------------+\n| 30 |\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 (685,36,'UNHEX','Syntax\n------\n\nUNHEX(str)\n\nDescription\n-----------\n\nPerforms the inverse operation of HEX(str). That is, it interprets each pair\nof hexadecimal digits in the argument as a number and converts it to the\ncharacter represented by the number. The resulting characters are returned as\na binary string.\n\nIf str is NULL, UNHEX() returns NULL.\n\nExamples\n--------\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| 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\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 (686,36,'UPDATEXML','Syntax\n------\n\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nDescription\n-----------\n\nThis function replaces a single portion of a given fragment of XML markup\nxml_target with a new XML fragment new_xml, and then returns the changed XML.\nThe portion of xml_target that is replaced matches an XPath expression\nxpath_expr supplied by the user. If no expression matching xpath_expr is\nfound, or if multiple matches are found, the function returns the original\nxml_target XML fragment. All three arguments should be strings.\n\nExamples\n--------\n\nSELECT\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n \\G\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n1 row in set (0.00 sec)\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 (687,36,'UPPER','Syntax\n------\n\nUPPER(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to uppercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nSELECT UPPER(surname), givenname FROM users ORDER BY surname;\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 (BINARY, VARBINARY,\nBLOB). The description of LOWER() shows how to perform lettercase conversion\nof binary strings.\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 (688,36,'WEIGHT_STRING','Syntax\n------\n\nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels] [flags])\n levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ...\n\nDescription\n-----------\n\nReturns a binary string representing the string\'s sorting and comparison\nvalue. A string with a lower result means that for sorting purposes the string\nappears before a string with a higher result.\n\nWEIGHT_STRING() is particularly useful when adding new collations, for testing\npurposes.\n\nIf str is a non-binary string (CHAR, VARCHAR or TEXT), WEIGHT_STRING returns\nthe string\'s collation weight. If str is a binary string (BINARY, VARBINARY or\nBLOB), the return value 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 binary or\nnon-binary string, as well as to a particular length.\n\nAS BINARY(N) measures the length in bytes rather than characters, and right\npads with 0x00 bytes to the desired length.\n\nAS CHAR(N) measures the length in characters, and right pads with spaces to\nthe desired length.\n\nN has a minimum value of 1, and if it is less than the length of the input\nstring, the string is truncated without warning.\n\nThe optional LEVEL clause specifies that the return value should contain\nweights for specific collation levels. The levels specifier can either be a\nsingle integer, a comma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can range from 1 to a\nmaximum of 6, dependent on the collation, and need to be listed in ascending\norder.\n\nIf the LEVEL clause is no provided, a default of 1 to the maximum for the\ncollation is assumed.\n\nIf the LEVEL is specified without using a range, an optional modifier is\npermitted.\n\nASC, the default, returns the weights without any modification.\n\nDESC returns bitwise-inverted weights.\n\nREVERSE returns the weights in reverse order.\n\nExamples\n--------\n\nThe examples below use the HEX() function to represent non-printable results\nin 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\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 (689,36,'Type Conversion','Implicit type conversion takes place when MariaDB is using operands or\ndifferent types, in order to make the operands compatible.\n\nIt is best practice not to rely upon implicit conversion; rather use CAST to\nexplicitly convert types.\n\nRules for Conversion on Comparison\n----------------------------------\n\n* If either argument is NULL, the result of the comparison is NULL unless the\nNULL-safe <=> equality comparison operator is used.\n* If both arguments are integers, they are compared as integers.\n* If both arguments are strings, they are compared as strings.\n* If one argument is decimal and the other argument is decimal or integer,\nthey are compared as decimals.\n* If one argument is decimal and the other argument is a floating point, they\nare compared as floating point values.\n* If one argument is string and the other argument is integer, they are\ncompared as decimals. This conversion was added in MariaDB 10.3.36. Prior to\n10.3.36, this combination was compared as floating point values, which did not\nalways work well for huge 64-bit integers because of a possible precision loss\non conversion to double.\n* If a hexadecimal argument is not compared to a number, it is treated as a\nbinary string.\n* If a constant is compared to a TIMESTAMP or DATETIME, the constant is\nconverted to a timestamp, unless used as an argument to the IN function.\n* In other cases, arguments are compared as floating point, or real, numbers.\n\nNote that if a string column is being compared with a numeric value, MariaDB\nwill not use the index on the column, as there are numerous alternatives that\nmay evaluate as equal (see examples below).\n\nComparison Examples\n-------------------\n\nConverting a string to a number:\n\nSELECT 15+\'15\';\n+---------+\n| 15+\'15\' |\n+---------+\n| 30 |\n+---------+\n\nConverting a number to a string:\n\nSELECT CONCAT(15,\'15\');\n+-----------------+\n| CONCAT(15,\'15\') |\n+-----------------+\n| 1515 |\n+-----------------+\n\nFloating point number errors:\n\nSELECT \'9746718491924563214\' = 9746718491924563213;\n+---------------------------------------------+\n| \'9746718491924563214\' = 9746718491924563213 |\n+---------------------------------------------+\n| 1 |\n+---------------------------------------------+\n\nNumeric equivalence with strings:\n\nSELECT \'5\' = 5;\n+---------+\n| \'5\' = 5 |\n+---------+\n| 1 |\n+---------+\n\nSELECT \' 5\' = 5;\n+------------+\n| \' 5\' = 5 |\n+------------+\n| 1 |\n+------------+\n\nSELECT \' 5 \' = 5;\n+--------------+\n| \' 5 \' = 5 |\n+--------------+\n| 1 |\n+--------------+\n1 row in set, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+--------------------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------------------+\n| Note | 1292 | Truncated incorrect DOUBLE value: \' 5 \' |\n+-------+------+--------------------------------------------+\n\nAs a result of the above, MariaDB cannot use the index when comparing a string\nwith a numeric value in the example below:\n\nCREATE TABLE t (a VARCHAR(10), b VARCHAR(10), INDEX idx_a (a));\n\nINSERT INTO t VALUES \n (\'1\', \'1\'), (\'2\', \'2\'), (\'3\', \'3\'),\n (\'4\', \'4\'), (\'5\', \'5\'), (\'1\', \'5\');\n\nEXPLAIN SELECT * FROM t WHERE a = \'3\' \\G\n*************************** 1. row ***************************\n id: 1\n select_type: SIMPLE\n table: t\n type: ref\npossible_keys: idx_a\n key: idx_a\n key_len: 13\n ref: const\n rows: 1\n Extra: Using index condition\n\nEXPLAIN SELECT * FROM t WHERE a = 3 \\G\n*************************** 1. row ***************************\n id: 1\n select_type: SIMPLE\n table: t\n type: ALL\npossible_keys: idx_a\n key: NULL\n key_len: NULL\n ref: NULL\n rows: 6\n Extra: Using where\n\nRules for Conversion on Dyadic Arithmetic Operations\n----------------------------------------------------\n\nImplicit type conversion also takes place on dyadic arithmetic operations\n(+,-,*,/). MariaDB chooses the minimum data type that is guaranteed to fit the\nresult and converts both arguments to the result data type.\n\nFor addition (+), subtraction (-) and multiplication (*), the result data type\nis chosen as follows:\n\n* If either of the arguments is an approximate number (float, double), the\nresult is double.\n* If either of the arguments is a string (char, varchar, text), the result is\ndouble.\n* If either of the arguments is a decimal number, the result is decimal.\n* If either of the arguments is of a temporal type with a non-zero fractional\nsecond precision (time(N), datetime(N), timestamp(N)), the result is decimal.\n* If either of the arguments is of a temporal type with a zero fractional\nsecond precision (time(0), date, datetime(0), timestamp(0)), the result may\nvary between int, int unsigned, bigint or bigint unsigned, depending on the\nexact data type combination.\n* If both arguments are integer numbers (tinyint, smallint, mediumint,\nbigint), the result may vary between int, int unsigned, bigint or bigint\nunsigned, depending of the exact data types and their signs.\n\nFor division (/), the result data type is chosen as follows:\n\n* If either of the arguments is an approximate number (float, double), the\nresult is double.\n* If either of the arguments is a string (char, varchar, text), the result is\ndouble.\n* Otherwise, the result is decimal.\n\nArithmetic Examples\n-------------------\n\nNote, the above rules mean that when an argument of a temporal data type\nappears in addition or subtraction, it\'s treated as a number by default.\n\nSELECT TIME\'10:20:30\' + 1;\n+--------------------+\n| TIME\'10:20:30\' + 1 |\n+--------------------+\n| 102031 |\n+--------------------+\n\nIn order to do temporal addition or subtraction instead, use the DATE_ADD() or\nDATE_SUB() functions, or an INTERVAL expression as the second argument:\n\nSELECT TIME\'10:20:30\' + INTERVAL 1 SECOND;\n+------------------------------------+\n| TIME\'10:20:30\' + INTERVAL 1 SECOND |\n+------------------------------------+\n| 10:20:31 |\n+------------------------------------+\n\nSELECT \"2.2\" + 3;\n+-----------+\n| \"2.2\" + 3 |\n+-----------+\n| 5.2 |\n+-----------+\n\nSELECT 2.2 + 3;\n+---------+\n| 2.2 + 3 |\n+---------+\n| 5.2 |\n+---------+\n\nSELECT 2.2 / 3;\n+---------+\n| 2.2 / 3 |\n+---------+\n| 0.73333 |\n+---------+\n\nSELECT \"2.2\" / 3;\n+--------------------+\n| \"2.2\" / 3 |\n+--------------------+\n| 0.7333333333333334 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/type-conversion/','','https://mariadb.com/kb/en/type-conversion/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (690,37,'_rowid','Syntax\n------\n\n_rowid\n\nDescription\n-----------\n\nThe _rowid pseudo column is mapped to the primary key in the related table.\nThis can be used as a replacement of the rowid pseudo column in other\ndatabases. Another usage is to simplify sql queries as one doesn\'t have to\nknow the name of the primary key.\n\nExamples\n--------\n\ncreate table t1 (a int primary key, b varchar(80));\ninsert into t1 values (1,\"one\"),(2,\"two\");\nselect * from t1 where _rowid=1;\n\n+---+------+\n| a | b |\n+---+------+\n| 1 | one |\n+---+------+\n\nupdate t1 set b=\"three\" where _rowid=2;\nselect * from t1 where _rowid>=1 and _rowid<=10;\n\n+---+-------+\n| a | b |\n+---+-------+\n| 1 | one |\n| 2 | three |\n+---+-------+\n\nURL: https://mariadb.com/kb/en/_rowid/','','https://mariadb.com/kb/en/_rowid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (691,38,'ALTER TABLE','Syntax\n------\n\nALTER [ONLINE] [IGNORE] TABLE [IF EXISTS] tbl_name\n [WAIT n | NOWAIT]\n alter_specification [, alter_specification] ...\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 column_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] (index_col_name,...)\n reference_definition\n | ADD PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\n | ALTER [COLUMN] col_name SET DEFAULT literal | (expression)\n | ALTER [COLUMN] col_name DROP DEFAULT\n | ALTER {INDEX|KEY} index_name [NOT] INVISIBLE\n | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name column_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 | RENAME COLUMN old_col_name TO new_col_name\n | RENAME {INDEX|KEY} old_index_name TO new_index_name\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_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 [IF NOT EXISTS] (partition_definition)\n | DROP PARTITION [IF EXISTS] partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (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\nindex_col_name:\n col_name [(length)] [ASC | DESC]\nindex_type:\n USING {BTREE | HASH | RTREE}\nindex_option:\n [ KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\ntable_options:\n table_option [[,] table_option] ...\n\nDescription\n-----------\n\nALTER TABLE enables you to change the structure of an existing table. For\nexample, you can add or delete columns, create or destroy indexes, change the\ntype of existing columns, or rename columns or the table itself. You can also\nchange the comment for the table and the storage engine of the table.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nWhen adding a UNIQUE index on a column (or a set of columns) which have\nduplicated values, an error will be produced and the statement will be\nstopped. To suppress the error and force the creation of UNIQUE indexes,\ndiscarding duplicates, the IGNORE option can be specified. This can be useful\nif a column (or a set of columns) should be UNIQUE but it contains duplicate\nvalues; however, this technique provides no control on which rows are\npreserved and which are deleted. Also, note that IGNORE is accepted but\nignored in ALTER TABLE ... EXCHANGE PARTITION statements.\n\nThis statement can also be used to rename a table. For details see RENAME\nTABLE.\n\nWhen an index is created, the storage engine may use a configurable buffer in\nthe process. Incrementing the buffer speeds up the index creation. Aria and\nMyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for REPAIR TABLE. InnoDB allocates three\nbuffers whose size is defined by innodb_sort_buffer_size.\n\nPrivileges\n----------\n\nExecuting the ALTER TABLE statement generally requires at least the ALTER\nprivilege for the table or the database..\n\nIf you are renaming a table, then it also requires the DROP, CREATE and INSERT\nprivileges for the table or the database as well.\n\nOnline DDL\n----------\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nALTER ONLINE TABLE\n------------------\n\nALTER ONLINE TABLE also works for partitioned tables.\n\nOnline ALTER TABLE is available by executing the following:\n\nALTER ONLINE TABLE ...;\n\nThis statement has the following semantics:\n\nThis statement is equivalent to the following:\n\nALTER TABLE ... LOCK=NONE;\n\nSee the LOCK alter specification for more information.\n\nThis statement is equivalent to the following:\n\nALTER TABLE ... ALGORITHM=INPLACE;\n\nSee the ALGORITHM alter specification for more information.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nIF EXISTS\n---------\n\nThe IF EXISTS and IF NOT EXISTS clauses are available 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]\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, queries will not report\nerrors when the condition is triggered for that clause. A warning with the\nsame message text will be issued and the ALTER will move on to the next clause\nin the statement (or end if finished).\n\nMariaDB starting with 10.5.2\n----------------------------\nIf this is directive is used after ALTER ... TABLE, one will not get an error\nif the table doesn\'t exist.\n\nColumn Definitions\n------------------\n\nSee CREATE TABLE: Column Definitions for information about column definitions.\n\nIndex Definitions\n-----------------\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nThe CREATE INDEX and DROP INDEX statements can also be used to add or remove\nan index.\n\nCharacter Sets and Collations\n-----------------------------\n\nCONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\nSee Setting Character Sets and Collations for details on setting the character\nsets and collations.\n\nAlter Specifications\n--------------------\n\nTable Options\n-------------\n\nSee CREATE TABLE: Table Options for information about table options.\n\nADD COLUMN\n----------\n\n... ADD COLUMN [IF NOT EXISTS] (col_name column_definition,...)\nAdds a column to the table. The syntax is the same as in CREATE TABLE. If you\nare using IF NOT_EXISTS the column will not be added if it was not there\nalready. This is very useful when doing scripts to modify tables.\n\nThe FIRST and AFTER clauses affect the physical order of columns in the\ndatafile. Use FIRST to add a column in the first (leftmost) position, or AFTER\nfollowed by a column name to add the new column in any other position. Note\nthat, nowadays, the physical position of a column is usually irrelevant.\n\nSee also Instant ADD COLUMN for InnoDB.\n\nDROP COLUMN\n-----------\n\n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\nDrops the column from the table. If you are using IF EXISTS you will not get\nan error if the column didn\'t exist. If the column is part of any index, the\ncolumn will be dropped from them, except if you add a new column with\nidentical name at the same time. The index will be dropped if all columns from\nthe index were dropped. If the column was used in a view or trigger, you will\nget an error next time the view or trigger is accessed.\n\nMariaDB starting with 10.2.8\n----------------------------\nDropping a column that is part of a multi-column UNIQUE constraint is not\npermitted. 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 constraint that\nall values in column b be unique. In order to drop the column, an explicit\nDROP PRIMARY KEY and ADD PRIMARY KEY would be required. Up until MariaDB\n10.2.7, the column 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 starting with 10.4.0\n----------------------------\nMariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of an indexed column\nwould imply DROP INDEX (and in the case of a non-UNIQUE multi-column index,\npossibly ADD INDEX). These will not be allowed with ALGORITHM=INSTANT, but\nunlike before, they can be allowed with ALGORITHM=NOCOPY\n\nRESTRICT and CASCADE are allowed to make porting from other database systems\neasier. In MariaDB, they do nothing.\n\nMODIFY COLUMN\n-------------\n\nAllows you to modify the type of a column. The column will be at the same\nplace as the original column and all indexes on the column will be kept. Note\nthat when modifying column, you should specify all attributes for the new\ncolumn.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n\nCHANGE COLUMN\n-------------\n\nWorks like MODIFY COLUMN except that you can also change the name of the\ncolumn. The column will be at the same place as the original column and all\nindex on the column will be kept.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n\nALTER COLUMN\n------------\n\nThis lets you change column options.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b varchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT \'hello\';\n\nRENAME INDEX/KEY\n----------------\n\nMariaDB starting with 10.5.2\n----------------------------\nFrom MariaDB 10.5.2, it is possible to rename an index using the RENAME INDEX\n(or RENAME KEY) syntax, for example:\n\nALTER TABLE t1 RENAME INDEX i_old TO i_new;\n\nRENAME COLUMN\n-------------\n\nMariaDB starting with 10.5.2\n----------------------------\nFrom MariaDB 10.5.2, it is possible to rename a column using the RENAME COLUMN\nsyntax, for example:\n\nALTER TABLE t1 RENAME COLUMN c_old TO c_new;\n\nADD PRIMARY KEY\n---------------\n\nAdd a primary key.\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nsilently ignored, and the name of the index is always PRIMARY.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nDROP PRIMARY KEY\n----------------\n\nDrop a primary key.\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nsilently ignored, and the name of the index is always PRIMARY.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nADD FOREIGN KEY\n---------------\n\nAdd a foreign key.\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is implemented only for the legacy PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nDROP FOREIGN KEY\n----------------\n\nDrop a foreign key.\n\nSee Foreign Keys for more information.\n\nADD INDEX\n---------\n\nAdd a plain index.\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nDROP INDEX\n----------\n\nDrop a plain index.\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nADD UNIQUE INDEX\n----------------\n\nAdd a unique index.\n\nThe UNIQUE keyword means that the index will not accept duplicated values,','','https://mariadb.com/kb/en/alter-table/');
-update help_topic set description = CONCAT(description, '\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nDROP UNIQUE INDEX\n-----------------\n\nDrop a unique index.\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nADD FULLTEXT INDEX\n------------------\n\nAdd a FULLTEXT index.\n\nSee Full-Text Indexes for more information.\n\nDROP FULLTEXT INDEX\n-------------------\n\nDrop a FULLTEXT index.\n\nSee Full-Text Indexes for more information.\n\nADD SPATIAL INDEX\n-----------------\n\nAdd a SPATIAL index.\n\nSee SPATIAL INDEX for more information.\n\nDROP SPATIAL INDEX\n------------------\n\nDrop a SPATIAL index.\n\nSee SPATIAL INDEX for more information.\n\nENABLE/ DISABLE KEYS\n--------------------\n\nDISABLE KEYS will disable all non unique keys for the table for storage\nengines that support this (at least MyISAM and Aria). This can be used to\nspeed up inserts into empty tables.\n\nENABLE KEYS will enable all disabled keys.\n\nRENAME TO\n---------\n\nRenames the table. See also RENAME TABLE.\n\nADD CONSTRAINT\n--------------\n\nModifies the table adding a constraint on a particular column or columns.\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 introduced new ways to define a constraint.\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in syntax,\nbut ignored.\n\nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(expression);\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraint fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDF\'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 in the ALTER TABLE\nstatement, MariaDB auto-generates a name for you. This is done so that you can\nremove it later using DROP CONSTRAINT clause.\n\nYou can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. You may find this useful when loading a table\nthat violates some constraints that you want to later find and fix in SQL.\n\nTo view constraints on a table, query information_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---------------\n\nMariaDB starting with 10.2.22\n-----------------------------\nDROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was introduced in\nMariaDB 10.2.22 and MariaDB 10.3.13.\n\nMariaDB starting with 10.2.1\n----------------------------\nDROP CONSTRAINT for CHECK constraints was introduced in MariaDB 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 CREATE TABLE or ALTER\nTABLE...ADD CONSTRAINT statement, you can either set a constraint_name\nyourself, or allow MariaDB to auto-generate one for you. To view constraints\non a table, query information_schema.TABLE_CONSTRAINTS. For instance,\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 TABLE...DROP CONSTRAINT\nstatement. For example,\n\nALTER TABLE t DROP CONSTRAINT is_unique;\n\nADD SYSTEM VERSIONING\n---------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nAdd system versioning.\n\nDROP SYSTEM VERSIONING\n----------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nDrop system versioning.\n\nADD PERIOD FOR SYSTEM_TIME\n--------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nFORCE\n-----\n\nALTER TABLE ... FORCE can force MariaDB to re-build the table.\n\nIn MariaDB 5.5 and before, this could only be done by setting the ENGINE table\noption to its old value. For example, for an InnoDB table, one could execute\nthe following:\n\nALTER TABLE tab_name ENGINE = InnoDB;\n\nThe FORCE option can be used instead. For example, :\n\nALTER TABLE tab_name FORCE;\n\nWith InnoDB, the table rebuild will only reclaim unused space (i.e. the space\npreviously used for deleted rows) if the innodb_file_per_table system variable\nis set to ON. If the system variable is OFF, then the space will not be\nreclaimed, but it will be-re-used for new data that\'s later added.\n\nEXCHANGE PARTITION\n------------------\n\nThis is used to exchange the tablespace files between a partition and another\ntable.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nDISCARD TABLESPACE\n------------------\n\nThis is used to discard an InnoDB table\'s tablespace.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nIMPORT TABLESPACE\n-----------------\n\nThis is used to import an InnoDB table\'s tablespace. The tablespace should\nhave been copied from its original server after executing FLUSH TABLES FOR\nEXPORT.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nALTER TABLE ... IMPORT only applies to InnoDB tables. Most other popular\nstorage engines, such as Aria and MyISAM, will recognize their data files as\nsoon as they\'ve been placed in the proper directory under the datadir, and no\nspecial DDL is required to import them.\n\nALGORITHM\n---------\n\nThe ALTER TABLE statement supports the ALGORITHM clause. This clause is one of\nthe clauses that is used to implement online DDL. ALTER TABLE supports several\ndifferent algorithms. An algorithm can be explicitly chosen for an ALTER TABLE\noperation by setting the ALGORITHM clause. The supported values are:\n\n* ALGORITHM=DEFAULT - This implies the default behavior for the specific\nstatement, such as if no ALGORITHM clause is specified.\n* ALGORITHM=COPY\n* ALGORITHM=INPLACE\n* ALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.\n* ALGORITHM=INSTANT - This was added in MariaDB 10.3.7.\n\nSee InnoDB Online DDL Overview: ALGORITHM for information on how the ALGORITHM\nclause affects InnoDB.\n\nALGORITHM=DEFAULT\n-----------------\n\nThe default behavior, which occurs if ALGORITHM=DEFAULT is specified, or if\nALGORITHM is not specified at all, usually only makes a copy if the operation\ndoesn\'t support being done 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 old_alter_table\nsystem variable is set to ON, then the default behavior is to perform ALTER\nTABLE operations by making a copy of the table using the old algorithm.\n\nIn MariaDB 10.3.7 and later, the old_alter_table system variable is\ndeprecated. Instead, the alter_algorithm system variable defines the default\nalgorithm for ALTER TABLE operations.\n\nALGORITHM=COPY\n--------------\n\nALGORITHM=COPY is the name for the original ALTER TABLE algorithm from early\nMariaDB versions.\n\nWhen ALGORITHM=COPY is set, MariaDB essentially does the following 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 original one\nRENAME TABLE tmp_tab TO original_tab;\n\nThis algorithm is very inefficient, but it is generic, so it works for all\nstorage engines.\n\nIf ALGORITHM=COPY is specified, then the copy algorithm will be used even if\nit is not necessary. This can result in a lengthy table copy. If multiple\nALTER TABLE operations are required that each require the table to be rebuilt,\nthen it is best to specify all operations in a single ALTER TABLE statement,\nso that the table is only rebuilt once.\n\nALGORITHM=INPLACE\n-----------------\n\nALGORITHM=COPY can be incredibly slow, because the whole table has to be\ncopied and rebuilt. ALGORITHM=INPLACE was introduced as a way to avoid this by\nperforming operations in-place and avoiding the table copy and rebuild, when\npossible.\n\nWhen ALGORITHM=INPLACE is set, the underlying storage engine uses\noptimizations to perform the operation while avoiding the table copy and\nrebuild. However, INPLACE is a bit of a misnomer, since some operations may\nstill require the table to be rebuilt for some storage engines. Regardless,\nseveral operations can be performed without a full copy of the table for some\nstorage engines.\n\nA more accurate name would have been ALGORITHM=ENGINE, where ENGINE refers to\nan \"engine-specific\" algorithm.\n\nIf an ALTER TABLE operation supports ALGORITHM=INPLACE, then it can be\nperformed using optimizations by the underlying storage engine, but it may\nrebuilt.\n\nSee InnoDB Online DDL Operations with ALGORITHM=INPLACE for more.\n\nALGORITHM=NOCOPY\n----------------\n\nALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.\n\nALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has\nto rebuild the clustered index, because when the clustered index has to be\nrebuilt, the whole table has to be rebuilt. ALGORITHM=NOCOPY was introduced as\na way to avoid this.\n\nIf an ALTER TABLE operation supports ALGORITHM=NOCOPY, then it can be\nperformed without rebuilding the clustered index.\n\nIf ALGORITHM=NOCOPY is specified for an ALTER TABLE operation that does not\nsupport ALGORITHM=NOCOPY, then an error will be raised. In this case, raising\nan error is preferable, if the alternative is for the operation to rebuild the\nclustered index, and perform unexpectedly slowly.\n\nSee InnoDB Online DDL Operations with ALGORITHM=NOCOPY for more.\n\nALGORITHM=INSTANT\n-----------------\n\nALGORITHM=INSTANT was introduced in MariaDB 10.3.7.\n\nALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has\nto modify data files. ALGORITHM=INSTANT was introduced as a way to avoid this.\n\nIf an ALTER TABLE operation supports ALGORITHM=INSTANT, then it can be\nperformed without modifying any data files.\n\nIf ALGORITHM=INSTANT is specified for an ALTER TABLE operation that does not\nsupport ALGORITHM=INSTANT, then an error will be raised. In this case, raising\nan error is preferable, if the alternative is for the operation to modify data\nfiles, and perform unexpectedly slowly.\n\nSee InnoDB Online DDL Operations with ALGORITHM=INSTANT for more.\n\nLOCK\n----\n\nThe ALTER TABLE statement supports the LOCK clause. This clause is one of the\nclauses that is used to implement online DDL. ALTER TABLE supports several\ndifferent locking strategies. A locking strategy can be explicitly chosen for\nan ALTER TABLE operation by setting the LOCK clause. The supported values are:\n\n* DEFAULT: Acquire the least restrictive lock on the table that is supported\nfor the specific operation. Permit the maximum amount of concurrency that is\nsupported for the specific operation.\n* NONE: Acquire no lock on the table. Permit all concurrent DML. If this\nlocking strategy is not permitted for an operation, then an error is raised.\n* SHARED: Acquire a read lock on the table. Permit read-only concurrent DML.\nIf this locking strategy is not permitted for an operation, then an error is\nraised.\n* EXCLUSIVE: Acquire a write lock on the table. Do not permit concurrent DML.\n\nDifferent storage engines support different locking strategies for different\noperations. If a specific locking strategy is chosen for an ALTER TABLE\noperation, and that table\'s storage engine does not support that locking\nstrategy for that specific operation, then an error will be raised.\n\nIf the LOCK clause is not explicitly set, then the operation uses LOCK=DEFAULT.\n\nALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore, the ALTER ONLINE\nTABLE statement can be used to ensure that your ALTER TABLE operation allows\nall concurrent DML.\n\nSee InnoDB Online DDL Overview: LOCK for information on how the LOCK clause\naffects InnoDB.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for ALTER TABLE statement for clients that\nsupport the new progress reporting protocol. For example, if you were using\nthe mysql client, then the progress 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 PROCESSLIST\nstatement and in the contents of the information_schema.PROCESSLIST table.\n\nSee Progress Reporting for more information.\n\nAborting ALTER TABLE Operations\n-------------------------------\n\nIf an ALTER TABLE operation is being performed and the connection is killed,\nthe changes will be rolled back in a controlled manner. The rollback can be a') WHERE help_topic_id = 691;
-update help_topic set description = CONCAT(description, '\nslow operation as the time it takes is relative to how far the operation has\nprogressed.\n\nMariaDB starting with 10.2.13\n-----------------------------\nAborting ALTER TABLE ... ALGORITHM=COPY was made faster by removing excessive\nundo logging (MDEV-11415). This significantly shortens the time it takes to\nabort a running ALTER TABLE operation.\n\nAtomic ALTER TABLE\n------------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, ALTER TABLE is atomic for most engines, including InnoDB,\nMyRocks, MyISAM and Aria (MDEV-25180). This means that if there is a crash\n(server down or power outage) during an ALTER TABLE operation, after recovery,\neither the old table and associated triggers and status will be intact, or the\nnew table will be active.\n\nIn older MariaDB versions one could get leftover #sql-alter..\',\n\'#sql-backup..\' or \'table_name.frmË\' files if the system crashed during the\nALTER TABLE operation.\n\nSee Atomic DDL for more information.\n\nReplication\n-----------\n\nMariaDB starting with 10.8.0\n----------------------------\nBefore MariaDB 10.8.0, ALTER TABLE got fully executed on the primary first,\nand only then was it replicated and started executing on replicas. From\nMariaDB 10.8.0, ALTER TABLE gets replicated and starts executing on replicas\nwhen it starts executing on the primary, not when it finishes. This way the\nreplication lag caused by a heavy ALTER TABLE can be completely eliminated\n(MDEV-11675).\n\nExamples\n--------\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 statement, separated by\ncommas:\n\nALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;\n\nChanging the storage engine and adding a comment:\n\nALTER TABLE t1 \n ENGINE = InnoDB\n COMMENT = \'First of three tables containing usage info\';\n\nRebuilding the table (the previous example will also rebuild the table if it\nwas already InnoDB):\n\nALTER TABLE t1 FORCE;\n\nDropping an index:\n\nALTER TABLE rooms DROP INDEX u;\n\nAdding a unique index:\n\nALTER TABLE rooms ADD UNIQUE INDEX u(room_number);\n\nFrom MariaDB 10.5.3, adding a primary key for an application-time period table\nwith a WITHOUT OVERLAPS constraint:\n\nALTER TABLE rooms ADD PRIMARY KEY(room_number, p WITHOUT OVERLAPS);\n\nURL: https://mariadb.com/kb/en/alter-table/') WHERE help_topic_id = 691;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (692,38,'ALTER DATABASE','Modifies a database, changing its overall characteristics.\n\nSyntax\n------\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 | COMMENT [=] \'comment\'\n\nDescription\n-----------\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the database\ndirectory. To use ALTER DATABASE, you need the ALTER privilege on the\ndatabase. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe CHARACTER SET clause changes the default database character set. The\nCOLLATE clause changes the default database collation. See Character Sets and\nCollations for more.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements.\n\nChanging the default character set/collation of a database does not change the\ncharacter set/collation of any stored procedures or stored functions that were\npreviously created, and relied on the defaults. These need to be dropped and\nrecreated in order to apply the character set/collation changes.\n\nThe database name can be omitted from the first syntax, in which case the\nstatement applies to the default database.\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause was added in\nMySQL 5.1.23. It updates the name of the directory associated with the\ndatabase to use the encoding implemented in MySQL 5.1 for mapping database\nnames to database directory names (see Identifier to File Name Mapping). This\nclause is for use under these conditions:\n\n* It is intended when upgrading MySQL to 5.1 or later from older versions.\n* It is intended to update a database directory name to the current encoding\nformat if the name contains special characters that need encoding.\n* The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example,if a database in MySQL 5.0 has a name of a-b-c, the name contains\ninstance of the `-\' character. In 5.0, the database directory is also named\na-b-c, which is not necessarily safe for all file systems. In MySQL 5.1 and\nup, the same database name is encoded as a@002db@002dc to produce a file\nsystem-neutral directory name.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an older\nversion,the server displays a name such as a-b-c (which is in the old format)\nas #mysql50#a-b-c, and you must refer to the name using the #mysql50# prefix.\nUse UPGRADE DATA DIRECTORY NAME in this case to explicitly tell the server to\nre-encode the database directory name 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 database as a-b-c without\nthe special #mysql50# prefix.\n\nCOMMENT\n-------\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024\nbytes. If the comment length exceeds this length, a error/warning code 4144 is\nthrown. The database comment is also added to the db.opt file, as well as to\nthe information_schema.schemata table.\n\nExamples\n--------\n\nALTER DATABASE test CHARACTER SET=\'utf8\' COLLATE=\'utf8_bin\';\n\nFrom MariaDB 10.5.0:\n\nALTER DATABASE p COMMENT=\'Presentations\';\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 (693,38,'ALTER EVENT','Modifies one or more characteristics of an existing event.\n\nSyntax\n------\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-----------\n\nThe ALTER EVENT statement is used to change one or more of the characteristics\nof an existing event without the need to drop and recreate it. The syntax for\neach of the DEFINER, ON SCHEDULE, ON COMPLETION, COMMENT, ENABLE / DISABLE,\nand DO clauses is exactly the same as when used with CREATE EVENT.\n\nThis statement requires the EVENT privilege. When a user executes a successful\nALTER EVENT statement, that user becomes the definer for the affected event.\n\n(In MySQL 5.1.11 and earlier, an event could be altered only by its definer,\nor by 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\' DAY_HOUR;\nERROR 1539 (HY000): Unknown event \'no_such_event\'\n\nExamples\n--------\n\nALTER EVENT myevent \n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\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 (694,38,'ALTER FUNCTION','Syntax\n------\n\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nDescription\n-----------\n\nThis statement can be used to change the characteristics of a stored function.\nMore than one change may be specified in an ALTER FUNCTION statement. However,\nyou cannot change the parameters or body of a stored function using this\nstatement; to make such changes, you must drop and re-create the function\nusing DROP FUNCTION and CREATE FUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That privilege is\ngranted automatically to the function creator.) If binary logging is enabled,\nthe ALTER FUNCTION statement might also require the SUPER privilege, as\ndescribed in Binary Logging of Stored Routines.\n\nExample\n-------\n\nALTER FUNCTION hello SQL SECURITY INVOKER;\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 (695,38,'ALTER LOGFILE GROUP','Syntax\n------\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 MariaDB. It was\noriginally inherited from MySQL NDB Cluster. See MDEV-19295 for more\ninformation.\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 (696,38,'ALTER PROCEDURE','Syntax\n------\n\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nDescription\n-----------\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a stored\nprocedure using this statement. To make such changes, you must drop and\nre-create the procedure using either CREATE OR REPLACE PROCEDURE (since\nMariaDB 10.1.3) or DROP PROCEDURE and CREATE PROCEDURE (MariaDB 10.1.2 and\nbefore).\n\nYou must have the ALTER ROUTINE privilege for the procedure. By default, that\nprivilege is granted automatically to the procedure creator. See Stored\nRoutine Privileges.\n\nExample\n-------\n\nALTER PROCEDURE simpleproc SQL SECURITY INVOKER;\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 (697,38,'ALTER SERVER','Syntax\n------\n\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nDescription\n-----------\n\nAlters the server information for server_name, adjusting the specified options\nas per the CREATE SERVER command. The corresponding fields in the\nmysql.servers table are updated accordingly. This statement requires the SUPER\nprivilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.\n\nALTER SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nExamples\n--------\n\nALTER SERVER s OPTIONS (USER \'sally\');\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 (698,38,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (699,38,'ALTER VIEW','Syntax\n------\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-----------\n\nThis statement changes the definition of a view, which must exist. The syntax\nis similar to that for CREATE VIEW and the effect is the same as for CREATE OR\nREPLACE VIEW if the view exists. This statement requires the CREATE VIEW and\nDROP privileges for the view, and some privilege for each column referred to\nin the SELECT statement. ALTER VIEW is allowed only to the definer or users\nwith the SUPER privilege.\n\nExample\n-------\n\nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\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 (700,38,'CREATE TABLE','Syntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...) [table_options ]... [partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)] [table_options ]... [partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nDescription\n-----------\n\nUse the CREATE TABLE statement to create a table with the given name.\n\nIn its most basic form, the CREATE TABLE statement provides a table name\nfollowed by a list of columns, indexes, and constraints. By default, the table\nis created in the default database. Specify a database with db_name.tbl_name.\nIf you quote the table name, you must quote the database name and table name\nseparately as `db_name`.`tbl_name`. This is particularly useful for CREATE\nTABLE ... SELECT, because it allows to create a table into a database, which\ncontains data from other databases. See Identifier Qualifiers.\n\nIf a table with the same name exists, error 1050 results. Use IF NOT EXISTS to\nsuppress this error and issue a note instead. Use SHOW WARNINGS to see notes.\n\nThe CREATE TABLE statement automatically commits the current transaction,\nexcept when using the TEMPORARY keyword.\n\nFor valid identifiers to use as table names, see Identifier Names.\n\nNote: if the default_storage_engine is set to ColumnStore then it needs\nsetting on all UMs. Otherwise when the tables using the default engine are\nreplicated across UMs they will use the wrong engine. You should therefore not\nuse this option as a session variable with ColumnStore.\n\nMicrosecond precision can be between 0-6. If no precision is specified it is\nassumed to be 0, for backward compatibility reasons.\n\nPrivileges\n----------\n\nExecuting the CREATE TABLE statement requires the CREATE privilege for the\ntable or the database.\n\nCREATE OR REPLACE\n-----------------\n\nIf the OR REPLACE clause is used and the table already exists, then instead of\nreturning an error, the server will drop the existing table and replace it\nwith the newly defined table.\n\nThis syntax was originally added to make replication more robust if it has to\nrollback and repeat statements such as CREATE ... SELECT on replicas.\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:\n\n* If table_name was locked with LOCK TABLES it will continue to be locked\nafter the statement.\n* Temporary tables are only dropped if the TEMPORARY keyword was used. (With\nDROP TABLE, temporary tables are preferred to be dropped before normal\ntables).\n\nThings to be Aware of With CREATE OR REPLACE\n--------------------------------------------\n\n* The table is dropped first (if it existed), after that the CREATE is done.\nBecause of this, if the CREATE fails, then the table will not exist anymore\nafter the statement. If the table was used with LOCK TABLES it will be\nunlocked.\n* One can\'t use OR REPLACE together with IF EXISTS.\n* Slaves in replication will by default use CREATE OR REPLACE when replicating\nCREATE statements that don\'\'t use IF EXISTS. This can be changed by setting\nthe variable slave-ddl-exec-mode to STRICT.\n\nCREATE TABLE IF NOT EXISTS\n--------------------------\n\nIf the IF NOT EXISTS clause is used, then the table will only be created if a\ntable with the same name does not already exist. If the table already exists,\nthen a warning will be triggered by default.\n\nCREATE TEMPORARY TABLE\n----------------------\n\nUse the TEMPORARY keyword to create a temporary table that is only available\nto the current session. Temporary tables are dropped when the session ends.\nTemporary table names are specific to the session. They will not conflict with\nother temporary tables from other sessions even if they share the same name.\nThey will shadow names of non-temporary tables or views, if they are\nidentical. A temporary table can have the same name as a non-temporary table\nwhich is located in the same database. In that case, their name will reference\nthe temporary table when used in SQL statements. You must have the CREATE\nTEMPORARY TABLES privilege on the database to create temporary tables. If no\nstorage engine is specified, the default_tmp_storage_engine setting will\ndetermine the engine.\n\nROCKSDB temporary tables cannot be created by setting the\ndefault_tmp_storage_engine system variable, or using CREATE TEMPORARY TABLE\nLIKE. Before MariaDB 10.7, they could be specified, but would silently fail,\nand a MyISAM table would be created instead. From MariaDB 10.7 an error is\nreturned. Explicitly creating a temporary table with ENGINE=ROCKSDB has never\nbeen permitted.\n\nCREATE TABLE ... LIKE\n---------------------\n\nUse the LIKE clause instead of a full table definition to create a table with\nthe same definition as another table, including columns, indexes, and table\noptions. Foreign key definitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table, will not be created.\n\nCREATE TABLE ... SELECT\n-----------------------\n\nYou can create a table containing data from other tables using the CREATE ...\nSELECT statement. Columns will be created in the table for each field returned\nby the SELECT query.\n\nYou can also define some columns normally and add other columns from a SELECT.\nYou can also create columns in the normal way and assign them some values\nusing the query, this is done to force a certain type or other field\ncharacteristics. The columns that are not named in the query will be placed\nbefore 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 use the same\nindexes, or the same columns attributes ([NOT] NULL, DEFAULT, AUTO_INCREMENT)\nin the new table, you need to specify them manually. Types and sizes are not\nautomatically preserved if no data returned by the SELECT requires the full\nsize, and VARCHAR could be converted into CHAR. The CAST() function can be\nused to forcee the new table to use certain types.\n\nAliases (AS) are taken into account, and they should always be used when you\nSELECT an expression (function, arithmetical operation, etc).\n\nIf an error occurs during the query, the table will not be created at all.\n\nIf the new table has a primary key or UNIQUE indexes, you can use the IGNORE\nor REPLACE keywords to handle duplicate key errors during the query. IGNORE\nmeans that the newer values must not be inserted an identical value exists in\nthe index. REPLACE means that older values must be overwritten.\n\nIf the columns in the new table are more than the rows returned by the query,\nthe columns populated by the query will be placed after other columns. Note\nthat if the strict SQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and no rows will be\ncopied.\n\nConcurrent inserts are not used during the execution of a CREATE ... SELECT.\n\nIf the table already exists, an error similar to the following will be\nreturned:\n\nERROR 1050 (42S01): Table \'t\' already exists\n\nIf the IF NOT EXISTS clause is used and the table exists, a note will be\nproduced instead of an error.\n\nTo insert rows from a query into an existing table, INSERT ... SELECT can be\nused.\n\nColumn Definitions\n------------------\n\ncreate_definition:\n { col_name column_definition | index_definition | period_definition | CHECK\n(expr) }\ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [ON UPDATE [NOW | CURRENT_TIMESTAMP] [(precision)]]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\'] [REF_SYSTEM_ID = value]\n [reference_definition]\n | data_type [GENERATED ALWAYS]\n AS { { ROW {START|END} } | { (expression) [VIRTUAL | PERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: Until MariaDB 10.4, MariaDB accepts the shortcut format with a\nREFERENCES clause only in ALTER TABLE and CREATE TABLE statements, but that\nsyntax does nothing. For example:\n\nCREATE TABLE b(for_key INT REFERENCES a(not_key));\n\nMariaDB simply parses it without returning any error or warning, for\ncompatibility with other DBMS\'s. Before MariaDB 10.2.1 this was also true for\nCHECK constraints. However, only the syntax described below creates foreign\nkeys.\n\nFrom MariaDB 10.5, MariaDB will attempt to apply the constraint. See Foreign\nKeys examples.\n\nEach definition either creates a column in the table or specifies and index or\nconstraint on one or more columns. See Indexes below for details on creating\nindexes.\n\nCreate a column by specifying a column name and a data type, optionally\nfollowed by column options. See Data Types for a full list of data types\nallowed in MariaDB.\n\nNULL and NOT NULL\n-----------------\n\nUse the NULL or NOT NULL options to specify that values in the column may or\nmay not be NULL, respectively. By default, values may be NULL. See also NULL\nValues in MariaDB.\n\nDEFAULT Column Option\n---------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some enhancements include\n\n* BLOB and TEXT columns now support DEFAULT.\n* The DEFAULT clause can now be used with an expression or function.\n\nSpecify a default value using the DEFAULT clause. If you don\'t specify DEFAULT\nthen the following rules apply:\n\n* If the column is not defined with NOT NULL, AUTO_INCREMENT or TIMESTAMP, an\nexplicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get an explicit\nDEFAULT for primary key parts, if not specified with NOT NULL.\n\nThe default value will be used if you INSERT a row without specifying a value\nfor that column, or if you specify DEFAULT for that column. Before MariaDB\n10.2.1 you couldn\'t usually provide an expression or function to evaluate at\ninsertion time. You had to provide a constant default value instead. The one\nexception is that you may use CURRENT_TIMESTAMP as the default value for a\nTIMESTAMP column to use the current timestamp at insertion time.\n\nCURRENT_TIMESTAMP may also be used as the default value for a DATETIME\n\nFrom MariaDB 10.2.1 you can use most functions in DEFAULT. Expressions should\nhave parentheses around them. If you use a non deterministic function in\nDEFAULT then all inserts to the table will be replicated in row mode. You can\neven refer to earlier columns in the DEFAULT expression (excluding\nAUTO_INCREMENT columns):\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 subqueries, and a\ncolumn used in the clause must already have been defined earlier in the\nstatement.\n\nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT columns a DEFAULT\nvalue. In earlier versions, assigning a default to these columns was not\npossible.\n\nMariaDB starting with 10.3.3\n----------------------------\nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE FOR sequence)\n\nAUTO_INCREMENT Column Option\n----------------------------\n\nUse AUTO_INCREMENT to create a column whose value can can be set automatically\nfrom a simple counter. You can only use AUTO_INCREMENT on a column with an\ninteger type. The column must be a key, and there can only be one\nAUTO_INCREMENT column in a table. If you insert a row without specifying a\nvalue for that column (or if you specify 0, NULL, or DEFAULT as the value),\nthe actual value will be taken from the counter, with each insertion\nincrementing the counter by one. You can still insert a value explicitly. If\nyou insert a value that is greater than the current counter value, the counter\nis set based on the new value. An AUTO_INCREMENT column is implicitly NOT\nNULL. Use LAST_INSERT_ID to get the AUTO_INCREMENT value most recently used by\nan INSERT statement.\n\nZEROFILL Column Option\n----------------------\n\nIf the ZEROFILL column option is specified for a column using a numeric data\ntype, then the column will be set to UNSIGNED and the spaces used by default\nto pad the field are replaced with zeros. ZEROFILL is ignored in expressions\nor as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n\nPRIMARY KEY Column Option\n-------------------------\n\nUse PRIMARY KEY to make a column a primary key. A primary key is a special\ntype of a unique key. There can be at most one primary key per table, and it\nis implicitly NOT NULL.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nUNIQUE KEY Column Option\n------------------------\n\nUse UNIQUE KEY (or just UNIQUE) to specify that all values in the column must\nbe distinct from each other. Unless the column is NOT NULL, there may be\nmultiple rows with NULL in the column.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nCOMMENT Column Option\n---------------------\n\nYou can provide a comment for each column using the COMMENT clause. The\nmaximum length is 1024 characters. Use the SHOW FULL COLUMNS statement to see\ncolumn comments.\n\nREF_SYSTEM_ID\n-------------\n\nREF_SYSTEM_ID can be used to specify Spatial Reference System IDs for spatial\ndata type columns.\n\nGenerated Columns\n-----------------\n\nA generated column is a column in a table that cannot explicitly be set to a\nspecific value in a DML query. Instead, its value is automatically generated\nbased on an expression. This expression might generate the value based on the\nvalues of other columns in the table, or it might generate the value by\ncalling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n* PERSISTENT or STORED: This type\'s value is actually stored in the table.\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is','','https://mariadb.com/kb/en/create-table/');
-update help_topic set description = CONCAT(description, '\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nFor a complete description about generated columns and their limitations, see\nGenerated (Virtual and Persistent/Stored) Columns.\n\nCOMPRESSED\n----------\n\nMariaDB starting with 10.3.3\n----------------------------\nCertain columns may be compressed. See Storage-Engine Independent Column\nCompression.\n\nINVISIBLE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nColumns may be made invisible, and hidden in certain contexts. See Invisible\nColumns.\n\nWITH SYSTEM VERSIONING Column Option\n------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as included from system versioning. See\nSystem-versioned tables for details.\n\nWITHOUT SYSTEM VERSIONING Column Option\n---------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as excluded from system versioning. See\nSystem-versioned tables for details.\n\nIndex Definitions\n-----------------\n\nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option]\n...\n {{{|}}} {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type]\n(index_col_name,...) [index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...)\nreference_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 [ IGNORED | NOT IGNORED ]\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nINDEX and KEY are synonyms.\n\nIndex names are optional, if not specified an automatic name will be assigned.\nIndex name are needed to drop indexes and appear in error messages when a\nconstraint is violated.\n\nIndex Categories\n----------------\n\nPlain Indexes\n-------------\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nPRIMARY KEY\n-----------\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nignored, and the name of the index is always PRIMARY. From MariaDB 10.3.18 and\nMariaDB 10.4.8, a warning is explicitly issued if a name is specified. Before\nthen, the name was silently ignored.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nUNIQUE\n------\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nFOREIGN KEY\n-----------\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is currently implemented only for the PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nFULLTEXT\n--------\n\nUse the FULLTEXT keyword to create full-text indexes.\n\nSee Full-Text Indexes for more information.\n\nSPATIAL\n-------\n\nUse the SPATIAL keyword to create geometric indexes.\n\nSee SPATIAL INDEX for more information.\n\nIndex Options\n-------------\n\nKEY_BLOCK_SIZE Index Option\n---------------------------\n\nThe KEY_BLOCK_SIZE index option is similar to the KEY_BLOCK_SIZE table option.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\nHowever, this does not happen if you just set the KEY_BLOCK_SIZE index option\nfor one or more indexes in the table. The InnoDB storage engine ignores the\nKEY_BLOCK_SIZE index option. However, the SHOW CREATE TABLE statement may\nstill report it for the index.\n\nFor information about the KEY_BLOCK_SIZE index option, see the KEY_BLOCK_SIZE\ntable option below.\n\nIndex Types\n-----------\n\nEach storage engine supports some or all index types. See Storage Engine Index\nTypes for details on permitted index types for each storage engine.\n\nDifferent index types are optimized for different kind of operations:\n\n* BTREE is the default type, and normally is the best choice. It is supported\nby all storage engines. It can be used to compare a column\'s value with a\nvalue using the =, >, >=, <, <=, BETWEEN, and LIKE operators. BTREE can also\nbe used to find NULL values. Searches against an index prefix are possible.\n* HASH is only supported by the MEMORY storage engine. HASH indexes can only\nbe used for =, <=, and >= comparisons. It can not be used for the ORDER BY\nclause. Searches against an index prefix are not possible.\n* RTREE is the default for SPATIAL indexes, but if the storage engine does not\nsupport it BTREE can be used.\n\nIndex columns names are listed between parenthesis. After each column, a\nprefix length can be specified. If no length is specified, the whole column\nwill be indexed. ASC and DESC can be specified for compatibility with are\nDBMS\'s, but have no meaning in MariaDB.\n\nWITH PARSER Index Option\n------------------------\n\nThe WITH PARSER index option only applies to FULLTEXT indexes and contains the\nfulltext parser name. The fulltext parser must be an installed plugin.\n\nCOMMENT Index Option\n--------------------\n\nA comment of up to 1024 characters is permitted with the COMMENT index option.\n\nThe COMMENT index option allows you to specify a comment with user-readable\ntext describing what the index is for. This information is not used by the\nserver itself.\n\nCLUSTERING Index Option\n-----------------------\n\nThe CLUSTERING index option is only valid for tables using the TokuDB storage\nengine.\n\nIGNORED / NOT IGNORED\n---------------------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, indexes can be specified to be ignored by the optimizer.\nSee Ignored Indexes.\n\nPeriods\n-------\n\nMariaDB starting with 10.3.4\n----------------------------\n\nperiod_definition:\n PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\nMariaDB supports a subset of the standard syntax for periods. At the moment\nit\'s only used for creating System-versioned tables. Both columns must be\ncreated, must be either of a TIMESTAMP(6) or BIGINT UNSIGNED type, and be\ngenerated as ROW START and ROW END accordingly. See System-versioned tables\nfor details.\n\nThe table must also have the WITH SYSTEM VERSIONING clause.\n\nConstraint Expressions\n----------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 introduced new ways to define a constraint.\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in the\nsyntax but ignored.\n\nMariaDB 10.2.1 introduced two ways to define a constraint:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraints fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDFs.\n\ncreate table t1 (a int check(a>0) ,b int check (b> 0), constraint abc check\n(a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get a auto generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. This is useful for example when loading a\ntable that violates some constraints that you want to later find and fix in\nSQL.\n\nSee CONSTRAINT for more information.\n\nTable Options\n-------------\n\nFor each individual table you create (or alter), you can set some table\noptions. The general syntax for setting options is:\n\n<OPTION_NAME> = <option_value>, [<OPTION_NAME> = <option_value> ...]\n\nThe equal sign is optional.\n\nSome options are supported by the server and can be used for all tables, no\nmatter what storage engine they use; other options can be specified for all\nstorage engines, but have a meaning only for some engines. Also, engines can\nextend CREATE TABLE with new options.\n\nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong table options\ngenerate a warning; otherwise, they generate an 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 [=] {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\n[STORAGE] ENGINE specifies a storage engine for the table. If this option is\nnot used, the default storage engine is used instead. That is, the\ndefault_storage_engine session option value if it is set, or the value\nspecified for the --default-storage-engine mysqld startup option, or the\ndefault storage engine, InnoDB. If the specified storage engine is not\ninstalled and active, the default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default). This is only true for CREATE\nTABLE, not for ALTER TABLE. For a list of storage engines that are present in\nyour server, issue a SHOW ENGINES.\n\nAUTO_INCREMENT\n--------------\n\nAUTO_INCREMENT specifies the initial value for the AUTO_INCREMENT primary key.\nThis works for MyISAM, Aria, InnoDB, MEMORY, and ARCHIVE tables. You can\nchange this option with ALTER TABLE, but in that case the new value must be\nhigher than the highest value which is present in the AUTO_INCREMENT column.\nIf the storage engine does not support this option, you can insert (and then\ndelete) a row having the wanted value - 1 in the AUTO_INCREMENT column.\n\nAVG_ROW_LENGTH\n--------------\n\nAVG_ROW_LENGTH is the average rows size. It only applies to tables using\nMyISAM and Aria storage engines that have the ROW_FORMAT table option set to\nFIXED format.\n\nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the maximum size of a table\n(default: 256TB, or the maximum file size allowed by the system).\n\n[DEFAULT] CHARACTER SET/CHARSET\n-------------------------------\n\n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to set a default\ncharacter set for the table. This is the character set used for all columns\nwhere an explicit character set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will be used. See\nSetting Character Sets and Collations for details on setting the character\nsets.\n\nCHECKSUM/TABLE_CHECKSUM\n-----------------------\n\nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a live checksum for\nall table\'s rows. This makes write operations slower, but CHECKSUM TABLE will\nbe very fast. This option is only supported for MyISAM and Aria tables.\n\n[DEFAULT] COLLATE\n-----------------\n\n[DEFAULT] COLLATE is used to set a default collation for the table. This is\nthe collation used for all columns where an explicit character set is not\nspecified. If this option is omitted or DEFAULT is specified, database\'s\ndefault option will be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n\nCOMMENT\n-------\n') WHERE help_topic_id = 700;
-update help_topic set description = CONCAT(description, '\nCOMMENT is a comment for the table. The maximum length is 2048 characters.\nAlso used to define table parameters when creating a Spider table.\n\nCONNECTION\n----------\n\nCONNECTION is used to specify a server name or a connection string for a\nSpider, CONNECT, Federated or FederatedX table.\n\nDATA DIRECTORY/INDEX DIRECTORY\n------------------------------\n\nDATA DIRECTORY and INDEX DIRECTORY are supported for MyISAM and Aria, and DATA\nDIRECTORY is also supported by InnoDB if the innodb_file_per_table server\nsystem variable is enabled, but only in CREATE TABLE, not in ALTER TABLE. So,\ncarefully choose a path for InnoDB tables at creation time, because it cannot\nbe changed without dropping and re-creating the table. These options specify\nthe paths for data files and index files, respectively. If these options are\nomitted, the database\'s directory will be used to store data files and index\nfiles. Note that these table options do not work for partitioned tables (use\nthe partition options instead), or if the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the overwriting of old files\nwith the same name that could be present in the directories, you can use the\n--keep_files_on_create option (an error will be issued if files already\nexist). These options are ignored if the NO_DIR_IN_CREATE SQL_MODE is enabled\n(useful for replication slaves). Also note that symbolic links cannot be used\nfor InnoDB tables.\n\nDATA DIRECTORY works by creating symlinks from where the table would normally\nhave been (inside the datadir) to where the option specifies. For security\nreasons, to avoid bypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY cannot be used to\nspecify a location inside the datadir. An attempt to do so will result in an\nerror 1210 (HY000) Incorrect arguments to DATA DIRECTORY.\n\nDELAY_KEY_WRITE\n---------------\n\nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be set to 1 to speed\nup write operations. In that case, when data are modified, the indexes are not\nupdated until the table is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this option is applied only\nif the delay_key_write server variable is set to \'ON\'. If it is \'OFF\' the\ndelayed index writes are always disabled, and if it is \'ALL\' the delayed index\nwrites are always used, disregarding the value of DELAY_KEY_WRITE.\n\nENCRYPTED\n---------\n\nThe ENCRYPTED table option can be used to manually set the encryption status\nof an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTED table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nENCRYPTION_KEY_ID\n-----------------\n\nThe ENCRYPTION_KEY_ID table option can be used to manually set the encryption\nkey of an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTION_KEY_ID table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nIETF_QUOTES\n-----------\n\nFor the CSV storage engine, the IETF_QUOTES option, when set to YES, enables\nIETF-compatible parsing of embedded quote and comma characters. Enabling this\noption for a table improves compatibility with other tools that use CSV, but\nis not compatible with MySQL CSV tables, or MariaDB CSV tables created without\nthis option. Disabled by default.\n\nINSERT_METHOD\n-------------\n\nINSERT_METHOD is only used with MERGE tables. This option determines in which\nunderlying table the new rows should be inserted. If you set it to \'NO\' (which\nis the default) no new rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying tables). FIRST means\nthat the rows are inserted into the first table, and LAST means that thet are\ninserted into the last table.\n\nKEY_BLOCK_SIZE\n--------------\n\nKEY_BLOCK_SIZE is used to determine the size of key blocks, in bytes or\nkilobytes. However, this value is just a hint, and the storage engine could\nmodify or ignore it. If KEY_BLOCK_SIZE is set to 0, the storage engine\'s\ndefault value will be used.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\n\nMIN_ROWS/MAX_ROWS\n-----------------\n\nMIN_ROWS and MAX_ROWS let the storage engine know how many rows you are\nplanning to store as a minimum and as a maximum. These values will not be used\nas real limits, but they help the storage engine to optimize the table.\nMIN_ROWS is only used by MEMORY storage engine to decide the minimum memory\nthat is always allocated. MAX_ROWS is used to decide the minimum size for\nindexes.\n\nPACK_KEYS\n---------\n\nPACK_KEYS can be used to determine whether the indexes will be compressed. Set\nit to 1 to compress all keys. With a value of 0, compression will not be used.\nWith the DEFAULT value, only long strings will be compressed. Uncompressed\nkeys are faster.\n\nPAGE_CHECKSUM\n-------------\n\nPAGE_CHECKSUM is only applicable to Aria tables, and determines whether\nindexes and data should use page checksums for extra safety.\n\nPAGE_COMPRESSED\n---------------\n\nPAGE_COMPRESSED is used to enable InnoDB page compression for InnoDB tables.\n\nPAGE_COMPRESSION_LEVEL\n----------------------\n\nPAGE_COMPRESSION_LEVEL is used to set the compression level for InnoDB page\ncompression for InnoDB tables. The table must also have the PAGE_COMPRESSED\ntable option set to 1.\n\nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best speed) through 9 (the\nbest compression), .\n\nPASSWORD\n--------\n\nPASSWORD is unused.\n\nRAID_TYPE\n---------\n\nRAID_TYPE is an obsolete option, as the raid support has been disabled since\nMySQL 5.0.\n\nROW_FORMAT\n----------\n\nThe ROW_FORMAT table option specifies the row format for the data file.\nPossible values are engine-dependent.\n\nSupported MyISAM Row Formats\n----------------------------\n\nFor MyISAM, the supported row formats are:\n\n* FIXED\n* DYNAMIC\n* COMPRESSED\n\nThe COMPRESSED row format can only be set by the myisampack command line tool.\n\nSee MyISAM Storage Formats for more information.\n\nSupported Aria Row Formats\n--------------------------\n\nFor Aria, the supported row formats are:\n\n* PAGE\n* FIXED\n* DYNAMIC.\n\nSee Aria Storage Formats for more information.\n\nSupported InnoDB Row Formats\n----------------------------\n\nFor InnoDB, the supported row formats are:\n\n* COMPACT\n* REDUNDANT\n* COMPRESSED\n* DYNAMIC.\n\nIf the ROW_FORMAT table option is set to FIXED for an InnoDB table, then the\nserver will either return an error or a warning depending on the value of the\ninnodb_strict_mode system variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will create the table\nusing the default row format for the specific MariaDB server version. If the\ninnodb_strict_mode system variable is set to ON, then an error will be raised.\n\nSee InnoDB Storage Formats for more information.\n\nOther Storage Engines and ROW_FORMAT\n------------------------------------\n\nOther storage engines do not support the ROW_FORMAT table option.\n\nSEQUENCE\n--------\n\nMariaDB starting with 10.3\n--------------------------\nIf the table is a sequence, then it will have the SEQUENCE set to 1.\n\nSTATS_AUTO_RECALC\n-----------------\n\nSTATS_AUTO_RECALC indicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB table. If set to 1,\nstatistics will be recalculated when more than 10% of the data has changed.\nWhen set to 0, stats will be recalculated only when an ANALYZE TABLE is run.\nIf set to DEFAULT, or left out, the value set by the innodb_stats_auto_recalc\nsystem variable applies. See InnoDB Persistent Statistics.\n\nSTATS_PERSISTENT\n----------------\n\nSTATS_PERSISTENT indicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on disk), 0 (not on\ndisk, the pre-MariaDB 10 behavior), or DEFAULT (the same as leaving out the\noption), in which case the value set by the innodb_stats_persistent system\nvariable will apply. Persistent statistics stored on disk allow the statistics\nto survive server restarts, and provide better query plan stability. See\nInnoDB Persistent Statistics.\n\nSTATS_SAMPLE_PAGES\n------------------\n\nSTATS_SAMPLE_PAGES indicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the innodb_stats_sample_pages\nvalue is used. See InnoDB Persistent Statistics.\n\nTRANSACTIONAL\n-------------\n\nTRANSACTIONAL is only applicable for Aria tables. In future Aria tables\ncreated with this option will be fully transactional, but currently this\nprovides a form of crash protection. See Aria Storage Engine for more details.\n\nUNION\n-----\n\nUNION must be specified when you create a MERGE table. This option contains a\ncomma-separated list of MyISAM tables which are accessed by the new table. The\nlist is enclosed between parenthesis. Example: UNION = (t1,t2)\n\nWITH SYSTEM VERSIONING\n----------------------\n\nWITH SYSTEM VERSIONING is used for creating System-versioned tables.\n\nPartitions\n----------\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 num] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\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] ...)]\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 partitioned. A partition\nmethod must be explicitly indicated for partitions and subpartitions.\nPartition methods are:\n\n* [LINEAR] HASH creates a hash key which will be used to read and write rows.\nThe partition function can be any valid SQL expression which returns an\nINTEGER number. Thus, it is possible to use the HASH method on an integer\ncolumn, or on functions which accept integer columns as an argument. However,\nVALUES LESS THAN and VALUES IN clauses can not be used 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\n* [LINEAR] KEY is similar to HASH, but the index has an even distribution of\ndata. Also, the expression can only be a column or a list of columns. VALUES\nLESS THAN and VALUES IN clauses can not be used with KEY.\n* RANGE partitions the rows using on a range of values, using the VALUES LESS\nTHAN operator. VALUES IN is not allowed with RANGE. The partition function can\nbe any valid SQL expression which returns a single value.\n* LIST assigns partitions based on a table\'s column with a restricted set of\npossible values. It is similar to RANGE, but VALUES IN must be used for at\nleast 1 columns, and VALUES LESS THAN is disallowed.\n* SYSTEM_TIME partitioning is used for System-versioned tables to store\nhistorical data separately from current data.\n\nOnly HASH and KEY can be used for subpartitions, and they can be [LINEAR].\n\nIt is possible to define up to 1024 partitions and subpartitions.\n\nThe number of defined partitions can be optionally specified as PARTITION\ncount. This can be done to avoid specifying all partitions individually. But\nyou can also declare each individual partition and, additionally, specify a\nPARTITIONS count clause; in the case, the number of PARTITIONs must equal\ncount.\n\nAlso see Partitioning Types Overview.\n\nSequences\n---------\n\nMariaDB starting with 10.3\n--------------------------\nCREATE TABLE can also be used to create a SEQUENCE. See CREATE SEQUENCE and\nSequence Overview.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL. CREATE TABLE is atomic, except for CREATE\nOR REPLACE, which is only crash safe.\n\nExamples\n--------\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:\n\n* Usage of IF NOT EXISTS; If the table already existed, it will not be\ncreated. There will not be any error for the client, just a warning.\n* How to create a PRIMARY KEY that is automatically generated.\n* How to specify a table-specific character set and another for a column.\n* How to create an index (name) that is only partly indexed (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\nURL: https://mariadb.com/kb/en/create-table/') WHERE help_topic_id = 700;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (701,38,'DROP TABLE','Syntax\n------\n\nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP TABLE removes one or more tables. You must have the DROP privilege for\neach table. All table data and the table definition are removed, as well as\ntriggers associated to the table, so be careful with this statement! If any of\nthe tables named in the argument list do not exist, MariaDB returns an error\nindicating by name which non-existing tables it was unable to drop, but it\nalso drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not\nautomatically dropped. See GRANT.\n\nIf another thread is using the table in an explicit transaction or an\nautocommit transaction, then the thread acquires a metadata lock (MDL) on the\ntable. The DROP TABLE statement will wait in the \"Waiting for table metadata\nlock\" thread state until the MDL is released. MDLs are released in the\nfollowing cases:\n\n* If an MDL is acquired in an explicit transaction, then the MDL will be\nreleased when the transaction ends.\n* If an MDL is acquired in an autocommit transaction, then the MDL will be\nreleased when the statement ends.\n* Transactional and non-transactional tables are handled the same.\n\nNote that for a partitioned table, DROP TABLE permanently removes the table\ndefinition, all of its partitions, and all of the data which was stored in\nthose partitions. It also removes the partitioning definition (.par) file\nassociated with the dropped table.\n\nFor each referenced table, DROP TABLE drops a temporary table with that name,\nif it exists. If it does not exist, and the TEMPORARY keyword is not used, it\ndrops a non-temporary table with the same name, if it exists. The TEMPORARY\nkeyword ensures that a non-temporary table will not accidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not exist.\nA NOTE is generated for each non-existent table when using IF EXISTS. See SHOW\nWARNINGS.\n\nIf a foreign key references this table, the table cannot be dropped. In this\ncase, it is necessary to drop the foreign key first.\n\nRESTRICT and CASCADE are allowed to make porting from other database systems\neasier. In MariaDB, they do nothing.\n\nThe comment before the table names (/*COMMENT TO SAVE*/) is stored in the\nbinary log. That feature can be used by replication tools to send their\ninternal messages.\n\nIt is possible to specify table names as db_name.tab_name. This is useful to\ndelete tables from multiple databases with one statement. See Identifier\nQualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For\ntemporary tables, no privilege is required, because such tables are only\nvisible for the current session.\n\nNote: DROP TABLE automatically commits the current active transaction, unless\nyou use the TEMPORARY keyword.\n\nMariaDB starting with 10.5.4\n----------------------------\nFrom MariaDB 10.5.4, DROP TABLE reliably deletes table remnants inside a\nstorage engine even if the .frm file is missing. Before then, a missing .frm\nfile would result in the statement failing.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDROP TABLE in replication\n-------------------------\n\nDROP TABLE has the following characteristics in replication:\n\n* DROP TABLE IF EXISTS are always logged.\n* DROP TABLE without IF EXISTS for tables that don\'t exist are not written to\nthe binary log.\n* Dropping of TEMPORARY tables are prefixed in the log with TEMPORARY. These\ndrops are only logged when running statement or mixed mode replication.\n* One DROP TABLE statement can be logged with up to 3 different DROP\nstatements:\nDROP TEMPORARY TABLE list_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n\nDROP TABLE on the primary is treated on the replica as DROP TABLE IF EXISTS.\nYou can change that by setting slave-ddl-exec-mode to STRICT.\n\nDropping an Internal #sql-... Table\n-----------------------------------\n\nFrom MariaDB 10.6, DROP TABLE is atomic and the following does not apply.\nUntil MariaDB 10.5, if the mariadbd/mysqld process is killed during an ALTER\nTABLE you may find a table named #sql-... in your data directory. In MariaDB\n10.3, InnoDB tables with this prefix will be deleted automatically during\nstartup. From MariaDB 10.4, these temporary tables will always be deleted\nautomatically.\n\nIf you want to delete one of these tables explicitly you can do so by using\nthe following syntax:\n\nDROP TABLE `#mysql50##sql-...`;\n\nWhen running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB\nwill create an internal #sql-ib table. Until MariaDB 10.3.2, for these tables,\nthe .frm file will be called something else. In order to drop such a table\nafter a server crash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n\nFrom MariaDB 10.3.3, the same name as the .frm file is used for the\nintermediate copy of the table. The #sql-ib names are used by TRUNCATE and\ndelayed DROP.\n\nFrom MariaDB 10.2.19 and MariaDB 10.3.10, the #sql-ib tables will be deleted\nautomatically.\n\nDropping All Tables in a Database\n---------------------------------\n\nThe best way to drop all tables in a database is by executing DROP DATABASE,\nwhich will drop the database itself, and all tables in it.\n\nHowever, if you want to drop all tables in the database, but you also want to\nkeep the database itself and any other non-table objects in it, then you would\nneed to execute DROP TABLE to drop each individual table. You can construct\nthese DROP TABLE commands by querying the TABLES table in the\ninformation_schema database. For example:\n\nSELECT CONCAT(\'DROP TABLE IF EXISTS `\', TABLE_SCHEMA, \'`.`\', TABLE_NAME, \'`;\')\nFROM information_schema.TABLES\nWHERE TABLE_SCHEMA = \'mydb\';\n\nAtomic DROP TABLE\n-----------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, DROP TABLE for a single table is atomic (MDEV-25180) for\nmost engines, including InnoDB, MyRocks, MyISAM and Aria.\n\nThis means that if there is a crash (server down or power outage) during DROP\nTABLE, all tables that have been processed so far will be completely dropped,\nincluding related trigger files and status entries, and the binary log will\ninclude a DROP TABLE statement for the dropped tables. Tables for which the\ndrop had not started will be left intact.\n\nIn older MariaDB versions, there was a small chance that, during a server\ncrash happening in the middle of DROP TABLE, some storage engines that were\nusing multiple storage files, like MyISAM, could have only a part of its\ninternal files dropped.\n\nIn MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was\nonly partly dropped (MDEV-11412) as explained above. Atomic DROP TABLE is the\nfinal piece to make DROP TABLE fully reliable.\n\nDropping multiple tables is crash-safe.\n\nSee Atomic DDL for more information.\n\nExamples\n--------\n\nDROP TABLE Employees, Customers;\n\nNotes\n-----\n\nBeware that DROP TABLE can drop both tables and sequences. This is mainly done\nto allow old tools like mysqldump to work with sequences.\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 (702,38,'RENAME TABLE','Syntax\n------\n\nRENAME TABLE[S] [IF EXISTS] tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nDescription\n-----------\n\nThis statement renames one or more tables or views, but not the privileges\nassociated with them.\n\nIF EXISTS\n---------\n\nMariaDB starting with 10.5.2\n----------------------------\nIf this directive is used, one will not get an error if the table to be\nrenamed doesn\'t exist.\n\nThe rename operation is done atomically, which means that no other session can\naccess any of the tables while the rename is running. For example, if you have\nan existing table old_table, you can create another table new_table that has\nthe same structure but is empty, and then replace the existing table with the\nempty one as follows (assuming that backup_table does not already exist):\n\nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n\ntbl_name can optionally be specified as db_name.tbl_name. See Identifier\nQualifiers. This allows to use RENAME to move a table from a database to\nanother (as long as they are on the same filesystem):\n\nRENAME TABLE db1.t TO db2.t;\n\nNote that moving a table to another database is not possible if it has some\ntriggers. Trying to do so produces the following 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 \'new_db\' is not allowed.\n\nMultiple tables can be renamed in a single statement. The presence or absence\nof the optional S (RENAME TABLE or RENAME TABLES) has no impact, whether a\nsingle or multiple tables are being renamed.\n\nIf a RENAME TABLE renames more than one table and one renaming fails, all\nrenames executed by the same statement are rolled back.\n\nRenames are always executed in the specified order. Knowing this, it is also\npossible to swap two tables\' names:\n\nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nPrivileges\n----------\n\nExecuting the RENAME TABLE statement requires the DROP, CREATE and INSERT\nprivileges for the table or the database.\n\nAtomic RENAME TABLE\n-------------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, RENAME TABLE is atomic for most engines, including InnoDB,\nMyRocks, MyISAM and Aria (MDEV-23842). This means that if there is a crash\n(server down or power outage) during RENAME TABLE, all tables will revert to\ntheir original names and any changes to trigger files will be reverted.\n\nIn older MariaDB version there was a small chance that, during a server crash\nhappening in the middle of RENAME TABLE, some tables could have been renamed\n(in the worst case partly) while others would not be renamed.\n\nSee Atomic DDL for more information.\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 (703,38,'TRUNCATE TABLE','Syntax\n------\n\nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nTRUNCATE TABLE empties a table completely. It requires the DROP privilege. See\nGRANT.\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier\nQualifiers).\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that deletes all\nrows, but there are practical differences under some circumstances.\n\nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN KEY constraints\nfrom other tables reference the table, returning the error:\n\nERROR 1701 (42000): Cannot truncate a table referenced in a foreign key\nconstraint\n\nForeign Key constraints between columns in the same table are permitted.\n\nFor an InnoDB table, if there are no FOREIGN KEY constraints, InnoDB performs\nfast truncation by dropping the original table and creating an empty one with\nthe same definition, which is much faster than deleting rows one by one. The\nAUTO_INCREMENT counter is reset by TRUNCATE TABLE, regardless of whether there\nis a FOREIGN KEY constraint.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it is\nmapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the following\nways:\n\n* Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n* Truncate operations cause an implicit commit.\n* Truncation operations cannot be performed if the session holds an\n active table lock.\n* Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is \"0 rows affected,\" which should\n be interpreted as \"no information.\"\n* As 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 become\n corrupted.\n* The 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 InnoDB, which normally\n do not reuse sequence values.\n* When used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n* Since truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\n* TRUNCATE TABLE will only reset the values in the Performance Schema summary\ntables to zero or null, and will not remove the rows.\n\nFor the purposes of binary logging and replication, TRUNCATE TABLE is treated\nas DROP TABLE followed by CREATE TABLE (DDL rather than DML).\n\nTRUNCATE TABLE does not work on views. Currently, TRUNCATE TABLE drops all\nhistorical records from a system-versioned table.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nOracle-mode\n-----------\n\nOracle-mode from MariaDB 10.3 permits the optional keywords REUSE STORAGE or\nDROP STORAGE to be used.\n\nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE] [WAIT n | NOWAIT]\n\nThese have no effect on the operation.\n\nPerformance\n-----------\n\nTRUNCATE TABLE is faster than DELETE, because it drops and re-creates a table.\n\nWith InnoDB, TRUNCATE TABLE is slower if innodb_file_per_table=ON is set (the\ndefault). This is because TRUNCATE TABLE unlinks the underlying tablespace\nfile, which can be an expensive operation. See MDEV-8069 for more details.\n\nThe performance issues with innodb_file_per_table=ON can be exacerbated in\ncases where the InnoDB buffer pool is very large and\ninnodb_adaptive_hash_index=ON is set. In that case, using DROP TABLE followed\nby CREATE TABLE instead of TRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF (it defaults to ON before MariaDB 10.5) can\nalso help. In MariaDB 10.2 only, from MariaDB 10.2.19, this performance can\nalso be improved by setting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n\nSetting innodb_adaptive_hash_index=OFF can also improve TRUNCATE TABLE\nperformance in general. See MDEV-16796 for more details.\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 (704,38,'CREATE DATABASE','Syntax\n------\n\nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'comment\'\n\nDescription\n-----------\n\nCREATE DATABASE creates a database with the given name. To use this statement,\nyou need the CREATE privilege for the database. CREATE SCHEMA is a synonym for\nCREATE DATABASE.\n\nFor valid identifiers to use as database names, see Identifier Names.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.3\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 shortcut for:\n\nDROP DATABASE IF EXISTS db_name;\nCREATE DATABASE db_name ...;\n\nIF NOT EXISTS\n-------------\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead\nof an error if the specified database already exists.\n\nCOMMENT\n-------\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024\nbytes. If the comment length exceeds this length, a error/warning code 4144 is\nthrown. The database comment is also added to the db.opt file, as well as to\nthe information_schema.schemata table.\n\nExamples\n--------\n\nCREATE DATABASE db1;\nQuery OK, 1 row affected (0.18 sec)\n\nCREATE DATABASE db1;\nERROR 1007 (HY000): Can\'t create database \'db1\'; database exists\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\'; database exists |\n+-------+------+----------------------------------------------+\n\nSetting the character sets and collation. See Setting Character Sets and\nCollations for more details.\n\nCREATE DATABASE czech_slovak_names \n CHARACTER SET = \'keybcs2\'\n COLLATE = \'keybcs2_bin\';\n\nComments, from MariaDB 10.5.0:\n\nCREATE DATABASE presentations COMMENT \'Presentations for conferences\';\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 (705,38,'CREATE EVENT','Syntax\n------\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-----------\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as follows:\n\n* The keywords CREATE EVENT plus an event name, which uniquely identifies\n the event in the current schema. (Prior to MySQL 5.1.12, the event name\n needed to be unique only among events created by the same user on a given\n database.)\n* An ON SCHEDULE clause, which determines when and how often the event\n executes.\n* A DO clause, which contains the SQL statement to be executed by 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 event executes\nonce — one hour following its creation — by running an SQL statement that\nincrements the value of the myschema.mytable table\'s mycol column by 1.\n\nThe event_name must be a valid MariaDB identifier with a maximum length of 64\ncharacters. It may be delimited using back ticks, and may be qualified with\nthe name of a database schema. An event is associated with both a MariaDB user\n(the definer) and a schema, and its name must be unique among names of events\nwithin that schema. In general, the rules governing event names are the same\nas those for names of stored routines. See Identifier Names.\n\nIf no schema is indicated as part of event_name, the default (current) schema\nis assumed.\n\nFor valid identifiers to use as event names, see Identifier Names.\n\nOR REPLACE\n----------\n\nThe OR REPLACE clause was included in MariaDB 10.1.4. If used and the event\nalready exists, instead of an error being returned, the existing event will be\ndropped and replaced by the newly defined event.\n\nIF NOT EXISTS\n-------------\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the event already exists. Cannot be used together with OR REPLACE.\n\nON SCHEDULE\n-----------\n\nThe ON SCHEDULE clause can be used to specify when the event must be triggered.\n\nAT\n--\n\nIf you want to execute the event only once (one time event), you can use the\nAT keyword, followed by a timestamp. If you use CURRENT_TIMESTAMP, the event\nacts as soon as it is created. As a convenience, you can add one or more\nintervals to that timestamp. You can also specify a timestamp in the past, so\nthat the event is stored but not triggered, until you modify it via ALTER\nEVENT.\n\nThe following example shows how to create an event that will be triggered\ntomorrow at a certain time:\n\nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL 3 HOUR\nDO something;\n\nYou can also specify that an event must be triggered at a regular interval\n(recurring event). In such cases, use the EVERY clause followed by the\ninterval.\n\nIf an event is recurring, you can specify when the first execution must happen\nvia the STARTS clause and a maximum time for the last execution via the ENDS\nclause. STARTS and ENDS clauses are followed by a timestamp and, optionally,\none or more intervals. The ENDS clause can specify a timestamp in the past, so\nthat the event is stored but not executed until you modify it via ALTER EVENT.\n\nIn the following example, next month a recurring event will be triggered\nhourly 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 units are the same\nused for other staments and time functions, except that you can\'t use\nmicroseconds for events. For simple time units, like HOUR or MINUTE, the\nquantity is an integer number, for example \'10 MINUTE\'. For composite time\nunits, like HOUR_MINUTE or HOUR_SECOND, the quantity must be a string with all\ninvolved simple values and their separators, for example \'2:30\' or \'2:30:30\'.\n\nON COMPLETION [NOT] PRESERVE\n----------------------------\n\nThe ON COMPLETION clause can be used to specify if the event must be deleted\nafter its last execution (that is, after its AT or ENDS timestamp is past). By\ndefault, events are dropped when they are expired. To explicitly state that\nthis is the desired behaviour, you can use ON COMPLETION NOT PRESERVE.\nInstead, if you want the event to be preserved, you can use ON COMPLETION\nPRESERVE.\n\nIn you specify ON COMPLETION NOT PRESERVE, and you specify a timestamp in the\npast for AT or ENDS clause, the event will be immediatly dropped. In such\ncases, you will get a Note 1558: \"Event execution time is in the past and ON\nCOMPLETION NOT PRESERVE is set. The event was dropped immediately after\ncreation\".\n\nENABLE/DISABLE/DISABLE ON SLAVE\n-------------------------------\n\nEvents are ENABLEd by default. If you want to stop MariaDB from executing an\nevent, you may specify DISABLE. When it is ready to be activated, you may\nenable it using ALTER EVENT. Another option is DISABLE ON SLAVE, which\nindicates that an event was created on a master and has been replicated to the\nslave, which is prevented from executing the event. If DISABLE ON SLAVE is\nspecifically set, the event will be disabled everywhere. It will not be\nexecuted on the mater or the slaves.\n\nCOMMENT\n-------\n\nThe COMMENT clause may be used to set a comment for the event. Maximum length\nfor comments is 64 characters. The comment is a string, so it must be quoted.\nTo see events comments, you can query the INFORMATION_SCHEMA.EVENTS table (the\ncolumn is named EVENT_COMMENT).\n\nExamples\n--------\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 3 HOUR\nDO something;\n\nNext month a recurring event will be 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\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;\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;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+--------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------+\n| Note | 1537 | Event \'myevent\' already exists |\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 (706,38,'CREATE FUNCTION','Syntax\n------\n\nCREATE [OR REPLACE]\n [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...]\n RETURN func_body\nfunc_parameter:\n [ IN | OUT | INOUT | IN OUT ] param_name type\ntype:\n Any valid MariaDB data type\ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\nfunc_body:\n Valid SQL procedure statement\n\nDescription\n-----------\n\nUse the CREATE FUNCTION statement to create a new stored function. You must\nhave the CREATE ROUTINE database privilege to use CREATE FUNCTION. A function\ntakes any number of arguments and returns a value from the function body. The\nfunction body can be any valid SQL expression as you would use, for example,\nin any select expression. If you have the appropriate privileges, you can call\nthe function exactly as you would any built-in function. See Security below\nfor details on privileges.\n\nYou can also use a variant of the CREATE FUNCTION statement to install a\nuser-defined function (UDF) defined by a plugin. See CREATE FUNCTION (UDF) for\ndetails.\n\nYou can use a SELECT statement for the function body by enclosing it in\nparentheses, exactly as you would to use a subselect for any other expression.\nThe SELECT statement must return a single value. If more than one column is\nreturned when the function is called, error 1241 results. If more than one row\nis returned when the function is called, error 1242 results. Use a LIMIT\nclause to ensure only one row is returned.\n\nYou can also replace the RETURN clause with a BEGIN...END compound statement.\nThe compound statement must contain a RETURN statement. When the function is\ncalled, the RETURN statement immediately returns its result, and any\nstatements after RETURN are effectively ignored.\n\nBy default, a function is associated with the current database. To associate\nthe function explicitly with a given database, specify the fully-qualified\nname as db_name.func_name when you create it. If the function name is the same\nas the name of a built-in function, you must use the fully qualified name when\nyou call it.\n\nThe parameter list enclosed within parentheses must always be present. If\nthere are no parameters, an empty parameter list of () should be used.\nParameter names are not case sensitive.\n\nEach parameter can be declared to use any valid data type, except that the\nCOLLATE attribute cannot be used.\n\nFor valid identifiers to use as function names, see Identifier Names.\n\nIN | OUT | INOUT | IN OUT\n-------------------------\n\nMariaDB starting with 10.8.0\n----------------------------\nThe function parameter qualifiers for IN, OUT, INOUT, and IN OUT were added in\na 10.8.0 preview release. Prior to 10.8.0 quantifiers were supported only in\nprocedures.\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and\nnot SELECT. These quantifiers are especially useful for creating functions\nwith more than one return value. This allows functions to be more complex and\nnested.\n\nDELIMITER $$\nCREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT\nBEGIN\n SET c = 100;\n RETURN a + b;\nEND;\n$$\nDELIMITER ;\n\nSET @a = 2;\nSET @b = 3;\nSET @c = 0;\nSET @res= add_func3(@a, @b, @c);\n\nSELECT add_func3(@a, @b, @c);\nERROR 4186 (HY000): OUT or INOUT argument 3 for function add_func3 is not\nallowed here\n\nDELIMITER $$\nCREATE FUNCTION add_func4(IN a INT, IN b INT, d INT) RETURNS INT\nBEGIN\n DECLARE c, res INT;\n SET res = add_func3(a, b, c) + d;\n if (c > 99) then\n return 3;\n else\n return res;\n end if;\nEND;\n$$\n\nDELIMITER ;\n\nSELECT add_func4(1,2,3);\n+------------------+\n| add_func4(1,2,3) |\n+------------------+\n| 3 |\n+------------------+\n\nAGGREGATE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nFrom MariaDB 10.3.3, it is possible to create stored aggregate functions as\nwell. See Stored Aggregate Functions for details.\n\nRETURNS\n-------\n\nThe RETURNS clause specifies the return type of the function. NULL values are\npermitted with all return types.\n\nWhat happens if the RETURN clause returns a value of a different type? It\ndepends on the SQL_MODE in effect at the moment of the function creation.\n\nIf the SQL_MODE is strict (STRICT_ALL_TABLES or STRICT_TRANS_TABLES flags are\nspecified), a 1366 error will be produced.\n\nOtherwise, the value is coerced to the proper type. For example, if a function\nspecifies an ENUM or SET value in the RETURNS clause, but the RETURN clause\nreturns an integer, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nMariaDB stores the SQL_MODE system variable setting that is in effect at the\ntime a routine is created, and always executes the routine with this setting\nin force, regardless of the server SQL mode in effect when the routine is\ninvoked.\n\nLANGUAGE SQL\n------------\n\nLANGUAGE SQL is a standard SQL clause, and it can be used in MariaDB for\nportability. However that clause has no meaning, because SQL is the only\nsupported language for stored functions.\n\nA function is deterministic if it can produce only one result for a given list\nof parameters. If the result may be affected by stored data, server variables,\nrandom numbers or any value that is not explicitly passed, then the function\nis not deterministic. Also, a function is non-deterministic if it uses\nnon-deterministic functions like NOW() or CURRENT_TIMESTAMP(). The optimizer\nmay choose a faster execution plan if it known that the function is\ndeterministic. In such cases, you should declare the routine using the\nDETERMINISTIC keyword. If you want to explicitly state that the function is\nnot deterministic (which is the default) you can use the NOT DETERMINISTIC\nkeywords.\n\nIf you declare a non-deterministic function as DETERMINISTIC, you may get\nincorrect results. If you declare a deterministic function as NOT\nDETERMINISTIC, in some cases the queries will be slower.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.3\n----------------------------\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP FUNCTION IF EXISTS function_name;\nCREATE FUNCTION function_name ...;\n\nwith the exception that any existing privileges for the function are not\ndropped.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.3\n----------------------------\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the function already exists. Cannot be used together with OR\nREPLACE.\n\n[NOT] DETERMINISTIC\n-------------------\n\nThe [NOT] DETERMINISTIC clause also affects binary logging, because the\nSTATEMENT format can not be used to store or replicate non-deterministic\nstatements.\n\nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA are informative\nclauses that tell the server what the function does. MariaDB does not check in\nany way whether the specified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n\nMODIFIES SQL DATA\n-----------------\n\nMODIFIES SQL DATA means that the function contains statements that may modify\ndata stored in databases. This happens if the function contains statements\nlike DELETE, UPDATE, INSERT, REPLACE or DDL.\n\nREADS SQL DATA\n--------------\n\nREADS SQL DATA means that the function reads data stored in databases, but\ndoes not modify any data. This happens if SELECT statements are used, but\nthere no write operations are executed.\n\nCONTAINS SQL\n------------\n\nCONTAINS SQL means that the function contains at least one SQL statement, but\nit does not read or write any data stored in a database. Examples include SET\nor DO.\n\nNO SQL\n------\n\nNO SQL means nothing, because MariaDB does not currently support any language\nother than SQL.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has been supported in\naddition to the traditional SQL/PSM-based MariaDB syntax. See Oracle mode from\nMariaDB 10.3 for details on changes when running Oracle mode.\n\nSecurity\n--------\n\nYou must have the EXECUTE privilege on a function to call it. MariaDB\nautomatically grants the EXECUTE and ALTER ROUTINE privileges to the account\nthat called CREATE FUNCTION, even if the DEFINER clause was used.\n\nEach function has an account associated as the definer. By default, the\ndefiner is the account that created the function. Use the DEFINER clause to\nspecify a different account as the definer. You must have the SUPER privilege,\nor, from MariaDB 10.5.2, the SET USER privilege, to use the DEFINER clause.\nSee Account Names for details on specifying accounts.\n\nThe SQL SECURITY clause specifies what privileges are used when a function is\ncalled. If SQL SECURITY is INVOKER, the function body will be evaluated using\nthe privileges of the user calling the function. If SQL SECURITY is DEFINER,\nthe function body is always evaluated using the privileges of the definer\naccount. DEFINER is the default.\n\nThis allows you to create functions that grant limited access to certain data.\nFor example, say you have a table that stores some employee information, and\nthat you\'ve granted SELECT privileges only on certain columns to the user\naccount roger.\n\nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary INT);\nGRANT SELECT (name, dept) ON employees TO roger;\n\nTo allow the user the get the maximum salary for a department, define a\nfunction and grant the EXECUTE privilege:\n\nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT RETURN\n (SELECT MAX(salary) FROM employees WHERE employees.dept = dept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n\nSince SQL SECURITY defaults to DEFINER, whenever the user roger calls this\nfunction, the subselect will execute with your privileges. As long as you have\nprivileges to select the salary of each employee, the caller of the function\nwill be able to get the maximum salary for each department without being able\nto see individual salaries.\n\nCharacter sets and collations\n-----------------------------\n\nFunction return types can be declared to use any valid character set and\ncollation. If used, the COLLATE attribute needs to be preceded by a CHARACTER\nSET attribute.\n\nIf the character set and collation are not specifically set in the statement,\nthe database defaults at the time of creation will be used. If the database\ndefaults change at a later stage, the stored function character set/collation\nwill not be changed at the same time; the stored function needs to be dropped\nand recreated to ensure the same character set/collation as the database is\nused.\n\nExamples\n--------\n\nThe following example function takes a parameter, performs an 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 data with\nstatements like INSERT and UPDATE. The following example creates a counter\nfunction that uses a temporary table to store the current value. Because the\ncompound statement contains statements terminated with semicolons, you have to\nfirst change the statement delimiter with the DELIMITER statement to allow the\nsemicolon to be used in the function body. See Delimiters in the mysql client\nfor 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 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 \'utf8_bin\' DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\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 (707,38,'CREATE INDEX','Syntax\n------\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 | CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\n\nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n\nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n\nDescription\n-----------\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes. See\nALTER TABLE. CREATE INDEX cannot be used to create a PRIMARY KEY; use ALTER\nTABLE instead.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nAnother shortcut, DROP INDEX, allows the removal of an index.\n\nFor valid identifiers to use as index names, see Identifier Names.\n\nNote that KEY_BLOCK_SIZE is currently ignored in CREATE INDEX, although it is\nincluded in the output of SHOW CREATE TABLE.\n\nPrivileges\n----------\n\nExecuting the CREATE INDEX statement requires the INDEX privilege for the\ntable or the database.\n\nOnline DDL\n----------\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nCREATE OR REPLACE INDEX\n-----------------------\n\nMariaDB starting with 10.1.4\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 exists, then instead\nof returning an error, the server will drop the existing index and replace it\nwith the newly defined index.\n\nCREATE INDEX IF NOT EXISTS\n--------------------------\n\nIf the IF NOT EXISTS clause is used, then the index will only be created if an\nindex with the same name does not already exist. If the index already exists,\nthen a warning will be triggered by default.\n\nIndex Definitions\n-----------------\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nALGORITHM\n---------\n\nSee ALTER TABLE: ALGORITHM for more information.\n\nLOCK\n----\n\nSee ALTER TABLE: LOCK for more information.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for CREATE INDEX statement for clients\nthat support the new progress reporting protocol. For example, if you were\nusing the mysql client, then the progress 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 PROCESSLIST\nstatement and in the contents of the information_schema.PROCESSLIST table.\n\nSee Progress Reporting for more information.\n\nWITHOUT OVERLAPS\n----------------\n\nMariaDB starting with 10.5.3\n----------------------------\nThe WITHOUT OVERLAPS clause allows one to constrain a primary or unique index\nsuch that application-time periods cannot overlap.\n\nExamples\n--------\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| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1061 | Duplicate key name \'xi\' |\n+-------+------+-------------------------+\n\nFrom MariaDB 10.5.3, creating a unique index for an application-time period\ntable with a WITHOUT OVERLAPS constraint:\n\nCREATE UNIQUE INDEX u ON rooms (room_number, p WITHOUT OVERLAPS);\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 (708,38,'CREATE PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\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 [ IN | OUT | INOUT | IN OUT ] 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 DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nDescription\n-----------\n\nThe CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nThe CREATE PACKAGE creates the specification for a stored package (a\ncollection of logically related stored objects). A stored package\nspecification declares public routines (procedures and functions) of the\npackage, but does not implement these routines.\n\nA package whose specification was created by the CREATE PACKAGE statement,\nshould later be implemented using the CREATE PACKAGE BODY statement.\n\nFunction parameter quantifiers IN | OUT | INOUT | IN OUT\n--------------------------------------------------------\n\nMariaDB starting with 10.8.0\n----------------------------\nThe function parameter quantifiers for IN, OUT, INOUT, and IN OUT where added\nin a 10.8.0 preview release. Prior to 10.8.0 quantifiers were supported only\nin procedures.\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and\nnot SELECT. These quantifiers are especially useful for creating functions and\nprocedures with more than one return value. This allows functions and\nprocedures to be more complex and nested.\n\nExamples\n--------\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\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 (709,38,'CREATE PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\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 \';\' [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\nDescription\n-----------\n\nThe CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nThe CREATE PACKAGE BODY statement creates the package body for a stored\npackage. The package specification must be previously created using the CREATE\nPACKAGE statement.\n\nA package body provides implementations of the package public routines and can\noptionally have:\n\n* package-wide private variables\n* package private routines\n* forward declarations for private routines\n* an executable initialization section\n\nExamples\n--------\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, esalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n\nFUNCTION 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=\' || nSalary);\n RETURN nSalary;\n END;\n\nPROCEDURE 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=\' || amount);\n END;\n\nPROCEDURE 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() || \' \' || current_user || \' started\');\nEND;\n$$\n\nDELIMITER ;\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 (710,38,'CREATE PROCEDURE','Syntax\n------\n\nCREATE\n [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PROCEDURE [IF NOT EXISTS] 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 DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nroutine_body:\n Valid SQL procedure statement\n\nDescription\n-----------\n\nCreates a stored procedure. By default, a routine is associated with the\ndefault database. To associate the routine explicitly with a given database,\nspecify the name as db_name.sp_name when you create it.\n\nWhen the routine is invoked, an implicit USE db_name is performed (and undone\nwhen the routine terminates). The causes the routine to have the given default\ndatabase while it executes. USE statements within stored routines are\ndisallowed.\n\nWhen a stored procedure has been created, you invoke it by using the CALL\nstatement (see CALL).\n\nTo execute the CREATE PROCEDURE statement, it is necessary to have the CREATE\nROUTINE privilege. By default, MariaDB automatically grants the ALTER ROUTINE\nand EXECUTE privileges to the routine creator. See also Stored Routine\nPrivileges.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be used\nwhen checking access privileges at routine execution time, as described here.\nRequires the SUPER privilege, or, from MariaDB 10.5.2, the SET USER privilege.\n\nIf the routine name is the same as the name of a built-in SQL function, you\nmust use a space between the name and the following parenthesis when defining\nthe routine, or a syntax error occurs. This is also true when you invoke the\nroutine later. For this reason, we suggest that it is better to avoid re-using\nthe names of existing SQL functions for your own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always allowable to have spaces after a routine name,\nregardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present. If\nthere are no parameters, an empty parameter list of () should be used.\nParameter names are not case sensitive.\n\nEach parameter can be declared to use any valid data type, except that the\nCOLLATE attribute cannot be used.\n\nFor valid identifiers to use as procedure names, see Identifier Names.\n\nThings to be Aware of With CREATE OR REPLACE\n--------------------------------------------\n\n* One can\'t use OR REPLACE together with IF EXISTS.\n\nCREATE PROCEDURE IF NOT EXISTS\n------------------------------\n\nIf the IF NOT EXISTS clause is used, then the procedure will only be created\nif a procedure with the same name does not already exist. If the procedure\nalready exists, then a warning will be triggered by default.\n\nIN/OUT/INOUT\n------------\n\nEach parameter is an IN parameter by default. To specify otherwise for a\nparameter, use the keyword OUT or INOUT before the parameter name.\n\nAn IN parameter passes a value into a procedure. The procedure might modify\nthe value, but the modification is not visible to the caller when the\nprocedure returns. An OUT parameter passes a value from the procedure back to\nthe caller. Its initial value is NULL within the procedure, and its value is\nvisible to the caller when the procedure returns. An INOUT parameter is\ninitialized by the caller, can be modified by the procedure, and any change\nmade by the procedure is visible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the CALL\nstatement that invokes the procedure so that you can obtain its value when the\nprocedure returns. If you are calling the procedure from within another stored\nprocedure or function, you can also pass a routine parameter or local routine\nvariable as an IN or INOUT parameter.\n\nDETERMINISTIC/NOT DETERMINISTIC\n-------------------------------\n\nDETERMINISTIC and NOT DETERMINISTIC apply only to functions. Specifying\nDETERMINISTC or NON-DETERMINISTIC in procedures has no effect. The default\nvalue is NOT DETERMINISTIC. Functions are DETERMINISTIC when they always\nreturn the same value for the same input. For example, a truncate or substring\nfunction. Any function involving data, therefore, is always NOT DETERMINISTIC.\n\nCONTAINS SQL/NO SQL/READS SQL DATA/MODIFIES SQL DATA\n----------------------------------------------------\n\nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA are informative\nclauses that tell the server what the function does. MariaDB does not check in\nany way whether the specified 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 statements that may modify\ndata stored in databases. This happens if the function contains statements\nlike DELETE, UPDATE, INSERT, REPLACE or DDL.\n\nREADS SQL DATA means that the function reads data stored in databases, but\ndoes not modify any data. This happens if SELECT statements are used, but\nthere no write operations are executed.\n\nCONTAINS SQL means that the function contains at least one SQL statement, but\nit does not read or write any data stored in a database. Examples include SET\nor DO.\n\nNO SQL means nothing, because MariaDB does not currently support any language\nother than SQL.\n\nThe routine_body consists of a valid SQL procedure statement. This can be a\nsimple statement such as SELECT or INSERT, or it can be a compound statement\nwritten using BEGIN and END. Compound statements can contain declarations,\nloops, and other control structure statements. See Programmatic and Compound\nStatements for syntax details.\n\nMariaDB allows routines to contain DDL statements, such as CREATE and DROP.\nMariaDB also allows stored procedures (but not stored functions) to contain\nSQL transaction statements such as COMMIT.\n\nFor additional information about statements that are not allowed in stored\nroutines, see Stored Routine Limitations.\n\nInvoking stored procedure from within programs\n----------------------------------------------\n\nFor information about invoking stored procedures from within programs written\nin a language that has a MariaDB/MySQL interface, see CALL.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP PROCEDURE IF EXISTS name;\nCREATE PROCEDURE name ...;\n\nwith the exception that any existing privileges for the procedure are not\ndropped.\n\nsql_mode\n--------\n\nMariaDB stores the sql_mode system variable setting that is in effect at the\ntime a routine is created, and always executes the routine with this setting\nin force, regardless of the server SQL mode in effect when the routine is\ninvoked.\n\nCharacter Sets and Collations\n-----------------------------\n\nProcedure parameters can be declared with any character set/collation. If the\ncharacter set and collation are not specifically set, the database defaults at\nthe time of creation will be used. If the database defaults change at a later\nstage, the stored procedure character set/collation will not be changed at the\nsame time; the stored procedure needs to be dropped and recreated to ensure\nthe same character set/collation as the database is used.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has been supported in\naddition to the traditional SQL/PSM-based MariaDB syntax. See Oracle mode from\nMariaDB 10.3 for details on changes when running Oracle mode.\n\nExamples\n--------\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter. It uses the DELIMITER command to set a new delimiter for the\nduration of the process — see Delimiters in 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 \'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 \'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\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 \'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n\nDELIMITER ;\nQuery OK, 0 rows affected (0.03 sec)\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 (711,38,'CREATE SERVER','Syntax\n------\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-----------\n\nThis statement creates the definition of a server for use with the Spider,\nConnect, FEDERATED or FederatedX storage engine. The CREATE SERVER statement\ncreates a new row within the servers table within the mysql database. This\nstatement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED\nADMIN privilege.\n\nThe server_name should be a unique reference to the server. Server definitions\nare global within the scope of the server, it is not possible to qualify the\nserver definition to a specific database. server_name has a maximum length of\n64 characters (names longer than 64 characters are silently truncated), and is\ncase insensitive. You may specify the name as a quoted string.\n\nThe wrapper_name may be quoted with single quotes. Supported values are:\n\n* mysql\n* mariadb (in MariaDB 10.3 and later)\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are silently\ntruncated to 64 characters. Numeric literals must be a number between 0 and\n9999, default value is 0.\n\nNote: The OWNER option is currently not applied, and has no effect on the\nownership or operation of the server connection that is created.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table that\ncan later be used with the CREATE TABLE statement when creating a Spider,\nConnect, FederatedX or FEDERATED table. The options that you specify will be\nused to populate the columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nDROP SERVER removes a previously created server definition.\n\nCREATE SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nFor valid identifiers to use as server names, see Identifier Names.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP SERVER IF EXISTS name;\nCREATE SERVER server_name ...;\n\nIF NOT EXISTS\n-------------\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the server already exists. Cannot be used together with OR REPLACE.\n\nExamples\n--------\n\nCREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'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 \'test\');\nERROR 1476 (HY000): The foreign server, s, you are trying to create already\nexists\n\nCREATE OR REPLACE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'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 \'test\');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------------------------\n+\n| Level | Code | Message \n |\n+-------+------+---------------------------------------------------------------\n+\n| Note | 1476 | The foreign server, s, you are trying to create already\nexists |\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 (712,38,'CREATE TABLESPACE','The CREATE TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (713,38,'CREATE TRIGGER','Syntax\n------\n\nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n TRIGGER [IF NOT EXISTS] trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW\n [{ FOLLOWS | PRECEDES } other_trigger_name ]\n trigger_stmt;\n\nDescription\n-----------\n\nThis statement creates a new trigger. A trigger is a named database object\nthat is associated with a table, and that activates when a particular event\noccurs for the table. The trigger becomes associated with the table named\ntbl_name, which must refer to a permanent table. You cannot associate a\ntrigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated with\nthe trigger.\n\nMariaDB starting with 10.2.3\n----------------------------\nYou can have multiple triggers for the same trigger_time and trigger_event.\n\nFor valid identifiers to use as trigger names, see Identifier Names.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.4\n----------------------------\nIf used and the trigger already exists, instead of an error being returned,\nthe existing trigger will be dropped and replaced by the newly defined trigger.\n\nDEFINER\n-------\n\nThe DEFINER clause determines the security context to be used when checking\naccess privileges at trigger activation time. Usage requires the SUPER\nprivilege, or, from MariaDB 10.5.2, the SET USER privilege.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.4\n----------------------------\nIf the IF NOT EXISTS clause is used, the trigger will only be created if a\ntrigger of the same name does not exist. If the trigger already exists, by\ndefault a warning will be returned.\n\ntrigger_time\n------------\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to indicate\nthat the trigger activates before or after each row to be modified.\n\ntrigger_event\n-------------\n\ntrigger_event indicates the kind of statement that activates the trigger. The\ntrigger_event can be one of the following:\n\n* INSERT: The trigger is activated whenever a new row is inserted into the\ntable; for example, through INSERT, LOAD DATA, and REPLACE statements.\n* UPDATE: The trigger is activated whenever a row is modified; for example,\nthrough UPDATE statements.\n* DELETE: The trigger is activated whenever a row is deleted from the table;\nfor example, through DELETE and REPLACE statements. However, DROP TABLE and\nTRUNCATE statements on the table do not activate this trigger, because they do\nnot use DELETE. Dropping a partition does not activate DELETE triggers, either.\n\nFOLLOWS/PRECEDES other_trigger_name\n-----------------------------------\n\nMariaDB starting with 10.2.3\n----------------------------\nThe FOLLOWS other_trigger_name and PRECEDES other_trigger_name options were\nadded in MariaDB 10.2.3 as part of supporting multiple triggers per action\ntime. This is the same syntax used by MySQL 5.7, although MySQL 5.7 does not\nhave multi-trigger support.\n\nFOLLOWS adds the new trigger after another trigger while PRECEDES adds the new\ntrigger before another trigger. If neither option is used, the new trigger is\nadded last for the given action and time.\n\nFOLLOWS and PRECEDES are not stored in the trigger definition. However the\ntrigger order is guaranteed to not change over time. mariadb-dump/mysqldump\nand other backup methods will not change trigger order. You can verify the\ntrigger order from the ACTION_ORDER column in INFORMATION_SCHEMA.TRIGGERS\ntable.\n\nSELECT trigger_name, action_order FROM information_schema.triggers \n WHERE event_object_table=\'t1\';\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE TRIGGER is atomic.\n\nExamples\n--------\n\nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_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 = animal_count.animals+1;\nERROR 1359 (HY000): Trigger already exists\n\nCREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_count.animals+1;\nQuery OK, 0 rows affected (0.12 sec)\n\nCREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_count.animals+1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1359 | Trigger already exists |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\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 (714,38,'CREATE VIEW','Syntax\n------\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-----------\n\nThe CREATE VIEW statement creates a new view, or replaces an existing one if\nthe OR REPLACE clause is given. If the view does not exist, CREATE OR REPLACE\nVIEW is the same as CREATE VIEW. If the view does exist, CREATE OR REPLACE\nVIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition of the\nview. (When you select from the view, you select in effect using the SELECT\nstatement.) select_statement can select from base tables or other views.\n\nThe view definition is \"frozen\" at creation time, so changes to the underlying\ntables afterwards do not affect the view definition. For example, if a view is\ndefined as SELECT * on a table, new columns added to the table later do not\nbecome part of the view. A SHOW CREATE VIEW shows that such queries are\nrewritten and column names are included in the view definition.\n\nThe view definition must be a query that does not return errors at view\ncreation times. However, the base tables used by the views might be altered\nlater and the query may not be valid anymore. In this case, querying the view\nwill result in an error. CHECK TABLE helps in finding this kind of problems.\n\nThe ALGORITHM clause affects how MariaDB processes the view. The DEFINER and\nSQL SECURITY clauses specify the security context to be used when checking\naccess privileges at view invocation time. The WITH CHECK OPTION clause can be\ngiven to constrain inserts or updates to rows in tables referenced by the\nview. These clauses are described later in this section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the view, and\nsome privilege for each column selected by the SELECT statement. For columns\nused elsewhere in the SELECT statement you must have the SELECT privilege. If\nthe OR REPLACE clause is present, you must also have the DROP privilege for\nthe view.\n\nA view belongs to a database. By default, a new view is created in the default\ndatabase. To create the view explicitly in a given database, specify the name\nas 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 database, so a\ndatabase cannot contain a base table and a view that have the same name.\n\nViews must have unique column names with no duplicates, just like base tables.\nBy default, the names of the columns retrieved by the SELECT statement are\nused for the view column names. To define explicit names for the view columns,\nthe optional column_list clause can be given as a list of comma-separated\nidentifiers. The number of names in column_list must be the same as the number\nof columns retrieved by the SELECT statement.\n\nMySQL until 5.1.28\n------------------\nPrior to MySQL 5.1.29, When you modify an existing view, the current view\ndefinition is backed up and saved. It is stored in that table\'s database\ndirectory, in a subdirectory named arc. The backup file for a view v is named\nv.frm-00001. If you alter the view again, the next backup is named\nv.frm-00002. The three latest view backup definitions are stored. Backed up\nview definitions are not preserved by mysqldump, or any other such programs,\nbut you can retain them using a file copy operation. However, they are not\nneeded for anything but to provide you with a backup of your previous view\ndefinition. It is safe to remove these backup definitions, but only while\nmysqld is not running. If you delete the arc subdirectory or its files while\nmysqld is running, you will receive an error the next time you try to alter\nthe view:\n\nMariaDB [test]> ALTER VIEW v AS SELECT * FROM t; \nERROR 6 (HY000): Error on delete of \'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n\nColumns retrieved by the SELECT statement can be simple references to table\ncolumns. They can also be expressions that use functions, constant values,\noperators, and so forth.\n\nUnqualified table or view names in the SELECT statement are interpreted with\nrespect to the default database. A view can refer to tables or views in other\ndatabases by qualifying the table or view name with the proper database name.\n\nA view can be created from many kinds of SELECT statements. It can refer to\nbase tables or other views. It can use joins, UNION, and subqueries. The\nSELECT need not even refer to any tables. The following example defines a view\nthat selects two columns from another table, as well as an expression\ncalculated from those columns:\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 t;\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:\n\n* The SELECT statement cannot contain a subquery in the FROM clause.\n* The SELECT statement cannot refer to system or user variables.\n* Within a stored program, the definition cannot refer to program parameters\nor local variables.\n* The SELECT statement cannot refer to prepared statement parameters.\n* Any table or view referred to in the definition must exist. However, after a\nview has been created, it is possible to drop a table or view that the\ndefinition refers to. In this case, use of the view results in an error. To\ncheck a view definition for problems of this kind, use the CHECK TABLE\nstatement.\n* The definition cannot refer to a TEMPORARY table, and you cannot create a\nTEMPORARY view.\n* Any tables named in the view definition must exist at definition time.\n* You cannot associate a trigger with a view.\n* For valid identifiers to use as view names, see Identifier Names.\n\nORDER BY is allowed in a view definition, but it is ignored if you select from\na view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the options\nor clauses of the statement that references the view, but the effect is\nundefined. For example, if a view definition includes a LIMIT clause, and you\nselect from the view using a statement that has its own LIMIT clause, it is\nundefined which limit applies. This same principle applies to options such as\nALL, DISTINCT, or SQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such as INTO, FOR UPDATE, and LOCK IN SHARE MODE.\n\nThe PROCEDURE clause cannot be used in a view definition, and it cannot be\nused if a view is referenced in the FROM clause.\n\nIf you create a view and then change the query processing environment by\nchanging system variables, that may affect the results that you get from the\nview:\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 account to use\nwhen checking access privileges for the view when a statement is executed that\nreferences the view. They were added in MySQL 5.1.2. The legal SQL SECURITY\ncharacteristic values are DEFINER and INVOKER. These indicate that the\nrequired privileges must be held by the user who defined or invoked the view,\nrespectively. The default SQL SECURITY value is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MariaDB\naccount in \'user_name\'@\'host_name\' format (the same format used in the GRANT\nstatement). The user_name and host_name values both are required. The definer\ncan also be given as CURRENT_USER or CURRENT_USER(). The default DEFINER value\nis the user who executes the CREATE VIEW statement. This is the same as\nspecifying DEFINER = CURRENT_USER explicitly.\n\nIf you specify the DEFINER clause, these rules determine the legal DEFINER\nuser values:\n\n* If you do not have the SUPER privilege, or, from MariaDB 10.5.2, the SET\nUSER privilege, the only legal user value is your own account, either\nspecified literally or by using CURRENT_USER. You cannot set the definer to\nsome other account.\n* If you have the SUPER privilege, or, from MariaDB 10.5.2, the SET USER\nprivilege, you can specify any syntactically legal account name. If the\naccount does not actually exist, a warning is generated.\n* If the SQL SECURITY value is DEFINER but the definer account does not exist\nwhen the view is referenced, an error occurs.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value by\ndefault. For views defined with the SQL SECURITY INVOKER characteristic,\nCURRENT_USER returns the account for the view\'s invoker. For information about\nuser auditing 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 SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This also\naffects a view defined within such a program, if the view definition contains\na DEFINER value of CURRENT_USER.\n\nView privileges are checked like this:\n\n* At view definition time, the view creator must have the privileges needed to\nuse the top-level objects accessed by the view. For example, if the view\ndefinition refers to table columns, the creator must have privileges for the\ncolumns, as described previously. If the definition refers to a stored\nfunction, only the privileges needed to invoke the function can be checked.\nThe privileges required when the function runs can be checked only as it\nexecutes: For different invocations of the function, different execution paths\nwithin the function might be taken.\n* When a view is referenced, privileges for objects accessed by the view are\nchecked against the privileges held by the view creator or invoker, depending\non whether the SQL SECURITY characteristic is DEFINER or INVOKER, respectively.\n* If reference to a view causes execution of a stored function, privilege\nchecking for statements executed within the function depend on whether the\nfunction is defined with a SQL SECURITY characteristic of DEFINER or INVOKER.\nIf the security characteristic is DEFINER, the function runs with the\nprivileges of its creator. If the characteristic is INVOKER, the function runs\nwith the privileges determined by the view\'s SQL SECURITY characteristic.\n\nExample: A view might depend on a stored function, and that function might\ninvoke other stored routines. For example, the following view invokes a stored\nfunction f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be checked\nwhen f() executes. This might mean that privileges are needed for p1() or\np2(), depending on the execution path within f(). Those privileges must be\nchecked at runtime, and the user who must possess the privileges is determined\nby the SQL SECURITY values of the view v and the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to standard SQL.\nIn standard SQL, views are handled using the rules for SQL SECURITY INVOKER.\n\nIf you invoke a view that was created before MySQL 5.1.2, it is treated as\nthough it was created with a SQL SECURITY DEFINER clause and with a DEFINER\nvalue that is the same as your account. However, because the actual definer is\nunknown, MySQL issues a warning. To make the warning go away, it is sufficient\nto re-create the view so that the view definition includes a DEFINER clause.\n\nThe optional ALGORITHM clause is an extension to standard SQL. It affects how\nMariaDB processes the view. ALGORITHM takes three values: MERGE, TEMPTABLE, or\nUNDEFINED. The default algorithm is UNDEFINED if no ALGORITHM clause is\npresent. See View Algorithms for more information.\n\nSome views are updatable. That is, you can use them in statements such as\nUPDATE, DELETE, or INSERT to update the contents of the underlying table. For\na view to be updatable, there must be a one-to-one relationship between the\nrows in the view and the rows in the underlying table. There are also certain\nother constructs that make a view non-updatable. See Inserting and Updating\nwith Views.\n\nWITH CHECK OPTION\n-----------------\n\nThe WITH CHECK OPTION clause can be given for an updatable view to prevent\ninserts or updates to rows except those for which the WHERE clause in the\nselect_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and CASCADED\nkeywords determine the scope of check testing when the view is defined in\nterms of another view. The LOCAL keyword restricts the CHECK OPTION only to\nthe view being defined. CASCADED causes the checks for underlying views to be\nevaluated as well. When neither keyword is given, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION clause,\nsee Inserting and Updating with Views.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.3\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 warning instead\nof an error if the specified view already exists. Cannot be used together with\nthe OR REPLACE clause.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE VIEW is atomic.\n\nExamples\n--------\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| 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;\nERROR 1050 (42S01): Table \'v\' already exists\n\nCREATE OR REPLACE VIEW v AS SELECT a, a*2 AS a2 FROM t;\nQuery OK, 0 rows affected (0.04 sec)\n\nCREATE VIEW IF NOT EXISTS v AS SELECT a, a*2 AS a2 FROM t;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n','','https://mariadb.com/kb/en/create-view/');
-update help_topic set description = CONCAT(description, '\nSHOW WARNINGS;\n+-------+------+--------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------+\n| Note | 1050 | Table \'v\' already exists |\n+-------+------+--------------------------+\n\nURL: https://mariadb.com/kb/en/create-view/') WHERE help_topic_id = 714;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (715,38,'Generated (Virtual and Persistent/Stored) Columns','Syntax\n------\n\n<type> [GENERATED ALWAYS] AS ( <expression> )\n[VIRTUAL | PERSISTENT | STORED] [UNIQUE] [UNIQUE KEY] [COMMENT <text>]\n\nMariaDB\'s generated columns syntax is designed to be similar to the syntax for\nMicrosoft SQL Server\'s computed columns and Oracle Database\'s virtual columns.\nIn MariaDB 10.2 and later, the syntax is also compatible with the syntax for\nMySQL\'s generated columns.\n\nDescription\n-----------\n\nA generated column is a column in a table that cannot explicitly be set to a\nspecific value in a DML query. Instead, its value is automatically generated\nbased on an expression. This expression might generate the value based on the\nvalues of other columns in the table, or it might generate the value by\ncalling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n* PERSISTENT (a.k.a. STORED): This type\'s value is actually stored in the\ntable.\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nSupported Features\n------------------\n\nStorage Engine Support\n----------------------\n\n* Generated columns can only be used with storage engines which support them.\nIf you try to use a storage engine that does not support them, then you will\nsee an error similar to the following:\n\nERROR 1910 (HY000): TokuDB storage engine does not support computed columns\n\n* InnoDB, Aria, MyISAM and CONNECT support generated columns.\n\n* A column in a MERGE table can be built on a PERSISTENT generated column.\nHowever, a column in a MERGE table can not be defined as a VIRTUAL and\nPERSISTENT generated column.\n\nData Type Support\n-----------------\n\n* All data types are supported when defining generated columns.\n\n* Using the ZEROFILL column option is supported when defining generated\ncolumns.\n\nMariaDB starting with 10.2.6\n----------------------------\nIn MariaDB 10.2.6 and later, the following statements apply to data types for\ngenerated columns:\n\n* Using the AUTO_INCREMENT column option is not supported when defining\ngenerated columns. Previously, it was supported, but this support was removed,\nbecause it would not work correctly. See MDEV-11117.\n\nIndex Support\n-------------\n\n* Using a generated column as a table\'s primary key is not supported. See\nMDEV-5590 for more information. If you try to use one as a primary key, then\nyou will see an error similar to the following:\n\nERROR 1903 (HY000): Primary key cannot be defined upon a computed column\n\n* Using PERSISTENT generated columns as part of a foreign key is supported.\n\n* Referencing PERSISTENT generated columns as part of a foreign key is also\nsupported.\nHowever, using the ON UPDATE CASCADE, ON UPDATE SET NULL, or ON DELETE SET\nNULL clauses is not supported. If you try to use an unsupported clause, then\nyou will see an error similar to the following:\n\nERROR 1905 (HY000): Cannot define foreign key with ON UPDATE SET NULL clause\non a computed column\n\nMariaDB starting with 10.2.3\n----------------------------\nIn MariaDB 10.2.3 and later, the following statements apply to indexes for\ngenerated columns:\n\n* Defining indexes on both VIRTUAL and PERSISTENT generated columns is\nsupported.\nIf an index is defined on a generated column, then the optimizer considers\nusing it in the same way as indexes based on \"real\" columns.\n\nMariaDB until 10.2.2\n--------------------\nIn MariaDB 10.2.2 and before, the following statements apply to indexes for\ngenerated columns:\n\n* Defining indexes on VIRTUAL generated columns is not supported.\n\n* Defining indexes on PERSISTENT generated columns is supported.\nIf an index is defined on a generated column, then the optimizer considers\nusing it in the same way as indexes based on \"real\" columns.\n\nStatement Support\n-----------------\n\n* Generated columns are used in DML queries just as if they were \"real\"\ncolumns.\nHowever, VIRTUAL and PERSISTENT generated columns differ in how their data is\nstored.\nValues for PERSISTENT generated columns are generated whenever a DML queries\ninserts or updates the row with the special DEFAULT value. This generates the\ncolumns value, and it is stored in the table like the other \"real\" columns.\nThis value can be read by other DML queries just like the other \"real\" columns.\nValues for VIRTUAL generated columns are not stored in the table. Instead, the\nvalue is generated dynamically whenever the column is queried. If other\ncolumns in a row are queried, but the VIRTUAL generated column is not one of\nthe queried columns, then the column\'s value is not generated.\n\n* The SELECT statement supports generated columns.\n\n* Generated columns can be referenced in the INSERT, UPDATE, and DELETE\nstatements.\nHowever, VIRTUAL or PERSISTENT generated columns cannot be explicitly set to\nany other values than NULL or DEFAULT. If a generated column is explicitly set\nto any other value, then the outcome depends on whether strict mode is enabled\nin sql_mode. If it is not enabled, then a warning will be raised and the\ndefault generated value will be used instead. If it is enabled, then an error\nwill be raised instead.\n\n* The CREATE TABLE statement has limited support for generated columns.\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 generated columns.\n\n* The ALTER TABLE statement has limited support for generated columns.\nIt supports the MODIFY and CHANGE clauses for PERSISTENT generated columns.\nIt does not support the MODIFY clause for VIRTUAL generated columns if\nALGORITHM is not set to COPY. See MDEV-15476 for more information.\nIt does not support the CHANGE clause for VIRTUAL generated columns if\nALGORITHM is not set to COPY. See MDEV-17035 for more information.\nIt does not support altering a table if ALGORITHM is not set to COPY if the\ntable has a VIRTUAL generated column that is indexed. See MDEV-14046 for more\ninformation.\nIt does not support adding a VIRTUAL generated column with the ADD clause if\nthe same statement is also adding other columns if ALGORITHM is not set to\nCOPY. See MDEV-17468 for more information.\nIt also does not support altering an existing column into a VIRTUAL generated\ncolumn.\nIt supports using generated columns to partition tables.\nIt does not support using the versioning clauses with generated columns.\n\n* The SHOW CREATE TABLE statement supports generated columns.\n\n* The DESCRIBE statement can be used to check whether a table has generated\ncolumns.\nYou can tell which columns are generated by looking for the ones where the\nExtra column is set to either VIRTUAL or PERSISTENT. For example:\n\nDESCRIBE table1;\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\n* Generated columns can be properly referenced in the NEW and OLD rows in\ntriggers.\n\n* Stored procedures support generated columns.\n\n* The HANDLER statement supports generated columns.\n\nExpression Support\n------------------\n\n* Most legal, deterministic expressions which can be calculated are supported\nin expressions for generated columns.\n\n* Most built-in functions are supported in expressions for generated columns.\nHowever, some built-in functions can\'t be supported for technical reasons. For\nexample, If you try to use an unsupported function in an expression, an error\nis generated similar to the following:\n\nERROR 1901 (HY000): Function or expression \'dayname()\' cannot be used in the\nGENERATED ALWAYS AS clause of `v`\n\n* Subqueries are not supported in expressions for generated columns because\nthe underlying data can change.\n\n* Using anything that depends on data outside the row is not supported in\nexpressions for generated columns.\n\n* Stored functions are not supported in expressions for generated columns. See\nMDEV-17587 for more information.\n\nMariaDB starting with 10.2.1\n----------------------------\nIn MariaDB 10.2.1 and later, the following statements apply to expressions for\ngenerated columns:\n\n* Non-deterministic built-in functions are supported in expressions for not\nindexed VIRTUAL generated columns.\n\n* Non-deterministic built-in functions are not supported in expressions for\nPERSISTENT or indexed VIRTUAL generated columns.\n\n* User-defined functions (UDFs) are supported in expressions for generated\ncolumns.\nHowever, MariaDB can\'t check whether a UDF is deterministic, so it is up to\nthe user to be sure that they do not use non-deterministic UDFs with VIRTUAL\ngenerated columns.\n\n* Defining a generated column based on other generated columns defined before\nit in the table definition is supported. For example:\n\nCREATE TABLE t1 (a int as (1), b int as (a));\n\n* However, defining a generated column based on other generated columns\ndefined after in the table definition is not supported in expressions for\ngeneration columns because generated columns are calculated in the order they\nare defined.\n\n* Using an expression that exceeds 255 characters in length is supported in\nexpressions for generated columns. The new limit for the entire table\ndefinition, including all expressions for generated columns, is 65,535 bytes.\n\n* Using constant expressions is supported in expressions for generated\ncolumns. 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 to expressions\nfor generated columns:\n\n* Non-deterministic built-in functions are not supported in expressions for\ngenerated columns.\n\n* User-defined functions (UDFs) are not supported in expressions for generated\ncolumns.\n\n* Defining a generated column based on other generated columns defined in the\ntable is not supported. Otherwise, it would generate errors like this:\n\nERROR 1900 (HY000): A computed column cannot be based on a computed column\n\n* Using an expression that exceeds 255 characters in length is not supported\nin expressions for generated columns.\n\n* Using constant expressions is not supported in expressions for generated\ncolumns. Otherwise, it would generate errors like this:\n\nERROR 1908 (HY000): Constant expression in computed column function is not\nallowed\n\nMaking Stored Values Consistent\n-------------------------------\n\nWhen a generated column is PERSISTENT or indexed, the value of the expression\nneeds to be consistent regardless of the SQL Mode flags in the current\nsession. If it is not, then the table will be seen as corrupted when the value\nthat should actually be returned by the computed expression and the value that\nwas previously stored and/or indexed using a different sql_mode setting\ndisagree.\n\nThere are currently two affected classes of inconsistencies: character padding\nand unsigned subtraction:\n\n* For a VARCHAR or TEXT generated column the length of the value returned can\nvary depending on the PAD_CHAR_TO_FULL_LENGTH sql_mode flag. To make the\nvalue consistent, create the generated column using an RTRIM() or RPAD()\nfunction. Alternately, create the generated column as a CHAR column so that\nits data is always fully padded.\n\n* If a SIGNED generated column is based on the subtraction of an UNSIGNED\nvalue, the resulting value can vary depending on how large the value is and\nthe NO_UNSIGNED_SUBTRACTION sql_mode flag. To make the value consistent, use\nCAST() to ensure that each UNSIGNED operand is SIGNED before the subtraction.\n\nMariaDB starting with 10.5\n--------------------------\nBeginning in MariaDB 10.5, there is a fatal error generated when trying to\ncreate a generated column whose value can change depending on the SQL Mode\nwhen its data is PERSISTENT or indexed.\n\nFor an existing generated column that has a potentially inconsistent value, a\nwarning about a bad expression is generated the first time it is used (if\nwarnings are enabled).\n\nBeginning in MariaDB 10.4.8, MariaDB 10.3.18, and MariaDB 10.2.27 a\npotentially inconsistent generated column outputs a warning when created or\nfirst used (without restricting their creation).\n\nHere is an example of two tables that would be rejected in MariaDB 10.5 and\nwarned about in the other listed versions:\n\nCREATE TABLE bad_pad (\n txt CHAR(5),\n -- CHAR -> VARCHAR or CHAR -> TEXT can\'t be persistent or indexed:\n vtxt VARCHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE bad_sub (\n num1 BIGINT UNSIGNED,\n num2 BIGINT UNSIGNED,\n -- The resulting value can vary for some large values\n vnum BIGINT AS (num1 - num2) VIRTUAL,\n KEY(vnum)\n);\n\nThe warnings for the above tables look like this:\n\nWarning (Code 1901): Function or expression \'`txt`\' cannot be used in the\nGENERATED ALWAYS AS clause of `vtxt`\nWarning (Code 1105): Expression depends on the @@sql_mode value\nPAD_CHAR_TO_FULL_LENGTH\n\nWarning (Code 1901): Function or expression \'`num1` - `num2`\' cannot be used\nin the GENERATED ALWAYS AS clause of `vnum`\nWarning (Code 1105): Expression depends on the @@sql_mode value\nNO_UNSIGNED_SUBTRACTION\n\nTo work around the issue, force the padding or type to make the generated\ncolumn\'s expression return a consistent value. For example:\n\nCREATE TABLE good_pad (\n txt CHAR(5),\n -- Using RTRIM() or RPAD() makes the value consistent:\n vtxt VARCHAR(5) AS (RTRIM(txt)) PERSISTENT,\n -- When not persistent or indexed, it is OK for the value to vary by mode:\n vtxt2 VARCHAR(5) AS (txt) VIRTUAL,\n -- CHAR -> CHAR is always OK:\n txt2 CHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE good_sub (\n num1 BIGINT UNSIGNED,\n num2 BIGINT UNSIGNED,\n -- The indexed value will always be consistent in this expression:\n vnum BIGINT AS (CAST(num1 AS SIGNED) - CAST(num2 AS SIGNED)) VIRTUAL,\n KEY(vnum)\n);\n\nMySQL Compatibility Support\n---------------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nIn MariaDB 10.2.1 and later, the following statements apply to MySQL','','https://mariadb.com/kb/en/generated-columns/');
-update help_topic set description = CONCAT(description, '\ncompatibility for generated columns:\n\n* The STORED keyword is supported as an alias for the PERSISTENT keyword.\n\n* Tables created with MySQL 5.7 or later that contain MySQL\'s generated\ncolumns can be imported into MariaDB without a dump and restore.\n\nMariaDB until 10.2.0\n--------------------\nIn MariaDB 10.2.0 and before, the following statements apply to MySQL\ncompatibility for generated columns:\n\n* The STORED keyword is not supported as an alias for the PERSISTENT keyword.\n\n* Tables created with MySQL 5.7 or later that contain MySQL\'s generated\ncolumns can not be imported into MariaDB without a dump and restore.\n\nImplementation Differences\n--------------------------\n\nGenerated columns are subject to various constraints in other DBMSs that are\nnot present in MariaDB\'s implementation. Generated columns may also be called\ncomputed columns or virtual columns in different implementations. The various\ndetails for a specific implementation can be found in the documentation for\neach specific DBMS.\n\nImplementation Differences Compared to Microsoft SQL Server\n-----------------------------------------------------------\n\nMariaDB\'s generated columns implementation does not enforce the following\nrestrictions that are present in Microsoft SQL Server\'s computed columns\nimplementation:\n\n* MariaDB allows server variables in generated column expressions, including\nthose that change dynamically, such as warning_count.\n* MariaDB allows the CONVERT_TZ() function to be called with a named time zone\nas an argument, even though time zone names and time offsets are configurable.\n* MariaDB allows the CAST() function to be used with non-unicode character\nsets, even though character sets are configurable and differ between\nbinaries/versions.\n* MariaDB allows FLOAT expressions to be used in generated columns. Microsoft\nSQL Server considers these expressions to be \"imprecise\" due to potential\ncross-platform differences in floating-point implementations and precision.\n* Microsoft SQL Server requires the ARITHABORT mode to be set, so that\ndivision by zero returns an error, and not a NULL.\n* Microsoft SQL Server requires QUOTED_IDENTIFIER to be set in sql_mode. In\nMariaDB, if data is inserted without ANSI_QUOTES set in sql_mode, then it will\nbe processed and stored differently in a generated column that contains quoted\nidentifiers.\n* In MariaDB 10.2.0 and before, it does not allow user-defined functions\n(UDFs) to be used in expressions for generated columns.\n\nMicrosoft SQL Server enforces the above restrictions by doing one of the\nfollowing things:\n\n* Refusing to create computed columns.\n* Refusing to allow updates to a table containing them.\n* Refusing to use an index over such a column if it can not be guaranteed that\nthe expression is fully deterministic.\n\nIn MariaDB, as long as the sql_mode, language, and other settings that were in\neffect during the CREATE TABLE remain unchanged, the generated column\nexpression will always be evaluated the same. If any of these things change,\nthen please be aware that the generated column expression might not be\nevaluated the same way as it previously was.\n\nIn MariaDB 5.2, you will get a warning if you try to update a virtual column.\nIn MariaDB 5.3 and later, this warning will be converted to an error if strict\nmode is enabled in sql_mode.\n\nDevelopment History\n-------------------\n\nGenerated columns was originally developed by Andrey Zhakov. It was then\nmodified by Sanja Byelkin and Igor Babaev at Monty Program for inclusion in\nMariaDB. Monty did the work on MariaDB 10.2 to lift a some of the old\nlimitations.\n\nExamples\n--------\n\nHere is an example table that uses both VIRTUAL and PERSISTENT 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 are virtual by\nlooking in the \"Extra\" column:\n\nDESCRIBE table1;\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 virtual column you can\nuse 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 column, you will\nreceive a warning and what you tried to insert will be ignored and the derived\nvalue inserted instead:\n\nWARNINGS;\nShow warnings enabled.\n\nINSERT INTO table1 VALUES (1, \'some text\',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 \'c\' in table\n\'table1\' has been ignored.\n\nINSERT INTO table1 VALUES (123, \'even more text\',default,\'something\');\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n\nWarning (Code 1645): The value specified for computed column \'d\' in table\n\'table1\' has been ignored.\nWarning (Code 1265): Data truncated for column \'d\' at row 1\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 directly after the\ntype definition, before the AS (<expression>):\n\nCREATE TABLE table2 (a INT, b INT ZEROFILL AS (a*2) VIRTUAL);\nINSERT INTO table2 (a) VALUES (1);\n\nSELECT * FROM table2;\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 man\'s partial index\".\nSee example at the end of Unique Index.\n\nURL: https://mariadb.com/kb/en/generated-columns/') WHERE help_topic_id = 715;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (716,38,'Invisible Columns','MariaDB starting with 10.3.3\n----------------------------\nInvisible columns (sometimes also called hidden columns) first appeared in\nMariaDB 10.3.3.\n\nColumns can be given an INVISIBLE attribute in a CREATE TABLE or ALTER TABLE\nstatement. These columns will then not be listed in the results of a SELECT *\nstatement, nor do they 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 tables or views\ncreated in this manner will have no trace of the invisible columns. If\nspecifically referenced in the SELECT statement, the columns will be brought\ninto the view/new table, but the INVISIBLE attribute will not.\n\nInvisible columns can be declared as NOT NULL, but then require a DEFAULT\nvalue.\n\nIt is not possible for all columns in a table to be invisible.\n\nExamples\n--------\n\nCREATE TABLE t (x INT INVISIBLE);\nERROR 1113 (42000): A table must have at least 1 column\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL);\nERROR 4106 (HY000): Invisible column `z` must have a default value\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL DEFAULT 4);\n\nINSERT INTO t VALUES (1),(2);\n\nINSERT INTO t (x,y) VALUES (3,33);\n\nSELECT * FROM t;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nSELECT x,y,z FROM t;\n+------+------+---+\n| x | y | z |\n+------+------+---+\n| 1 | NULL | 4 |\n| 2 | NULL | 4 |\n| 3 | 33 | 4 |\n+------+------+---+\n\nDESC t;\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 INT NOT NULL\nDEFAULT 4;\n\nDESC t;\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| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| y | int(11) | YES | | NULL | |\n| z | int(11) | NO | | 4 | |\n+-------+---------+------+-----+---------+-------+\n\nCREATE VIEW v2 AS SELECT x,y,z FROM t;\n\nDESC v2;\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\nAdding a Surrogate Primary Key:\n\ncreate table t1 (x bigint unsigned not null, y varchar(16), z text);\n\ninsert into t1 values (123, \'qq11\', \'ipsum\');\n\ninsert into t1 values (123, \'qq22\', \'lorem\');\n\nalter table t1 add pkid serial primary key invisible first;\n\ninsert into t1 values (123, \'qq33\', \'amet\');\n\nselect * from t1;\n+-----+------+-------+\n| x | y | z |\n+-----+------+-------+\n| 123 | qq11 | ipsum |\n| 123 | qq22 | lorem |\n| 123 | qq33 | amet |\n+-----+------+-------+\n\nselect pkid, z from t1;\n+------+-------+\n| pkid | z |\n+------+-------+\n| 1 | ipsum |\n| 2 | lorem |\n| 3 | amet |\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 (717,38,'DROP DATABASE','Syntax\n------\n\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDescription\n-----------\n\nDROP DATABASE drops all tables in the database and deletes the database. Be\nvery careful with this statement! To use DROP DATABASE, you need the DROP\nprivilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.\n\nImportant: When a database is dropped, user privileges on the database are not\nautomatically dropped. See GRANT.\n\nIF EXISTS\n---------\n\nUse IF EXISTS to prevent an error from occurring for databases that do not\nexist. A NOTE is generated for each non-existent database when using IF\nEXISTS. See SHOW WARNINGS.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL.\n\nDROP DATABASE is implemented as\n\nloop over all tables\n DROP TABLE table\n\nEach individual DROP TABLE is atomic while DROP DATABASE as a whole is\ncrash-safe.\n\nExamples\n--------\n\nDROP DATABASE bufg;\nQuery OK, 0 rows affected (0.39 sec)\n\nDROP DATABASE bufg;\nERROR 1008 (HY000): Can\'t drop database \'bufg\'; database doesn\'t exist\n\n\\W\nShow warnings enabled.\n\nDROP DATABASE IF EXISTS bufg;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can\'t drop database \'bufg\'; database doesn\'t exist\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 (718,38,'DROP EVENT','Syntax\n------\n\nDROP EVENT [IF EXISTS] event_name\n\nDescription\n-----------\n\nThis statement drops the event named event_name. The event immediately ceases\nbeing active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown event\n\'event_name\' results. You can override this and cause the statement to\ngenerate a NOTE for non-existent events instead by using IF EXISTS. See SHOW\nWARNINGS.\n\nThis statement requires the EVENT privilege. In MySQL 5.1.11 and earlier, an\nevent could be dropped only by its definer, or by a user having the SUPER\nprivilege.\n\nExamples\n--------\n\nDROP EVENT myevent3;\n\nUsing the IF EXISTS clause:\n\nDROP EVENT IF EXISTS myevent3;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n\nSHOW WARNINGS;\n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | Event myevent3 does not exist |\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 (719,38,'DROP FUNCTION','Syntax\n------\n\nDROP FUNCTION [IF EXISTS] f_name\n\nDescription\n-----------\n\nThe DROP FUNCTION statement is used to drop a stored function or a\nuser-defined function (UDF). That is, the specified routine is removed from\nthe server, along with all privileges specific to the function. You must have\nthe ALTER ROUTINE privilege for the routine in order to drop it. If the\nautomatic_sp_privileges server system variable is set, both the ALTER ROUTINE\nand EXECUTE privileges are granted automatically to the routine creator - see\nStored Routine Privileges.\n\nIF EXISTS\n---------\n\nThe IF EXISTS clause is a MySQL/MariaDB extension. It prevents an error from\noccurring if the function does not exist. A NOTE is produced that can be\nviewed with SHOW WARNINGS.\n\nFor dropping a user-defined functions (UDF), see DROP FUNCTION UDF.\n\nExamples\n--------\n\nDROP FUNCTION hello;\nQuery OK, 0 rows affected (0.042 sec)\n\nDROP FUNCTION hello;\nERROR 1305 (42000): FUNCTION test.hello does not exist\n\nDROP FUNCTION IF EXISTS hello;\nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1305 | FUNCTION test.hello does not exist |\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 (720,38,'DROP INDEX','Syntax\n------\n\nDROP INDEX [IF EXISTS] index_name ON tbl_name \n [WAIT n |NOWAIT]\n\nDescription\n-----------\n\nDROP INDEX drops the index named index_name from the table tbl_name. This\nstatement is mapped to an ALTER TABLE statement to drop the index.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nSee ALTER TABLE.\n\nAnother shortcut, CREATE INDEX, allows the creation of an index.\n\nTo remove the primary key, `PRIMARY` must be specified as index_name. Note\nthat the quotes are necessary, because PRIMARY is a keyword.\n\nPrivileges\n----------\n\nExecuting the DROP INDEX statement requires the INDEX privilege for the table\nor the database.\n\nOnline DDL\n----------\n\nOnline DDL is used by default with InnoDB, when the drop index operation\nsupports it.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nDROP INDEX IF EXISTS ...\n------------------------\n\nIf the IF EXISTS clause is used, then MariaDB will return a warning instead of\nan error if the index does not exist.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for DROP INDEX statement for clients that\nsupport the new progress reporting protocol. For example, if you were using\nthe mysql client, then the progress report might look like this::\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 (721,38,'DROP PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nDROP PACKAGE [IF EXISTS] [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE statement drops a stored package entirely:\n\n* Drops the package specification (earlier created using the CREATE PACKAGE\nstatement).\n* Drops the package implementation, if the implementation was already created\nusing the CREATE PACKAGE BODY statement.\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 (722,38,'DROP PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nDROP PACKAGE BODY [IF EXISTS] [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE BODY statement drops the package body (i.e the\nimplementation), previously created using the CREATE PACKAGE BODY statement.\n\nNote, DROP PACKAGE BODY drops only the package implementation, but does not\ndrop the package specification. Use DROP PACKAGE to drop the package entirely\n(i.e. both implementation and specification).\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 (723,38,'DROP PROCEDURE','Syntax\n------\n\nDROP PROCEDURE [IF EXISTS] sp_name\n\nDescription\n-----------\n\nThis statement is used to drop a stored procedure. That is, the specified\nroutine is removed from the server along with all privileges specific to the\nprocedure. You must have the ALTER ROUTINE privilege for the routine. If the\nautomatic_sp_privileges server system variable is set, that privilege and\nEXECUTE are granted automatically to the routine creator - see Stored Routine\nPrivileges.\n\nThe IF EXISTS clause is a MySQL/MariaDB extension. It prevents an error from\noccurring if the procedure or function does not exist. A NOTE is produced that\ncan be viewed with SHOW WARNINGS.\n\nWhile this statement takes effect immediately, threads which are executing a\nprocedure can continue execution.\n\nExamples\n--------\n\nDROP PROCEDURE simpleproc;\n\nIF EXISTS:\n\nDROP PROCEDURE simpleproc;\nERROR 1305 (42000): PROCEDURE test.simpleproc does not exist\n\nDROP PROCEDURE IF EXISTS simpleproc;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------+\n| Note | 1305 | PROCEDURE test.simpleproc does not exist |\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 (724,38,'DROP SERVER','Syntax\n------\n\nDROP SERVER [ IF EXISTS ] server_name\n\nDescription\n-----------\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED\nADMIN privilege.\n\nDropping a server for a table does not affect any FederatedX, FEDERATED,\nConnect or Spider tables that used this connection information when they were\ncreated.\n\nDROP SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will not return an error if the\nserver does not exist. Unlike all other statements, DROP SERVER IF EXISTS does\nnot issue a note if the server does not exist. See MDEV-9400.\n\nExamples\n--------\n\nDROP SERVER s;\n\nIF EXISTS:\n\nDROP SERVER s;\nERROR 1477 (HY000): The foreign server name you are trying to reference \n does not exist. Data source error: s\n\nDROP SERVER IF EXISTS s;\nQuery OK, 0 rows affected (0.00 sec)\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 (725,38,'DROP TABLESPACE','The DROP TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (726,38,'DROP TRIGGER','Syntax\n------\n\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nDescription\n-----------\n\nThis statement drops a trigger. The schema (database) name is optional. If the\nschema is omitted, the trigger is dropped from the default schema. Its use\nrequires the TRIGGER privilege for the table associated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that does not\nexist. A NOTE is generated for a non-existent trigger when using IF EXISTS.\nSee SHOW WARNINGS.\n\nNote: Triggers for a table are also dropped if you drop the table.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and DROP TRIGGER is atomic.\n\nExamples\n--------\n\nDROP TRIGGER test.example_trigger;\n\nUsing the IF EXISTS clause:\n\nDROP TRIGGER IF EXISTS test.example_trigger;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1360 | Trigger does not exist |\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 (727,38,'DROP VIEW','Syntax\n------\n\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP VIEW removes one or more views. You must have the DROP privilege for each\nview. If any of the views named in the argument list do not exist, MariaDB\nreturns an error indicating by name which non-existing views it was unable to\ndrop, but it also drops all of the views in the list that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that don\'t\nexist. When this clause is given, a NOTE is generated for each 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. This is useful to\ndelete views from multiple databases with one statement. See Identifier\nQualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For\ntemporary tables, no privilege is required, because such tables are only\nvisible for the current session.\n\nIf a view references another view, it will be possible to drop the referenced\nview. However, the other view will reference a view which does not exist any\nmore. Thus, querying it will produce an error similar to the following:\n\nERROR 1356 (HY000): View \'db_name.view_name\' references invalid table(s) or \ncolumn(s) or function(s) or definer/invoker of view lack rights 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 existing view,\nbecause CREATE VIEW has an OR REPLACE clause.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and DROP VIEW for a singular view is\natomic. Dropping multiple views is crash-safe.\n\nExamples\n--------\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\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 (728,38,'CONSTRAINT','MariaDB supports the implementation of constraints at the table-level using\neither CREATE TABLE or ALTER TABLE statements. A table constraint restricts\nthe data you can add to the table. If you attempt to insert invalid data on a\ncolumn, MariaDB throws an error.\n\nSyntax\n------\n\n[CONSTRAINT [symbol]] constraint_expression\n\nconstraint_expression:\n | PRIMARY KEY [index_type] (index_col_name, ...) [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-----------\n\nConstraints provide restrictions on the data you can add to a table. This\nallows you to enforce data integrity from MariaDB, rather than through\napplication logic. When a statement violates a constraint, MariaDB throws an\nerror.\n\nThere are four types of table constraints:\n\n+------------------------------------+---------------------------------------+\n| Constraint | Description |\n+------------------------------------+---------------------------------------+\n| PRIMARY KEY | Sets the column for referencing |\n| | rows. Values must be unique and not |\n| | null. |\n+------------------------------------+---------------------------------------+\n| FOREIGN KEY | Sets the column to reference the |\n| | primary key on another table. |\n+------------------------------------+---------------------------------------+\n| UNIQUE | Requires values in column or columns |\n| | only occur once in the table. |\n+------------------------------------+---------------------------------------+\n| CHECK | Checks whether the data meets the |\n| | given condition. |\n+------------------------------------+---------------------------------------+\n\nThe Information Schema TABLE_CONSTRAINTS Table contains information about\ntables that have constraints.\n\nFOREIGN KEY Constraints\n-----------------------\n\nInnoDB supports foreign key constraints. The syntax for a foreign 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\nThe Information Schema REFERENTIAL_CONSTRAINTS table has more information\nabout foreign keys.\n\nCHECK Constraints\n-----------------\n\nMariaDB starting with 10.2.1\n----------------------------\nFrom MariaDB 10.2.1, constraints are enforced. Before MariaDB 10.2.1\nconstraint expressions were accepted in the syntax but ignored.\n\nIn MariaDB 10.2.1 you can define constraints in 2 different ways:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraint expression returns false, then the\nrow will not be inserted or updated. One can use most deterministic functions\nin a constraint, including UDFs.\n\nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2), CONSTRAINT a_greater\nCHECK (a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get an automatically generated name. This is done so that\nyou can later delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the\ncheck_constraint_checks variable to OFF. This is useful for example when\nloading a table that violates some constraints that you want to later find and\nfix in SQL.\n\nReplication\n-----------\n\nIn row-based replication, only the master checks constraints, and failed\nstatements will not be replicated. In statement-based replication, the slaves\nwill also check constraints. Constraints should therefore be identical, as\nwell as deterministic, in a replication environment.\n\nAuto_increment\n--------------\n\nMariaDB starting with 10.2.6\n----------------------------\n* From MariaDB 10.2.6, auto_increment columns are no longer permitted in check\nconstraints. Previously they were permitted, but would not work correctly. See\nMDEV-11117.\n\nExamples\n--------\n\nCREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n\nMariaDB starting with 10.2.1\n----------------------------\nThe following examples will work from MariaDB 10.2.1 onwards.\n\nNumeric constraints and comparisons:\n\nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2), CONSTRAINT a_greater\nCHECK (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 `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 (CHAR_LENGTH(name)>2), start_date\nDATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL OR\nstart_date<end_date));\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', \'2003-12-15\',\n\'2014-11-09\');\nQuery OK, 1 row affected (0.04 sec)\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Io\', \'2003-12-15\',\n\'2014-11-09\');\nERROR 4022 (23000): CONSTRAINT `name` failed for `test`.`t2`\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', NULL, \'2014-11-09\');\nQuery OK, 1 row affected (0.04 sec)\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', \'2015-12-15\',\n\'2014-11-09\');\nERROR 4022 (23000): CONSTRAINT `end_date` failed for `test`.`t2`\n\nA misplaced parenthesis:\n\nCREATE TABLE t3 (name VARCHAR(30) CHECK (CHAR_LENGTH(name>2)), start_date\nDATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL OR\nstart_date<end_date));\nQuery OK, 0 rows affected (0.32 sec)\n\nINSERT INTO t3(name, start_date, end_date) VALUES(\'Io\', \'2003-12-15\',\n\'2014-11-09\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'Io\' |\n+---------+------+----------------------------------------+\n\nCompare the definition of table t2 to table t3. CHAR_LENGTH(name)>2 is very\ndifferent to CHAR_LENGTH(name>2) as the latter mistakenly performs a numeric\ncomparison on the name field, leading to unexpected results.\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 (729,38,'Dynamic Columns','Dynamic columns allow one to store different sets of columns for each row in a\ntable. It works by storing a set of columns in a blob and having a small set\nof functions to manipulate it. Dynamic columns should be used when it is not\npossible to use regular columns. A typical use case is when one needs to store\nitems that may have many different attributes (like size, color, weight, etc),\nand the set of possible attributes is very large and/or unknown in advance. In\nthat case, attributes can be put into dynamic columns.\n\nDynamic Columns Basics\n----------------------\n\nThe table should have a blob column which will be used as storage for dynamic\ncolumns:\n\ncreate table assets (\n item_name varchar(32) primary key, -- A common attribute for all items\n dynamic_cols blob -- Dynamic columns will be stored here\n);\n\nOnce created, one can access dynamic columns via dynamic column functions:\n\nInsert a row with two dynamic columns: color=blue, size=XL\n\nINSERT INTO assets VALUES \n (\'MariaDB T-shirt\', COLUMN_CREATE(\'color\', \'blue\', \'size\', \'XL\'));\n\nInsert another row with dynamic columns: color=black, price=500\n\nINSERT INTO assets VALUES\n (\'Thinkpad Laptop\', COLUMN_CREATE(\'color\', \'black\', \'price\', 500));\n\nSelect dynamic column \'color\' for all items:\n\nSELECT item_name, COLUMN_GET(dynamic_cols, \'color\' as char) \n AS color FROM assets;\n+-----------------+-------+\n| item_name | color |\n+-----------------+-------+\n| MariaDB T-shirt | blue |\n| Thinkpad Laptop | black |\n+-----------------+-------+\n\nIt is possible to add and remove dynamic columns from a row:\n\n-- Remove a column:\nUPDATE assets SET dynamic_cols=COLUMN_DELETE(dynamic_cols, \"price\") \nWHERE COLUMN_GET(dynamic_cols, \'color\' as char)=\'black\';\n\n-- Add a column:\nUPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, \'warranty\', \'3 years\')\nWHERE item_name=\'Thinkpad Laptop\';\n\nYou can also list all columns, or get them together with their values in JSON\nformat:\n\nSELECT item_name, column_list(dynamic_cols) FROM assets;\n+-----------------+---------------------------+\n| item_name | column_list(dynamic_cols) |\n+-----------------+---------------------------+\n| MariaDB T-shirt | `size`,`color` |\n| Thinkpad Laptop | `color`,`warranty` |\n+-----------------+---------------------------+\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 years\"} |\n+-----------------+----------------------------------------+\n\nDynamic Columns Reference\n-------------------------\n\nThe rest of this page is a complete reference of dynamic columns in MariaDB\n\nDynamic Columns Functions\n-------------------------\n\nCOLUMN_CREATE\n-------------\n\nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value \n [as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name, value \n [as type]]...);\n\nReturn a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n* \nstoring in a table\nfurther modification with other dynamic columns functions\n\nThe as type part allows one to specify the value type. In most cases, this is\nredundant because MariaDB will be able to deduce the type of the value.\nExplicit type specification may be needed when the type of the value is not\napparent. For example, a literal \'2012-12-01\' has a CHAR type by default, one\nwill need to specify \'2012-12-01\' AS DATE to have it stored as a date. See the\nDatatypes section for further details. Note also MDEV-597.\n\nTypical usage:\n\n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column id*/, \"value\");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\n\nCOLUMN_ADD\n----------\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\nAdds or updates dynamic columns.\n\n* \ndyncol_blob must be either a valid dynamic columns blob (for example,\nCOLUMN_CREATE returns such blob), or an empty string.\ncolumn_name specifies the name of the column to be added. If dyncol_blob\nalready has a column with this name, it will be overwritten.\nvalue specifies the new value for the column. Passing a NULL value will cause\nthe column to be deleted.\nas type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nTypical usage:\n\n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1 /*column id*/, \"value\") \n WHERE id=1;\n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, \"column_name\", \"value\") \n WHERE id=1;\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order\nto update the value in the table you have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\n\nCOLUMN_GET\n----------\n\nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n\nGet the value of a dynamic column by its name. If no column with the given\nname exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic\ncolumn they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype\nthey\'re retrieving? Can\'t the dynamic columns system figure the datatype from\nthe data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs\nto know the datatypes of all expressions before the query is run (for example,\nwhen one is using prepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the client about the\ndatatype of the column being read before the query is executed and the server\ncan see what datatype the column actually has).\n\nSee the Datatypes section for more information about datatypes.\n\nCOLUMN_DELETE\n-------------\n\nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n\nDelete a dynamic column with the specified name. Multiple names can be given.\n\nThe return value is a dynamic column blob after the modification.\n\nCOLUMN_EXISTS\n-------------\n\nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n\nCheck if a column with name column_name exists in dyncol_blob. If yes, return\n1, otherwise return 0.\n\nCOLUMN_LIST\n-----------\n\nCOLUMN_LIST(dyncol_blob);\n\nReturn a comma-separated list of column names. The names are quoted with\nbackticks.\n\nSELECT column_list(column_create(\'col1\',\'val1\',\'col2\',\'val2\'));\n+---------------------------------------------------------+\n| column_list(column_create(\'col1\',\'val1\',\'col2\',\'val2\')) |\n+---------------------------------------------------------+\n| `col1`,`col2` |\n+---------------------------------------------------------+\n\nCOLUMN_CHECK\n------------\n\nCOLUMN_CHECK(dyncol_blob);\n\nCheck if dyncol_blob is a valid packed dynamic columns blob. Return value of 1\nmeans the blob is valid, return value of 0 means it is not.\n\nRationale: Normally, one works with valid dynamic column blobs. Functions like\nCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column\nblobs. However, if a dynamic column blob is accidentally truncated, or\ntranscoded from one character set to another, it will be corrupted. This\nfunction can be used to check if a value in a blob field is a valid dynamic\ncolumn blob.\n\nNote: It is possible that a truncation cut a Dynamic Column \"clearly\" so that\nCOLUMN_CHECK will not notice the corruption, but in any case of truncation a\nwarning is issued during value storing.\n\nCOLUMN_JSON\n-----------\n\nCOLUMN_JSON(dyncol_blob);\n\nReturn a JSON representation of data in dyncol_blob.\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 years\"} |\n+-----------------+----------------------------------------+\n\nLimitation: COLUMN_JSON will decode nested dynamic columns at a nesting level\nof not more than 10 levels deep. Dynamic columns that are nested deeper than\n10 levels will be shown as BINARY string, without encoding.\n\nNesting Dynamic Columns\n-----------------------\n\nIt is possible to use nested dynamic columns by putting one dynamic column\nblob inside another. The COLUMN_JSON function will display nested columns.\n\nSET @tmp= column_create(\'parent_column\', \n column_create(\'child_column\', 12345));\nQuery OK, 0 rows affected (0.00 sec)\n\nSELECT column_json(@tmp);\n+------------------------------------------+\n| column_json(@tmp) |\n+------------------------------------------+\n| {\"parent_column\":{\"child_column\":12345}} |\n+------------------------------------------+\n\nSELECT column_get(column_get(@tmp, \'parent_column\' AS char), \n \'child_column\' AS int);\n+------------------------------------------------------------------------------\n\n| column_get(column_get(@tmp, \'parent_column\' as char), \'child_column\' as int)\n|\n+------------------------------------------------------------------------------\n\n| 12345\n|\n+------------------------------------------------------------------------------\n\nIf you are trying to get a nested dynamic column as a string use \'as BINARY\'\nas the last argument of COLUMN_GET (otherwise problems with character set\nconversion and illegal symbols are possible):\n\nselect column_json( column_get(\n column_create(\'test1\',\n column_create(\'key1\',\'value1\',\'key2\',\'value2\',\'key3\',\'value3\')),\n \'test1\' as BINARY));\n\nDatatypes\n---------\n\nIn SQL, one needs to define the type of each column in a table. Dynamic\ncolumns do not provide any way to declare a type in advance (\"whenever there\nis a column \'weight\', it should be integer\" is not possible). However, each\nparticular dynamic column value is stored together with its datatype.\n\nThe set of possible datatypes is mostly the same as that used by the SQL CAST\nand CONVERT functions. However, note that there are currently some differences\n- see MDEV-597.\n\n+--------+----------------------------------------------+-------------------+\n| type | dynamic column internal type | description |\n+--------+----------------------------------------------+-------------------+\n| BINARY | DYN_COL_STRING | (variable length |\n| (N)] | | string with |\n| | | binary charset) |\n+--------+----------------------------------------------+-------------------+\n| CHAR[( | DYN_COL_STRING | (variable length |\n| )] | | string with |\n| | | charset) |\n+--------+----------------------------------------------+-------------------+\n| DATE | DYN_COL_DATE | (date - 3 bytes) |\n+--------+----------------------------------------------+-------------------+\n| DATETI | DYN_COL_DATETIME | (date and time |\n| E[(D)] | | (with |\n| | | microseconds) - |\n| | | 9 bytes) |\n+--------+----------------------------------------------+-------------------+\n| DECIMA | DYN_COL_DECIMAL | (variable length |\n| [(M[,D | | binary decimal |\n| )] | | representation |\n| | | with MariaDB |\n| | | limitation) |\n+--------+----------------------------------------------+-------------------+\n| DOUBLE | DYN_COL_DOUBLE | (64 bit |\n| (M,D)] | | double-precision |\n| | | floating point) |\n+--------+----------------------------------------------+-------------------+\n| INTEGE | DYN_COL_INT | (variable |\n| | | length, up to 64 |\n| | | bit signed |\n| | | integer) |\n+--------+----------------------------------------------+-------------------+\n| SIGNED | DYN_COL_INT | (variable |\n| [INTEG | | length, up to 64 |\n| R] | | bit signed |\n| | | integer) |\n+--------+----------------------------------------------+-------------------+\n| TIME[( | DYN_COL_TIME | (time (with |\n| )] | | microseconds, |\n| | | may be negative) |\n| | | - 6 bytes) |\n+--------+----------------------------------------------+-------------------+\n| UNSIGN | DYN_COL_UINT | (variable |\n| D | | length, up to |','','https://mariadb.com/kb/en/dynamic-columns/');
-update help_topic set description = CONCAT(description, '\n| [INTEG | | 64bit unsigned |\n| R] | | integer) |\n+--------+----------------------------------------------+-------------------+\n\nA Note About Lengths\n--------------------\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#, not as CHAR(n)),\nMariaDB will report the maximum length of the resultset column to be\n53,6870,911 (bytes or characters?) for MariaDB 5.3-10.0.0 and 16,777,216 for\nMariaDB 10.0.1+. This may cause excessive memory usage in some client\nlibraries, because they try to pre-allocate a buffer of maximum resultset\nwidth. If you suspect you\'re hitting this problem, use CHAR(n) whenever you\'re\nusing COLUMN_GET in the select list.\n\nMariaDB 5.3 vs MariaDB 10.0\n---------------------------\n\nThe dynamic columns feature was introduced into MariaDB in two steps:\n\n* MariaDB 5.3 was the first version to support dynamic columns. Only numbers\n could be used as column names in this version.\n* In MariaDB 10.0.1, column names can be either numbers or strings.\n Also, the COLUMN_JSON and COLUMN_CHECK functions were added.\n\nSee also Dynamic Columns in MariaDB 10.\n\nClient-side API\n---------------\n\nIt is also possible to create or parse dynamic columns blobs on the client\nside. libmysql client library now includes an API for writing/reading dynamic\ncolumn blobs. See dynamic-columns-api for details.\n\nLimitations\n-----------\n\n+---------------------------------------------------+------------------------+\n| Description | Limit |\n+---------------------------------------------------+------------------------+\n| Max number of columns | 65535 |\n+---------------------------------------------------+------------------------+\n| Max total length of packed dynamic column | max_allowed_packet |\n| | (1G) |\n+---------------------------------------------------+------------------------+\n\nURL: https://mariadb.com/kb/en/dynamic-columns/') WHERE help_topic_id = 729;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (730,38,'Dynamic Columns from MariaDB 10','MariaDB starting with 10.0.1\n----------------------------\nMariaDB 10.0.1 introduced the following improvements to the dynamic columns\nfeature.\n\nColumn Name Support\n-------------------\n\nIt is possible to refer to column by names. Names can be used everywhere where\nin MariaDB 5.3 one could use only strings:\n\n* Create a dynamic column blob:\n\nCOLUMN_CREATE(\'int_col\', 123 as int, \'double_col\', 3.14 as double,\n\'string_col\', \'text-data\' as char);\n\n* Set a column value:\n\nCOLUMN_ADD(dyncol_blob, \'intcol\', 1234);\n\n* Get a column value:\n\nCOLUMN_GET(dynstr, \'column1\' as char(10));\n\n* Check whether a column exists\n\nCOLUMN_EXISTS(dyncol_blob, \'column_name\');\n\nChanges in Behavior\n-------------------\n\n* Column list output now includes quoting:\n\nselect column_list(column_create(1, 22, 2, 23));\n+------------------------------------------+\n| column_list(column_create(1, 22, 2, 23)) |\n+------------------------------------------+\n| `1`,`2` |\n+------------------------------------------+\nselect column_list(column_create(\'column1\', 22, \'column2\', 23)); \n+----------------------------------------------------------+\n| column_list(column_create(\'column1\', 22, \'column2\', 23)) |\n+----------------------------------------------------------+\n| `column1`,`column2` |\n+----------------------------------------------------------+\n\n* Column name interpretation has been changed so that the string now is not\nconverted to a number. So some \"magic\" tricks will not work any more, for\nexample, \"1test\" and \"1\" now become different column names:\n\nselect column_list(column_add(column_create(\'1a\', 22), \'1b\', 23));\n+------------------------------------------------------------+\n| column_list(column_add(column_create(\'1a\', 22), \'1b\', 23)) |\n+------------------------------------------------------------+\n| `1a`,`1b` |\n+------------------------------------------------------------+\n\n* Old behavior:\n\nselect column_list(column_add(column_create(\'1a\', 22), \'1b\', 23));\n+------------------------------------------------------------+\n| column_list(column_add(column_create(\'1a\', 22), \'1b\', 23)) |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n\nNew Functions\n-------------\n\nThe following new functions have been added to dynamic columns in MariaDB 10\n\nCOLUMN_CHECK\n------------\n\nCOLUMN_CHECK is used to check a column\'s integrity. When it encounters an\nerror it does not return illegal format errors but returns false instead. It\nalso checks integrity more thoroughly and finds errors in the dynamic column\ninternal structures which might not be found by other functions.\n\nselect column_check(column_create(\'column1\', 22));\n+--------------------------------------------+\n| column_check(column_create(\'column1\', 22)) |\n+--------------------------------------------+\n| 1 |\n+--------------------------------------------+\nselect column_check(\'abracadabra\');\n+-----------------------------+\n| column_check(\'abracadabra\') |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n\nCOLUMN_JSON\n-----------\n\nCOLUMN_JSON converts all dynamic column record content to a JSON object.\n\nselect column_json(column_create(\'column1\', 1, \'column2\', \"two\"));\n+------------------------------------------------------------+\n| column_json(column_create(\'column1\', 1, \'column2\', \"two\")) |\n+------------------------------------------------------------+\n| {\"column1\":1,\"column2\":\"two\"} |\n+------------------------------------------------------------+\n\nOther Changes\n-------------\n\n* All API functions has prefix mariadb_dyncol_ (old prefix dynamic_column_ is\ndepricated\n* API changed to be able to work with the new format (*_named functions).\n* Removed \'delete\' function because deleting could be done by adding NULL\nvalue.\n* \'Time\' and \'datetime\' in the new format are stored without microseconds if\nthey are 0.\n* New function added to API (except that two which are representing SQL level\nfunctions):\n\'Unpack\' the dynamic columns content to an arrays of values and names.\n3 functions to get any column value as string, integer (long long) or floating\npoint (double).\n\n* New type of \"dynamic column\" row added on the API level (in SQL level output\nit is a string but if you use dynamic column functions to construct object it\nwill be added as dynamic column value) which allow to add dynamic columns\ninside dynamic columns. JSON function represent such recursive constructions\ncorrectly but limit depth of representation as current implementation limit\n(internally depth of dynamic columns embedding is not limited).\n\nInterface with Cassandra\n------------------------\n\nCassandraSE is no longer actively being developed and has been removed in\nMariaDB 10.6. See MDEV-23024.\n\nSome internal changes were added to dynamic columns to allow them to serve as\nan interface to Apache Cassandra dynamic columns. The Cassandra engine may\npack all columns which were not mentioned in the MariaDB interface table\ndefinition and even bring changes in the dynamic column contents back to the\ncassandra columns family (the table analog in cassandra).\n\nURL: https://mariadb.com/kb/en/dynamic-columns-from-mariadb-10/','','https://mariadb.com/kb/en/dynamic-columns-from-mariadb-10/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (731,38,'MERGE','Description\n-----------\n\nThe MERGE storage engine, also known as the MRG_MyISAM engine, is a collection\nof identical MyISAM tables that can be used as one. \"Identical\" means that all\ntables have identical column and index information. You cannot merge MyISAM\ntables in which the columns are listed in a different order, do not have\nexactly the same columns, or have the indexes in different order. However, any\nor all of the MyISAM tables can be compressed with myisampack. Columns names\nand indexes names can be different, as long as data types and NULL/NOT NULL\nclauses are the same. Differences in table options such as AVG_ROW_LENGTH,\nMAX_ROWS, or PACK_KEYS do not matter.\n\nEach index in a MERGE table must match an index in underlying MyISAM tables,\nbut the opposite is not true. Also, a MERGE table cannot have a PRIMARY KEY or\nUNIQUE indexes, because it cannot enforce uniqueness over all underlying\ntables.\n\nThe following options are meaningful for MERGE tables:\n\n* UNION. This option specifies the list of the underlying MyISAM tables. The\nlist is enclosed between parentheses and separated with commas.\n* INSERT_METHOD. This options specifies whether, and how, INSERTs are allowed\nfor the table. Allowed values are: NO (INSERTs are not allowed), FIRST (new\nrows will be written into the first table specified in the UNION list), LAST\n(new rows will be written into the last table specified in the UNION list).\nThe default value is NO.\n\nIf you define a MERGE table with a definition which is different from the\nunderlying MyISAM tables, or one of the underlying tables is not MyISAM, the\nCREATE TABLE statement will not return any error. But any statement which\ninvolves the table will produce an error like the following:\n\nERROR 1168 (HY000): Unable to open underlying table which is differently\ndefined \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, but an underlying\ntable\'s definition changes at some point in time.\n\nIf you try to insert a new row into a MERGE table with INSERT_METHOD=NO, you\nwill 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 have one or more\nvirtual columns. MERGE itself does not support virtual columns, thus such\ncolumns will be seen as regular columns. The data types and sizes will still\nneed to be identical, and they cannot be NOT NULL.\n\nExamples\n--------\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 (\'Testing\'),(\'table\'),(\'t1\');\n\nINSERT INTO t2 (message) VALUES (\'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| 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, and then a MERGE\ntable on them. However, one of them uses a different data type for the column\nb, so a SELECT will produce 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;\nERROR 1168 (HY000): Unable to open underlying table which is differently\ndefined\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\\G\n*************************** 1. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: Error\nMsg_text: Table \'test.t3\' is differently defined or of non-MyISAM type or\ndoesn\'t exist\n*************************** 2. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: Error\nMsg_text: Unable to open underlying table which is differently defined or of\nnon-MyISAM type or doesn\'t exist\n*************************** 3. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: error\nMsg_text: Corrupt\n\nNow, we know that the problem is in t3\'s definition.\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 (732,39,'Sequence Overview','MariaDB starting with 10.3\n--------------------------\nSequences were introduced in MariaDB 10.3.\n\nIntroduction\n------------\n\nA sequence is an object that generates a sequence of numeric values, as\nspecified by the CREATE SEQUENCE statement.\n\nCREATE SEQUENCE will create a sequence that generates new values when called\nwith NEXT VALUE FOR sequence_name. It\'s an alternative to AUTO INCREMENT when\none wants to have more control of how the numbers are generated. As the\nSEQUENCE caches values (up to the CACHE value in the CREATE SEQUENCE\nstatement, by default 1000) it can in some cases be much faster than AUTO\nINCREMENT. Another benefit is that one can access the last value generated by\nall used sequences, which solves one of the limitations with LAST_INSERT_ID().\n\nCreating a Sequence\n-------------------\n\nThe CREATE SEQUENCE statement is used to create a sequence. Here is an example\nof a sequence starting at 100, incrementing by 10 each time:\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nThe CREATE SEQUENCE statement, along with defaults, can be viewd with the SHOW\nCREATE SEQUENCE STATEMENT, for example:\n\nSHOW CREATE SEQUENCE s\\G\n*************************** 1. row ***************************\n Table: s\nCreate Table: CREATE SEQUENCE `s` start with 100 minvalue 1 maxvalue\n9223372036854775806 \n increment by 10 cache 1000 nocycle ENGINE=InnoDB\n\nUsing Sequence Objects\n----------------------\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 from 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--------------------------\n\nMariaDB starting with 10.3.3\n----------------------------\nStarting from 10.3.3 you can use Sequences in DEFAULT:\n\ncreate sequence s1;\ncreate table t1 (a int primary key default (next value for s1), b int);\ninsert into t1 (b) values (1),(2);\nselect * from t1;\n+---+------+\n| a | b |\n+---+------+\n| 1 | 1 |\n| 2 | 2 |\n+---+------+\n\nChanging a Sequence\n-------------------\n\nThe ALTER SEQUENCE statement is used for changing sequences. For example, to\nrestart 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 to be returned for\na 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. Attempting to set a\nlower value will fail, returning NULL:\n\nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n\nDropping a Sequence\n-------------------\n\nThe DROP SEQUENCE statement is used to drop a sequence, for example:\n\nDROP SEQUENCE s;\n\nReplication\n-----------\n\nIf one wants to use Sequences in a master-master setup or with Galera one\nshould use INCREMENT=0. This will tell the Sequence to use\nauto_increment_increment and auto_increment_offset to generate unique values\nfor each server.\n\nStandards Compliance\n--------------------\n\nMariaDB 10.3 supports both ANSI SQL and Oracle syntax for sequences.\n\nHowever as SEQUENCE is implemented as a special kind of table, it uses the\nsame namespace as tables. The benefits are that sequences show up in SHOW\nTABLES, and one can also create a sequence with CREATE TABLE and drop it with\nDROP TABLE. One can SELECT from it as from any other table. This ensures that\nall old tools that work with tables should work with sequences.\n\nSince sequence objects act as regular tables in many contexts, they will be\naffected by LOCK TABLES. This is not the case in other DBMS, such as Oracle,\nwhere LOCK TABLE does not affect sequences.\n\nNotes\n-----\n\nOne of the goals with the Sequence implementation is that all old tools, such\nas mysqldump, should work unchanged, while still keeping the normal usage of\nsequence standard compatibly.\n\nTo make this possible, sequence is currently implemented as a table with a few\nexclusive properties.\n\nThe special properties for sequence tables are:\n\n* A sequence table has always one row.\n* When one creates a sequence, either with CREATE TABLE or CREATE SEQUENCE,\none row will be inserted.\n* If one tries to insert into a sequence table, the single row will be\nupdated. This allows mysqldump to work but also gives the additional benefit\nthat one can change all properties of a sequence with a single insert. New\napplications should of course also use ALTER SEQUENCE.\n* UPDATE or DELETE can\'t be performed on Sequence objects.\n* Doing a select on the sequence shows the current state of the sequence,\nexcept the values that are reserved in the cache. The next_value column shows\nthe next value not reserved by the cache.\n* FLUSH TABLES will close the sequence and the next sequence number generated\nwill be according to what\'s stored in the Sequence object. In effect, this\nwill discard the cached values.\n* A number of normal table operations work on Sequence tables. See next\nsection.\n\nTable Operations that Work with Sequences\n-----------------------------------------\n\n* SHOW CREATE TABLE sequence_name. This shows the table structure that is\nbehind the SEQUENCE including the field names that can be used with SELECT or\neven CREATE TABLE.\n* CREATE TABLE sequence-structure ... SEQUENCE=1\n* ALTER TABLE sequence RENAME TO sequence2\n* RENAME TABLE sequence_name TO new_sequence_name\n* DROP TABLE sequence_name. This is allowed mainly to get old tools like\nmysqldump to work with sequence tables.\n* SHOW TABLES\n\nImplementation\n--------------\n\nInternally, sequence tables are created as a normal table without rollback\n(the InnoDB, Aria and MySAM engines support this), wrapped by a sequence\nengine object. This allowed us to create sequences with almost no performance\nimpact for normal tables. (The cost is one \'if\' per insert if the binary log\nis enabled).\n\nUnderlying Table Structure\n--------------------------\n\nThe following example shows the table structure of sequences and how it can be\nused as a table. (Output of results are slightly edited to make them easier to\nread)\n\ncreate sequence t1;\nshow create sequence t1\\G\n*************************** 1. row ***************************\n CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806\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 when sequences is\ncreated or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, 1 if the sequence should begin a new cycle when maximum_value is\npassed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have 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\n\nThe cycle_count column is incremented every time the sequence wraps around.\n\nCredits\n-------\n\n* Thanks to Jianwe Zhao from Aliyun for his work on SEQUENCE in AliSQL, which\ngave ideas and inspiration for this work.\n* Thanks to Peter Gulutzan,who helped test and gave useful comments about the\nimplementation.\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 (733,39,'CREATE SEQUENCE','MariaDB starting with 10.3\n--------------------------\nCREATE SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS] sequence_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]\nThe options for CREATE SEQUENCE can be given in any order, optionally followed\nby table_options.\n\ntable_options can be any of the normal table options in CREATE TABLE but the\nmost usable ones are ENGINE=... and COMMENT=.\n\nNOMAXVALUE and NOMINVALUE are there to allow one to create SEQUENCEs using the\nOracle syntax.\n\nDescription\n-----------\n\nCREATE SEQUENCE will create a sequence that generates new values when called\nwith NEXT VALUE FOR sequence_name. It\'s an alternative to AUTO INCREMENT when\none wants to have more control of how the numbers are generated. As the\nSEQUENCE caches values (up to CACHE) it can in some cases be much faster than\nAUTO INCREMENT. Another benefit is that one can access the last value\ngenerated by all used sequences, which solves one of the limitations with\nLAST_INSERT_ID().\n\nCREATE SEQUENCE requires the CREATE privilege.\n\nDROP SEQUENCE can be used to drop a sequence, and ALTER SEQUENCE to change it.\n\nArguments to Create\n-------------------\n\nThe following options may be used:\n\n+---------------+------------------------------+----------------------------+\n| Option | Default value | Description |\n+---------------+------------------------------+----------------------------+\n| INCREMENT | 1 | Increment to use for |\n| | | values. May be negative. |\n| | | Setting an increment of 0 |\n| | | causes the sequence to |\n| | | use the value of the |\n| | | auto_increment_increment |\n| | | system variable at the |\n| | | time of creation, which |\n| | | is always a positive |\n| | | number. (see MDEV-16035). |\n+---------------+------------------------------+----------------------------+\n| MINVALUE | 1 if INCREMENT > 0 and | Minimum value for the |\n| | -9223372036854775807 if | sequence |\n| | INCREMENT < 0 | |\n+---------------+------------------------------+----------------------------+\n| MAXVALUE | 9223372036854775806 if | Max value for sequence |\n| | INCREMENT > 0 and -1 if | |\n| | INCREMENT < 0 | |\n+---------------+------------------------------+----------------------------+\n| START | MINVALUE if INCREMENT > 0 | First value that the |\n| | and MAX_VALUE if INCREMENT< | sequence will generate |\n| | 0 | |\n+---------------+------------------------------+----------------------------+\n| CACHE | 1000 | Number of values that |\n| | | should be cached. 0 if no |\n| | | CACHE. The underlying |\n| | | table will be updated |\n| | | first time a new sequence |\n| | | number is generated and |\n| | | each time the cache runs |\n| | | out. |\n+---------------+------------------------------+----------------------------+\n\nIf CYCLE is used then the sequence should start again from MINVALUE after it\nhas run out of values. Default value is NOCYCLE.\n\nConstraints on Create Arguments\n-------------------------------\n\nTo be able to create a legal sequence, the following must hold:\n\n* MAXVALUE >= start\n* MAXVALUE > MINVALUE\n* START >= MINVALUE\n* MAXVALUE <= 9223372036854775806 (LONGLONG_MAX-1)\n* MINVALUE >= -9223372036854775807 (LONGLONG_MIN+1)\n\nNote that sequences can\'t generate the maximum/minimum 64 bit number because\nof the constraint of MINVALUE and MAXVALUE.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE SEQUENCE is atomic.\n\nExamples\n--------\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 with the defaults\n\nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10;\nERROR 4082 (HY000): Sequence \'test.s3\' values are conflicting\n\nThe sequence can be created by specifying workable minimum and maximum values:\n\nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10 MINVALUE=-100 MAXVALUE=1000;\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 (734,39,'ALTER SEQUENCE','MariaDB starting with 10.3.1\n----------------------------\nALTER SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\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 ] CYCLE ]\n[ RESTART [[WITH | =] restart]\n\nALTER SEQUENCE allows one to change any values for a SEQUENCE created with\nCREATE SEQUENCE.\n\nThe options for ALTER SEQUENCE can be given in any order.\n\nDescription\n-----------\n\nALTER SEQUENCE changes the parameters of an existing sequence generator. Any\nparameters not specifically set in the ALTER SEQUENCE command retain their\nprior settings.\n\nALTER SEQUENCE requires the ALTER privilege.\n\nArguments to ALTER SEQUENCE\n---------------------------\n\nThe following options may be used:\n\n+---------------+-------------------------------+---------------------------+\n| Option | Default value | Description |\n+---------------+-------------------------------+---------------------------+\n| INCREMENT | 1 | Increment to use for |\n| | | values. May be negative. |\n+---------------+-------------------------------+---------------------------+\n| MINVALUE | 1 if INCREMENT > 0 and | Minimum value for the |\n| | -9223372036854775807 if | sequence. |\n| | INCREMENT < 0 | |\n+---------------+-------------------------------+---------------------------+\n| MAXVALUE | 9223372036854775806 if | Max value for sequence. |\n| | INCREMENT > 0 and -1 if | |\n| | INCREMENT < 0 | |\n+---------------+-------------------------------+---------------------------+\n| START | MINVALUE if INCREMENT > 0 | First value that the |\n| | and MAX_VALUE if INCREMENT< 0 | sequence will generate. |\n+---------------+-------------------------------+---------------------------+\n| CACHE | 1000 | Number of values that |\n| | | should be cached. 0 if |\n| | | no CACHE. The |\n| | | underlying table will be |\n| | | updated first time a new |\n| | | sequence number is |\n| | | generated and each time |\n| | | the cache runs out. |\n+---------------+-------------------------------+---------------------------+\n| CYCLE | 0 (= NO CYCLE) | 1 if the sequence should |\n| | | start again from |\n| | | MINVALUE# after it has |\n| | | run out of values. |\n+---------------+-------------------------------+---------------------------+\n| RESTART | START if restart value not | If RESTART option is |\n| | is given | used, NEXT VALUE will |\n| | | return the restart value. |\n+---------------+-------------------------------+---------------------------+\n\nThe optional clause RESTART [ WITH restart ] sets the next value for the\nsequence. This is equivalent to calling the SETVAL() function with the is_used\nargument as 0. The specified value will be returned by the next call of\nnextval. Using RESTART with no restart value is equivalent to supplying the\nstart value that was recorded by CREATE SEQUENCE or last set by ALTER SEQUENCE\nSTART WITH.\n\nALTER SEQUENCE will not allow you to change the sequence so that it\'s\ninconsistent. For example:\n\nCREATE SEQUENCE s1;\nALTER SEQUENCE s1 MINVALUE 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 RESTART 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 START 10 RESTART 10;\n\nINSERT\n------\n\nTo allow SEQUENCE objects to be backed up by old tools, like mysqldump, one\ncan use SELECT to read the current state of a SEQUENCE object and use an\nINSERT to update the SEQUENCE object. INSERT is only allowed if all fields are\nspecified:\n\nCREATE SEQUENCE s1;\nINSERT INTO s1 VALUES(1000,10,2000,1005,1,1000,0,0);\nSELECT * FROM s1;\n\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n| next_value | min_value | max_value | start | increment | cache | cycle |\nround |\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n| 1000 | 10 | 2000 | 1005 | 1 | 1000 | 0 | \n0 |\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n\nSHOW CREATE SEQUENCE s1;\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n| Table | Create Table \n |\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n| s1 | CREATE SEQUENCE `s1` start with 1005 minvalue 10 maxvalue 2000\nincrement by 1 cache 1000 nocycle ENGINE=Aria |\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n\nNotes\n-----\n\nALTER SEQUENCE will instantly affect all future SEQUENCE operations. This is\nin contrast to some other databases where the changes requested by ALTER\nSEQUENCE will not be seen until the sequence cache has run out.\n\nALTER SEQUENCE will take a full table lock of the sequence object during its\n(brief) operation. This ensures that ALTER SEQUENCE is replicated correctly.\nIf you only want to set the next sequence value to a higher value than\ncurrent, then you should use SETVAL() instead, as this is not blocking.\n\nIf you want to change storage engine, sequence comment or rename the sequence,\nyou can use ALTER TABLE for this.\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 (735,39,'DROP SEQUENCE','MariaDB starting with 10.3\n--------------------------\nDROP SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\n\nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/*COMMENT TO SAVE*/]\n sequence_name [, sequence_name] ...\n\nDescription\n-----------\n\nDROP SEQUENCE removes one or more sequences created with CREATE SEQUENCE. You\nmust have the DROP privilege for each sequence. MariaDB returns an error\nindicating by name which non-existing tables it was unable to drop, but it\nalso drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not\nautomatically dropped. See GRANT.\n\nIf another connection is using the sequence, a metadata lock is active, and\nthis statement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nFor each referenced sequence, DROP SEQUENCE drops a temporary sequence with\nthat name, if it exists. If it does not exist, and the TEMPORARY keyword is\nnot used, it drops a non-temporary sequence with the same name, if it exists.\nThe TEMPORARY keyword ensures that a non-temporary sequence will not\naccidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for sequences that do not\nexist. A NOTE is generated for each non-existent sequence when using IF\nEXISTS. See SHOW WARNINGS.\n\nDROP SEQUENCE requires the DROP privilege.\n\nNotes\n-----\n\nDROP SEQUENCE only removes sequences, not tables. However, DROP TABLE can\nremove both sequences and tables.\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 (736,39,'NEXT VALUE for sequence_name','MariaDB starting with 10.3\n--------------------------\nSEQUENCEs were introduced in MariaDB 10.3\n\nSyntax\n------\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 PostgreSQL syntax.\n\nDescription\n-----------\n\nGenerate next value for a SEQUENCE.\n\n* You can greatly speed up NEXT VALUE by creating the sequence with the CACHE\noption. If not, every NEXT VALUE usage will cause changes in the stored\nSEQUENCE table.\n* When using NEXT VALUE the value will be reserved at once and will not be\nreused, except if the SEQUENCE was created with CYCLE. This means that when\nyou are using SEQUENCEs you have to expect gaps in the generated sequence\nnumbers.\n* If one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE ... RESTART,\nNEXT VALUE FOR will notice this and start from the next requested value.\n* FLUSH TABLES will close the sequence and the next sequence number generated\nwill be according to what\'s stored in the SEQUENCE object. In effect, this\nwill discard the cached values.\n* A server restart (or closing the current connection) also causes a drop of\nall cached values. The cached sequence numbers are reserved only for the\ncurrent connection.\n* NEXT VALUE requires the INSERT privilege.\n\nMariaDB starting with 10.3.3\n----------------------------\n* You can also use NEXT VALUE FOR sequence for column DEFAULT.\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 (737,39,'PREVIOUS VALUE FOR sequence_name','MariaDB starting with 10.3\n--------------------------\nSEQUENCEs were introduced in MariaDB 10.3.\n\nSyntax\n------\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 PostgreSQL syntax.\n\nDescription\n-----------\n\nGet last value in the current connection generated from a sequence.\n\n* If the sequence has not yet been used by the connection, PREVIOUS VALUE FOR\nreturns NULL (the same thing applies with a new connection which doesn\'t see a\nlast value for an existing sequence).\n* If a SEQUENCE has been dropped and re-created then it\'s treated as a new\nSEQUENCE and PREVIOUS VALUE FOR will return NULL.\n* FLUSH TABLES has no effect on PREVIOUS VALUE FOR.\n* Previous values for all used sequences are stored per connection until\nconnection ends.\n* PREVIOUS VALUE FOR requires the SELECT privilege.\n\nExample\n-------\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| NULL |\n+----------------------+\n\n# The function works for sequences only, if the table is used an error is\ngenerated\nSELECT PREVIOUS VALUE FOR t;\nERROR 4089 (42S02): \'test.t\' is not a SEQUENCE\n\n# Call the NEXT VALUE FOR s:\nSELECT NEXT VALUE FOR s;\n+------------------+\n| NEXT VALUE FOR s |\n+------------------+\n| 100 |\n+------------------+\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 100 |\n+----------------------+\n\nNow try to start the new connection and check that the last value is still\nNULL, before updating the value in the new connection after the output of the\nnew connection gets current value (110 in the example below). Note that first\nconnection cannot see this change and the result of last value still remains\nthe same (100 in the example above).\n\n$ .mysql -uroot test -e\"SELECT PREVIOUS VALUE FOR s; SELECT NEXT VALUE FOR s;\nSELECT PREVIOUS VALUE FOR s;\"\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| NULL |\n+----------------------+\n+------------------+\n| NEXT VALUE FOR s |\n+------------------+\n| 110 |\n+------------------+\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 110 |\n+----------------------+\n\nURL: https://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 (738,39,'SETVAL','MariaDB starting with 10.3.1\n----------------------------\nSEQUENCEs were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSETVAL(sequence_name, next_value, [is_used, [round]])\n\nDescription\n-----------\n\nSet the next value to be returned for a SEQUENCE.\n\nThis function is compatible with PostgreSQL syntax, extended with the round\nargument.\n\nIf the is_used argument is not given or is 1 or true, then the next used value\nwill one after the given value. If is_used is 0 or false then the next\ngenerated value will be the given value.\n\nIf round is used then it will set the round value (or the internal cycle\ncount, starting at zero) for the sequence. If round is not used, it\'s assumed\nto be 0.\n\nnext_value must be an integer literal.\n\nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE) one should use\nboth next_value and round to define the next value. In this case the current\nsequence value is defined to be round, next_value.\n\nThe result returned by SETVAL() is next_value or NULL if the given next_value\nand round is smaller than the current value.\n\nSETVAL() will not set the SEQUENCE value to a something that is less than its\ncurrent value. This is needed to ensure that SETVAL() is replication safe. If\nyou want to set the SEQUENCE to a smaller number use ALTER SEQUENCE.\n\nIf CYCLE is used, first round and then next_value are compared to see if the\nvalue is bigger than the current value.\n\nInternally, in the MariaDB server, SETVAL() is used to inform slaves that a\nSEQUENCE has changed value. The slave may get SETVAL() statements out of\norder, but this is ok as only the biggest one will have an effect.\n\nSETVAL requires the INSERT privilege.\n\nExamples\n--------\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 42\n\nSETVAL setting higher and lower values on a sequence with an increment 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 next_value and round is\nsmaller 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 be 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\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 (739,40,'JSON_ARRAYAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_ARRAYAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_ARRAYAGG(column_or_expression)\n\nDescription\n-----------\n\nJSON_ARRAYAGG returns a JSON array containing an element for each value in a\ngiven set of JSON or SQL values. It acts on a column or an expression that\nevaluates to a single value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_ARRAYAGG cannot currently be used as a window function.\n\nThe full syntax is as follows:\n\nJSON_ARRAYAGG([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT);\n\nINSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2,\n2);\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;\n+-------------------+-------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+-------------------+-------------------+\n| [1,2,1,2,3,2,2,2] | [1,1,1,1,2,2,2,2] |\n+-------------------+-------------------+\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;\n+------------------+------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+------------------+------------------+\n| [1,2,1,2] | [1,1,1,1] |\n| [3,2,2,2] | [2,2,2,2] |\n+------------------+------------------+\n\nURL: https://mariadb.com/kb/en/json_arrayagg/','','https://mariadb.com/kb/en/json_arrayagg/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (740,40,'JSON_OBJECTAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_OBJECTAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_OBJECTAGG(key, value)\n\nDescription\n-----------\n\nJSON_OBJECTAGG returns a JSON object containing key-value pairs. It takes two\nexpressions that evaluate to a single value, or two column names, as\narguments, the first used as a key, and the second as a value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_OBJECTAGG cannot currently be used as a window function.\n\nExamples\n--------\n\nselect * from t1;\n+------+-------+\n| a | b |\n+------+-------+\n| 1 | Hello |\n| 1 | World |\n| 2 | This |\n+------+-------+\n\nSELECT JSON_OBJECTAGG(a, b) FROM t1;\n+----------------------------------------+\n| JSON_OBJECTAGG(a, b) |\n+----------------------------------------+\n| {\"1\":\"Hello\", \"1\":\"World\", \"2\":\"This\"} |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_objectagg/','','https://mariadb.com/kb/en/json_objectagg/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (741,40,'JSONPath Expressions','A number of JSON functions accept JSON Path expressions. MariaDB defines this\npath as follows:\n\nJSON Path Syntax\n----------------\n\npath : [\'lax\'] \'$\' [step]*\n\nThe path starts with an optional path mode. At the moment, MariaDB supports\nonly the \"lax\" mode, which is also the mode that is used when it is not\nexplicitly specified.\n\nThe $ symbol represents the context item. The search always starts from the\ncontext item; because of that, the path always starts with $.\n\nThen, it is followed by zero or more steps, which select element(s) in the\nJSON document. A step may be one of the following:\n\n* Object member selector\n* Array element selector\n* Wildcard selector\n\nObject Member Selector\n----------------------\n\nTo select member(s) in a JSON object, one can use one of the following:\n\n* .memberName selects the value of the member with name memberName.\n* .\"memberName\" - the same as above but allows one to select a member with a\nname that\'s not a valid identifier (that is, has space, dot, and/or other\ncharacters)\n* .* - selects the values of all members of the object.\n\nIf the current item is an array (instead of an object), nothing will be\nselected.\n\nArray Element Selector\n----------------------\n\nTo select elements of an array, one can use one of the following:\n\n* [N] selects element number N in the array. The elements are counted from\nzero.\n* [*] selects all elements in the array.\n\nIf the current item is an object (instead of an array), nothing will be\nselected.\n\nStarting from MariaDB server 10.9, JSON path also supports negative index in\narray, \'last\' keyword and range notation (\'to\' keyword) for accessing array\nelements. Negative index starts from -1.\n\n* [-N] selects n th element from end.\n* [last-N] selects n th element from the last element.\n* [M to N] selects range of elements starting from index M to N.\n\nExample:\n\nSET @json=\'{\n \"A\": [0,\n [1, 2, 3],\n [4, 5, 6],\n \"seven\",\n 0.8,\n true,\n false,\n \"eleven\",\n [12, [13, 14], {\"key1\":\"value1\"},[15]],\n true],\n \"B\": {\"C\": 1},\n \"D\": 2\n }\';\nSELECT JSON_EXTRACT(@json, \'$.A[-8][1]\');\n+--------------------------------------------------+\n| JSON_EXTRACT(@json, \'$.A[-8][1]\') |\n+--------------------------------------------------+\n| 5 |\n+--------------------------------------------------+\n\nSELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\');\n+-----------------------------------------------+\n| SELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\'); |\n+-----------------------------------------------+\n| 5 |\n+-----------------------------------------------+\n\nSET @json= \'[\n [1, {\"key1\": \"value1\"}, 3],\n [false, 5, 6],\n [7, 8, [9, {\"key2\": 2}, 11]],\n [15, 1.34, [14], [\"string1\", [16, {\"key1\":[1,2,3,[4,5,6]]}, 18]]],\n [19, 20],\n 21, 22\n ]\';\n\nSELECT JSON_EXTRACT(@json, \'$[0 to 3][2]\');\n+-----------------------------------------------+\n| JSON_EXTRACT(@json, \'$[0 to 3][2]\') |\n+-----------------------------------------------+\n| [3, 6, [9, {\"key2\": 2}, 11], [14]] |\n+-----------------------------------------------+\n\nThis will produce output for first index of eighth from last element of a two\ndimensional array.\n\nNote: In range notation, when M > N ( when M,N are greater than or equal to 0)\nor (size of array - M or size of array - N when M, N are less than 0), then it\nis treated as an impossible range and NULL is returned.\n\nSET @json= \'[1, 2, 3, 4, 5]\';\nSELECT JSON_EXTRACT(@json, \'$[4 to 2]\');\n+-----------------------------------+\n| JSON_EXTRACT(@json, \'$[4 to 2]\') |\n+-----------------------------------+\n| NULL |\n+-----------------------------------+\n\nWildcard\n--------\n\nThe wildcard step, **, recursively selects all child elements of the current\nelement. Both array elements and object members are selected.\n\nThe wildcard step must not be the last step in the JSONPath expression. It\nmust be followed by an array or object member selector step.\n\nFor example:\n\nselect json_extract(@json_doc, \'$**.price\');\n\nwill select all object members in the document that are named price, while\n\nselect json_extract(@json_doc, \'$**[2]\');\n\nwill select the second element in each of the arrays present in the document.\n\nCompatibility\n-------------\n\nMariaDB\'s JSONPath syntax supports a subset of JSON Path\'s definition in the\nSQL Standard. The most notable things not supported are the strict mode and\nfilters.\n\nMariaDB\'s JSONPath is close to MySQL\'s JSONPath. The wildcard step ( ** ) is a\nnon-standard extension that has the same meaning as in MySQL. The differences\nbetween MariaDB and MySQL\'s JSONPath are: MySQL supports [last] and [M to N]\nas array element selectors; MySQL doesn\'t allow one to specify the mode\nexplicitly (but uses lax mode implicitly).\n\nURL: https://mariadb.com/kb/en/jsonpath-expressions/','','https://mariadb.com/kb/en/jsonpath-expressions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (742,40,'JSON_ARRAY','Syntax\n------\n\nJSON_ARRAY([value[, value2] ...])\n\nDescription\n-----------\n\nReturns a JSON array containing the listed values. The list can be empty.\n\nExample\n-------\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\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 (743,40,'JSON_ARRAY_APPEND','Syntax\n------\n\nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nAppends values to the end of the specified arrays within a JSON document,\nreturning the result, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\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\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 (744,40,'JSON_ARRAY_INSERT','Syntax\n------\n\nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nInserts a value into a JSON document, returning the modified document, or NULL\nif any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\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\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 (745,40,'JSON_COMPACT','Syntax\n------\n\nJSON_COMPACT(json_doc)\n\nDescription\n-----------\n\nRemoves all unnecessary spaces so the json document is as short as possible.\n\nExample\n-------\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\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 (746,40,'JSON_CONTAINS','Syntax\n------\n\nJSON_CONTAINS(json_doc, val[, path])\n\nDescription\n-----------\n\nReturns whether or not the specified value is found in the given JSON document\nor, optionally, at the specified path within the document. Returns 1 if it\ndoes, 0 if not and NULL if any of the arguments are null. An error occurs if\nthe document or path is not valid, or contains the * or ** wildcards.\n\nExamples\n--------\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\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 (747,40,'JSON_CONTAINS_PATH','Syntax\n------\n\nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n\nDescription\n-----------\n\nIndicates whether the given JSON document contains data at the specified path\nor paths. Returns 1 if it does, 0 if not and NULL if any of the arguments are\nnull.\n\nThe return_arg can be one or all:\n\n* one - Returns 1 if at least one path exists within the JSON document. \n* all - Returns 1 only if all paths exist within the JSON document.\n\nExamples\n--------\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\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 (748,40,'JSON_DEPTH','Syntax\n------\n\nJSON_DEPTH(json_doc)\n\nDescription\n-----------\n\nReturns the maximum depth of the given JSON document, or NULL if the argument\nis null. An error will occur if the argument is an invalid JSON document.\n\n* Scalar values or empty arrays or objects have a depth of 1.\n* Arrays or objects that are not empty but contain only elements or member\nvalues of depth 1 will have a depth of 2.\n* In other cases, the depth will be greater than 2.\n\nExamples\n--------\n\nSELECT JSON_DEPTH(\'[]\'), JSON_DEPTH(\'true\'), JSON_DEPTH(\'{}\');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(\'[]\') | JSON_DEPTH(\'true\') | JSON_DEPTH(\'{}\') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n\nSELECT JSON_DEPTH(\'[1, 2, 3]\'), JSON_DEPTH(\'[[], {}, []]\');\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\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 (749,40,'JSON_DETAILED','Syntax\n------\n\nJSON_DETAILED(json_doc[, tab_size])\n\nDescription\n-----------\n\nRepresents JSON in the most understandable way emphasizing nested structures.\n\nExample\n-------\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\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 (750,40,'JSON_EXISTS','Syntax\n------\n\nDescription\n-----------\n\nDetermines whether a specified JSON value exists in the given data. Returns 1\nif found, 0 if not, or NULL if any of the inputs were NULL.\n\nExamples\n--------\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2\") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key3\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key3\") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[1]\");\n+---------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[1]\") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[10]\");\n+----------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[10]\") |\n+----------------------------------------------------------------+\n| 0 |\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 (751,40,'JSON_EXTRACT','Syntax\n------\n\nJSON_EXTRACT(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nExtracts data from a JSON document. The extracted data is selected from the\nparts matching the path arguments. Returns all matched values; either as a\nsingle matched value, or, if the arguments could return multiple values, a\nresult autowrapped as an array in the matching order.\n\nReturns NULL if no paths match or if any of the arguments are NULL.\n\nAn error will occur if any path argument is not a valid path, or if the\njson_doc argument is not a valid JSON document.\n\nThe path expression be a JSONPath expression as supported by MariaDB\n\nExamples\n--------\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\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 (752,40,'JSON_INSERT','Syntax\n------\n\nJSON_INSERT(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nInserts data into a JSON document, returning the resulting document or NULL if\nany argument is null.\n\nAn error will occur if the JSON document is not invalid, or if any of the\npaths are invalid or contain a * or ** wildcard.\n\nJSON_INSERT can only insert data while JSON_REPLACE can only update. JSON_SET\ncan update or insert data.\n\nExamples\n--------\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\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 (753,40,'JSON_KEYS','Syntax\n------\n\nJSON_KEYS(json_doc[, path])\n\nDescription\n-----------\n\nReturns the keys as a JSON array from the top-level value of a JSON object or,\nif the optional path argument is provided, the top-level keys from the path.\n\nExcludes keys from nested sub-objects in the top level value. The resulting\narray will be empty if the selected object is empty.\n\nReturns NULL if any of the arguments are null, a given path does not locate an\nobject, or if the json_doc argument is not an object.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the\npath contains a * or ** wildcard.\n\nExamples\n--------\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\": 3}}\', \'$.C\');\n+-----------------------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\') |\n+-----------------------------------------------------+\n| [\"D\"] |\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 (754,40,'JSON_LENGTH','Syntax\n------\n\nJSON_LENGTH(json_doc[, path])\n\nDescription\n-----------\n\nReturns the length of a JSON document, or, if the optional path argument is\ngiven, the length of the value within the document specified by the path.\n\nReturns NULL if any of the arguments argument are null or the path argument\ndoes not identify a value in the document.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nLength will be determined as follow:\n\n* A scalar\'s length is always 1.\n* If an array, the number of elements in the array.\n* If an object, the number of members in the object.\n\nThe length of nested arrays or objects are not counted.\n\nExamples\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 (755,40,'JSON_LOOSE','Syntax\n------\n\nJSON_LOOSE(json_doc)\n\nDescription\n-----------\n\nAdds spaces to a JSON document to make it look more readable.\n\nExample\n-------\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\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 (756,40,'JSON_MERGE','Syntax\n------\n\nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\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 documents.\n\nJSON_MERGE has been deprecated since MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5. JSON_MERGE_PATCH is an RFC 7396-compliant replacement, and\nJSON_MERGE_PRESERVE is a synonym.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[3, 4]\';\n\nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\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 (757,40,'JSON_MERGE_PATCH','MariaDB starting with 10.2.25\n-----------------------------\nJSON_MERGE_PATCH was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5.\n\nSyntax\n------\n\nJSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PATCH is an RFC 7396-compliant replacement for JSON_MERGE, which\nhas been deprecated.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[2, 3]\';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\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 (758,40,'JSON_MERGE_PRESERVE','MariaDB starting with 10.2.25\n-----------------------------\nJSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5.\n\nSyntax\n------\n\nJSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5 as a synonym for JSON_MERGE, which has been deprecated.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[2, 3]\';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\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 (759,40,'JSON_OBJECT','Syntax\n------\n\nJSON_OBJECT([key, value[, key, value] ...])\n\nDescription\n-----------\n\nReturns a JSON object containing the given key/value pairs. The key/value list\ncan be empty.\n\nAn error will occur if there are an odd number of arguments, or any key name\nis NULL.\n\nExample\n-------\n\nSELECT JSON_OBJECT(\"id\", 1, \"name\", \"Monty\");\n+---------------------------------------+\n| JSON_OBJECT(\"id\", 1, \"name\", \"Monty\") |\n+---------------------------------------+\n| {\"id\": 1, \"name\": \"Monty\"} |\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 (760,40,'JSON_QUERY','Syntax\n------\n\nJSON_QUERY(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns an object or array specified by the path.\nReturns NULL if not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nselect json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\', \'$.key1\');\n+-----------------------------------------------------+\n| json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\', \'$.key1\') |\n+-----------------------------------------------------+\n| {\"a\":1, \"b\":[1,2]} |\n+-----------------------------------------------------+\n\nselect json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\', \'$.key1\');\n+-------------------------------------------------------+\n| json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\', \'$.key1\') |\n+-------------------------------------------------------+\n| [1,2,3] |\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 (761,40,'JSON_QUOTE','Syntax\n------\n\nJSON_QUOTE(json_value)\n\nDescription\n-----------\n\nQuotes a string as a JSON value, usually for producing valid JSON string\nliterals for inclusion in JSON documents. Wraps the string with double quote\ncharacters and escapes interior quotes and other special characters, returning\na utf8mb4 string.\n\nReturns NULL if the argument is NULL.\n\nExamples\n--------\n\nSELECT JSON_QUOTE(\'A\'), JSON_QUOTE(\"B\"), JSON_QUOTE(\'\"C\"\');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(\'A\') | JSON_QUOTE(\"B\") | JSON_QUOTE(\'\"C\"\') |\n+-----------------+-----------------+-------------------+\n| \"A\" | \"B\" | \"\\\"C\\\"\" |\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 (762,40,'JSON_REMOVE','Syntax\n------\n\nJSON_REMOVE(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nRemoves data from a JSON document returning the result, or NULL if any of the\narguments are null. If the element does not exist in the document, no changes\nare made.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the\npath contains a * or ** wildcard.\n\nPath arguments are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nExamples\n--------\n\nSELECT JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\');\n+-------------------------------------------------------+\n| JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\') |\n+-------------------------------------------------------+\n| {\"A\": 1, \"B\": 2} |\n+-------------------------------------------------------+\n\nSELECT JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\', \'$[1]\');\n+----------------------------------------------------+\n| JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\', \'$[1]\') |\n+----------------------------------------------------+\n| [\"A\", [\"C\", \"D\"], \"E\"] |\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 (763,40,'JSON_REPLACE','Syntax\n------\n\nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nReplaces existing values in a JSON document, returning the result, or NULL if\nany of the arguments are NULL.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nPaths and values are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nJSON_REPLACE can only update data, while JSON_INSERT can only insert. JSON_SET\ncan update or insert data.\n\nExamples\n--------\n\nSELECT JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\', 4) |\n+-----------------------------------------------------+\n| { \"A\": 1, \"B\": [2, 4]} |\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 (764,40,'JSON_SEARCH','Syntax\n------\n\nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[, path] ...])\n\nDescription\n-----------\n\nReturns the path to the given string within a JSON document, or NULL if any of\njson_doc, search_str or a path argument is NULL; if the search string is not\nfound, or if no path exists within the document.\n\nA warning will occur if the JSON document is not valid, any of the path\narguments are not valid, if return_arg is neither one nor all, or if the\nescape character is not a constant. NULL will be returned.\n\nreturn_arg can be one of two values:\n\n* \'one: Terminates after finding the first match, so will return one path\nstring. If there is more than one match, it is undefined which is considered\nfirst.\n* all: Returns all matching path strings, without duplicates. Multiple strings\nare autowrapped as an array. The order is undefined.\n\nExamples\n--------\n\nSET @json = \'[\"A\", [{\"B\": \"1\"}], {\"C\":\"AB\"}, {\"D\":\"BC\"}]\';\n\nSELECT JSON_SEARCH(@json, \'one\', \'AB\');\n+---------------------------------+\n| JSON_SEARCH(@json, \'one\', \'AB\') |\n+---------------------------------+\n| \"$[2].C\" |\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 (765,40,'JSON_SET','Syntax\n------\n\nJSON_SET(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nUpdates or inserts data into a JSON document, returning the result, or NULL if\nany of the arguments are NULL or the optional path fails to find an object.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or wildcard.\n\nJSON_SET can update or insert data, while JSON_REPLACE can only update, and\nJSON_INSERT only insert.\n\nExamples\n--------\n\nSELECT JSON_SET(Priv, \'$.locked\', \'true\') FROM mysql.global_priv\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 (766,40,'JSON_TABLE','MariaDB starting with 10.6.0\n----------------------------\nJSON_TABLE was added in MariaDB 10.6.0.\n\nJSON_TABLE is a table function that converts JSON data into a relational form.\n\nSyntax\n------\n\nJSON_TABLE(json_doc, \n context_path COLUMNS (column_list)\n) [AS] alias\n\ncolumn_list:\n column[, column][, ...]\n\ncolumn:\n name FOR ORDINALITY\n | name type PATH path_str [on_empty] [on_error]\n | name type EXISTS PATH path_str\n | NESTED PATH path_str COLUMNS (column_list)\n\non_empty:\n {NULL | DEFAULT string | ERROR} ON EMPTY\n\non_error:\n {NULL | DEFAULT string | ERROR} ON ERROR\n\nDescription\n-----------\n\nJSON_TABLE can be used in contexts where a table reference can be used; in the\nFROM clause of a SELECT statement, and in multi-table UPDATE/DELETE statements.\n\njson_doc is the JSON document to extract data from. In the simplest case, it\nis a string literal containing JSON. In more complex cases it can be an\narbitrary expression returning JSON. The expression may have references to\ncolumns of other tables. However, one can only refer to tables that precede\nthis JSON_TABLE invocation. For RIGHT JOIN, it is assumed that its outer side\nprecedes the inner. All tables in outer selects are also considered preceding.\n\ncontext_path is a JSON Path expression pointing to a collection of nodes in\njson_doc that will be used as the source of rows.\n\nThe COLUMNS clause declares the names and types of the columns that JSON_TABLE\nreturns, as well as how the values of the columns are produced.\n\nColumn Definitions\n------------------\n\nThe following types of columns are supported:\n\nPath Columns\n------------\n\nname type PATH path_str [on_empty] [on_error]\n\nLocates the JSON node pointed to by path_str and returns its value. The\npath_str is evaluated using the current row source node as the context node.\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\", \"price\":\"1000\"},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n color varchar(10) path \'$.color\',\n price decimal(8,2) path \'$.price\' )\n) as jt;\n+--------+-------+---------+\n| name | color | price |\n+--------+-------+---------+\n| Laptop | black | 1000.00 |\n| Jeans | blue | NULL |\n+--------+-------+---------+\n\nThe on_empty and on_error clauses specify the actions to be performed when the\nvalue was not found or there was an error condition. See the ON EMPTY and ON\nERROR clauses section for details.\n\nORDINALITY Columns\n------------------\n\nname FOR ORDINALITY\n\nCounts the rows, starting from 1.\n\nExample:\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\"},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n id for ordinality,\n name varchar(10) path \'$.name\')\n) as jt;\n+------+--------+\n| id | name |\n+------+--------+\n| 1 | Laptop |\n| 2 | Jeans |\n+------+--------+\n\nEXISTS PATH Columns\n-------------------\n\nname type EXISTS PATH path_str\n\nChecks whether the node pointed to by value_path exists. The value_path is\nevaluated using the current row source node as the context node.\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\", \"price\":1000},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n has_price integer exists path \'$.price\')\n) as jt;\n+--------+-----------+\n| name | has_price |\n+--------+-----------+\n| Laptop | 1 |\n| Jeans | 0 |\n+--------+-----------+\n\nNESTED PATHs\n------------\n\nNESTED PATH converts nested JSON structures into multiple rows.\n\nNESTED PATH path COLUMNS (column_list)\n\nIt finds the sequence of JSON nodes pointed to by path and uses it to produce\nrows. For each found node, a row is generated with column values as specified\nby the NESTED PATH\'s COLUMNS clause. If path finds no nodes, only one row is\ngenerated with all columns having NULL values.\n\nFor example, consider a JSON document that contains an array of items, and\neach item, in turn, is expected to have an array of its available sizes:\n\nset @json=\'\n[\n {\"name\":\"Jeans\", \"sizes\": [32, 34, 36]},\n {\"name\":\"T-Shirt\", \"sizes\":[\"Medium\", \"Large\"]},\n {\"name\":\"Cellphone\"}\n]\';\n\nNESTED PATH allows one to produce a separate row for each size each item has:\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n nested path \'$.sizes[*]\' columns (\n size varchar(32) path \'$\'\n )\n )\n) as jt;\n+-----------+--------+\n| name | size |\n+-----------+--------+\n| Jeans | 32 |\n| Jeans | 34 |\n| Jeans | 36 |\n| T-Shirt | Medium |\n| T-Shirt | Large |\n| Cellphone | NULL |\n+-----------+--------+\n\nNESTED PATH clauses can be nested within one another. They can also be located\nnext to each other. In that case, the nested path clauses will produce records\none at a time. The ones that are not producing records will have all columns\nset to NULL.\n\nExample:\n\nset @json=\'\n[\n {\"name\":\"Jeans\", \"sizes\": [32, 34, 36], \"colors\":[\"black\", \"blue\"]}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n nested path \'$.sizes[*]\' columns (\n size varchar(32) path \'$\'\n ),\n nested path \'$.colors[*]\' columns (\n color varchar(32) path \'$\'\n )\n )\n) as jt;\n\n+-------+------+-------+\n| name | size | color |\n+-------+------+-------+\n| Jeans | 32 | NULL |\n| Jeans | 34 | NULL |\n| Jeans | 36 | NULL |\n| Jeans | NULL | black |\n| Jeans | NULL | blue |\n+-------+------+-------+\n\nON EMPTY and ON ERROR Clauses\n-----------------------------\n\nThe ON EMPTY clause specifies what will be done when the element specified by\nthe search path is missing in the JSON document.\n\non_empty:\n {NULL | DEFAULT string | ERROR} ON EMPTY\n\nWhen ON EMPTY clause is not present, NULL ON EMPTY is implied.\n\non_error:\n {NULL | DEFAULT string | ERROR} ON ERROR\n\nThe ON ERROR clause specifies what should be done if a JSON structure error\noccurs when trying to extract the value pointed to by the path expression. A\nJSON structure error here occurs only when one attempts to convert a JSON\nnon-scalar (array or object) into a scalar value. When the ON ERROR clause is\nnot present, NULL ON ERROR is implied.\n\nNote: A datatype conversion error (e.g. attempt to store a non-integer value\ninto an integer field, or a varchar column being truncated) is not considered\na JSON error and so will not trigger the ON ERROR behavior. It will produce\nwarnings, in the same way as CAST(value AS datatype) would.\n\nReplication\n-----------\n\nIn the current code, evaluation of JSON_TABLE is deterministic, that is, for a\ngiven input string JSON_TABLE will always produce the same set of rows in the\nsame order. However, one can think of JSON documents that one can consider\nidentical which will produce different output. In order to be future-proof and\nwithstand changes like:\n\n* sorting JSON object members by name (like MySQL does)\n* changing the way duplicate object members are handled\nthe function is marked as unsafe for statement-based replication.\n\nExtracting a Subdocument into a Column\n--------------------------------------\n\nMariaDB starting with 10.6.9\n----------------------------\nPrior to MariaDB 10.6.9, JSON_TABLE did not allow one to extract a JSON\n\"subdocument\" into a JSON column.\n\nSELECT * FROM JSON_TABLE(\'{\"foo\": [1,2,3,4]}\',\'$\' columns( jscol json path\n\'$.foo\') ) AS T;\n+-------+\n| jscol |\n+-------+\n| NULL |\n+-------+\n\nThis is supported from MariaDB 10.6.9:\n\nSELECT * FROM JSON_TABLE(\'{\"foo\": [1,2,3,4]}\',\'$\' columns( jscol json path\n\'$.foo\') ) AS T;\n+-----------+\n| jscol |\n+-----------+\n| [1,2,3,4] |\n+-----------+\n\nURL: https://mariadb.com/kb/en/json_table/','','https://mariadb.com/kb/en/json_table/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (767,40,'JSON_TYPE','Syntax\n------\n\nJSON_TYPE(json_val)\n\nDescription\n-----------\n\nReturns the type of a JSON value (as a string), or NULL if the argument is\nnull.\n\nAn error will occur if the argument is an invalid JSON value.\n\nThe following is a complete list of the possible return types:\n\n+-----------------------------------+-----------------+-----------------------+\n| Return type | Value | Example |\n+-----------------------------------+-----------------+-----------------------+\n| ARRAY | JSON array | [1, 2, {\"key\": |\n| | | \"value\"}] |\n+-----------------------------------+-----------------+-----------------------+\n| OBJECT | JSON object | {\"key\":\"value\"} |\n+-----------------------------------+-----------------+-----------------------+\n| BOOLEAN | JSON | true, false |\n| | true/false | |\n| | literals | |\n+-----------------------------------+-----------------+-----------------------+\n| DOUBLE | A number with | 1.2 |\n| | at least one | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| INTEGER | A number | 1 |\n| | without a | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| NULL | JSON null | null |\n| | literal (this | |\n| | is returned as | |\n| | a string, not | |\n| | to be confused | |\n| | with the SQL | |\n| | NULL value!) | |\n+-----------------------------------+-----------------+-----------------------+\n| STRING | JSON String | \"a sample string\" |\n+-----------------------------------+-----------------+-----------------------+\n\nExamples\n--------\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\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 (768,40,'JSON_UNQUOTE','Syntax\n------\n\nJSON_UNQUOTE(val)\n\nDescription\n-----------\n\nUnquotes a JSON value, returning a string, or NULL if the argument is null.\n\nAn error will occur if the given value begins and ends with double quotes and\nis an invalid JSON string literal.\n\nIf the given value is not a JSON string, value is passed through unmodified.\n\nCertain character sequences have special meanings within a string. Usually, a\nbackslash is ignored, but the escape sequences in the table below are\nrecognised by MariaDB, unless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n\n+-----------------------------------------------+-----------------------------+\n| Escape sequence | Character |\n+-----------------------------------------------+-----------------------------+\n| \\\" | Double quote (\") |\n+-----------------------------------------------+-----------------------------+\n| \\b | Backslash |\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 |\n| | value XXXX |\n+-----------------------------------------------+-----------------------------+\n\nExamples\n--------\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\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 (769,40,'JSON_VALID','Syntax\n------\n\nJSON_VALID(value)\n\nDescription\n-----------\n\nIndicates whether the given value is a valid JSON document or not. Returns 1\nif valid, 0 if not, and NULL if the argument is NULL.\n\nFrom MariaDB 10.4.3, the JSON_VALID function is automatically used as a CHECK\nconstraint for the JSON data type alias in order to ensure that a valid json\ndocument is inserted.\n\nExamples\n--------\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\", \"oddfield\"}\');\n+------------------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\", \"oddfield\"}\') |\n+------------------------------------------------------+\n| 0 |\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 (770,40,'JSON_VALUE','Syntax\n------\n\nJSON_VALUE(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns the scalar specified by the path. Returns NULL\nif not given a valid JSON document, or if there is no match.\n\nExamples\n--------\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}\', \'$.key1\');\n+-------------------------------------------------------+\n| json_value(\'{\"key1\": [1,2,3], \"key1\":123}\', \'$.key1\') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n\nIn the SET statement below, two escape characters are needed, as a single\nescape character would be applied by the SQL parser in the SET statement, and\nthe escaped character would not form part of the saved value.\n\nSET @json = \'{\"key1\":\"60\\\\\" Table\", \"key2\":\"1\"}\';\n\nSELECT JSON_VALUE(@json,\'$.key1\') AS Name , json_value(@json,\'$.key2\') as ID;\n+-----------+------+\n| Name | ID |\n+-----------+------+\n| 60\" Table | 1 |\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 (771,41,'Window Functions Overview','Introduction\n------------\n\nWindow functions allow calculations to be performed across a set of rows\nrelated to the current row.\n\nSyntax\n------\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 frame_border}\n\nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n\nDescription\n-----------\n\nIn some ways, window functions are similar to aggregate functions in that they\nperform calculations across a set of rows. However, unlike aggregate\nfunctions, the output is not grouped into a single row.\n\nNon-aggregate window functions include\n\n* CUME_DIST\n* DENSE_RANK\n* FIRST_VALUE\n* LAG\n* LAST_VALUE\n* LEAD\n* MEDIAN\n* NTH_VALUE\n* NTILE\n* PERCENT_RANK\n* PERCENTILE_CONT\n* PERCENTILE_DISC\n* RANK, ROW_NUMBER\n\nAggregate functions that can also be used as window functions include\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* MAX\n* MIN\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nWindow function queries are characterised by the OVER keyword, following which\nthe set of rows used for the calculation is specified. By default, the set of\nrows used for the calculation (the \"window) is the entire dataset, which can\nbe ordered with the ORDER BY clause. The PARTITION BY clause is used to reduce\nthe window to a particular group within the dataset.\n\nFor example, given the following data:\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\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 test and by name\nrespectively:\n\nSELECT name, test, score, AVG(score) OVER (PARTITION BY test) \n AS average_by_test FROM student;\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 name) \n AS average_by_name FROM student;\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 window function\n(for example, the current row and all preceding rows). See Window Frames for\nmore details.\n\nScope\n-----\n\nWindow functions were introduced in SQL:2003, and their definition was\nexpanded in subsequent versions of the standard. The last expansion was in the\nlatest version of the standard, SQL:2011.\n\nMost database products support a subset of the standard, they implement some\nfunctions defined as late as in SQL:2011, and at the same time leave some\nparts of SQL:2008 unimplemented.\n\nMariaDB:\n\n* Supports ROWS and RANGE-type frames\nAll kinds of frame bounds are supported, including RANGE PRECEDING|FOLLOWING n\nframe bounds (unlike PostgreSQL or MS SQL Server)\nDoes not yet support DATE[TIME] datatype and arithmetic for RANGE-type frames\n(MDEV-9727)\n\n* Does not support GROUPS-type frames (it seems that no popular database\nsupports it, either)\n\n* Does not support frame exclusion (no other database seems to support it,\neither) (MDEV-9724)\n* Does not support explicit NULLS FIRST or NULLS LAST.\n* Does not support nested navigation in window functions (this is\nVALUE_OF(expr AT row_marker [, default_value) syntax)\n\n* The following window functions are supported:\n\"Streamable\" window functions: ROW_NUMBER, RANK, DENSE_RANK, \nWindow functions that can be streamed once the number of rows in partition is\nknown: PERCENT_RANK, CUME_DIST, NTILE\n\n* Aggregate functions that are currently supported as window functions are:\nCOUNT, SUM, AVG, BIT_OR, BIT_AND, BIT_XOR.\n* Aggregate functions with the DISTINCT specifier (e.g. COUNT( DISTINCT x))\nare not supported as window functions.\n\nLinks\n-----\n\n* MDEV-6115 is the main jira task for window functions development. Other\ntasks are are attached as sub-tasks\n* bb-10.2-mdev9543 is the feature tree for window functions. Development is\nongoing, and this tree has the newest changes.\n* Testcases are in mysql-test/t/win*.test\n\nExamples\n--------\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\', \'regular\'),\n (\'eddie.stevens@data.org\', \'Eddie\', \'Stevens\', \'regular\'),\n (\'john.smith@xyz.org\', \'John\', \'Smith\', \'regular\'),\n (\'root@boss.org\', \'Root\', \'Chief\', \'admin\')\n\nFirst, let\'s order the records by email alphabetically, giving each an\nascending rnum value starting with 1. This will make use of the ROW_NUMBER\nwindow 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| 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, using the PARTITION\nBY clause:\n\nSELECT row_number() OVER (PARTITION BY account_type ORDER BY email) AS rnum, \n email, first_name, last_name, account_type\nFROM users ORDER BY account_type,email;\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 top 5 salaries\nfrom each department.\n\nCREATE TABLE employee_salaries (dept VARCHAR(20), name VARCHAR(20), salary\nINT(11));\n\nINSERT INTO employee_salaries VALUES\n(\'Engineering\', \'Dharma\', 3500),\n(\'Engineering\', \'Binh\', 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) < 5\norder by dept, salary desc;\n\n+-------------+--------------+--------+\n| dept | name | salary |\n+-------------+--------------+--------+\n| Engineering | Dharma | 3500 |\n| Engineering | Binh | 3000 |\n| Engineering | Adalynn | 2800 |\n| Engineering | Samuel | 2500 |\n| Engineering | Cveta | 2200 |\n| Sales | Carbry | 500 |\n| Sales | Clytemnestra | 400 |\n| Sales | Juraj | 300 |\n| Sales | Kalpana | 300 |\n| Sales | Svantepolk | 250 |\n+-------------+--------------+--------+\n\nThis has a number of disadvantages:\n\n* if there is no index, the query could take a long time if the\nemployee_salary_table is large\n* Adding and maintaining indexes adds overhead, and even with indexes on dept\nand salary, each subquery execution adds overhead by performing a lookup\nthrough the index.\n\nLet\'s try achieve the same with window functions. First, generate a rank for\nall employees, using the RANK function.\n\nselect rank() over (partition by dept order by salary desc) as ranking,\n dept, name, salary\n from employee_salaries\n order by dept, ranking;\n+---------+-------------+--------------+--------+\n| ranking | dept | name | salary |\n+---------+-------------+--------------+--------+\n| 1 | Engineering | Dharma | 3500 |\n| 2 | Engineering | Binh | 3000 |\n| 3 | Engineering | Adalynn | 2800 |\n| 4 | Engineering | Samuel | 2500 |\n| 5 | Engineering | Cveta | 2200 |\n| 6 | Engineering | Ebele | 1800 |\n| 1 | Sales | Carbry | 500 |\n| 2 | Sales | Clytemnestra | 400 |\n| 3 | Sales | Juraj | 300 |\n| 3 | Sales | Kalpana | 300 |\n| 5 | Sales | Svantepolk | 250 |\n| 6 | Sales | Angelo | 200 |\n+---------+-------------+--------------+--------+\n\nEach department has a separate sequence of ranks due to the PARTITION BY\nclause. This particular sequence of values for rank() is given by the ORDER BY\nclause inside the window function’s OVER clause. Finally, to get our results\nin a readable format we order the data by dept and the newly generated ranking\ncolumn.\n\nNow, we need to reduce the results to find only the top 5 per department. Here\nis a common mistake:\n\nselect\nrank() over (partition by dept order by salary desc) as ranking,\ndept, name, salary\nfrom employee_salaries\nwhere ranking <= 5\norder by dept, ranking;\n\nERROR 1054 (42S22): Unknown column \'ranking\' in \'where clause\'\n\nTrying to filter only the first 5 values per department by putting a where\nclause in the statement does not work, due to the way window functions are\ncomputed. The computation of window functions happens after all WHERE, GROUP\nBY and HAVING clauses have been completed, right before ORDER BY, so the WHERE\nclause has no idea that the ranking column exists. It is only present after we\nhave filtered and grouped all the rows.\n\nTo counteract this problem, we need to wrap our query into a derived table. We\ncan then attach a where clause to it:\n\nselect *from (select rank() over (partition by dept order by salary desc) as\nranking,\n dept, name, salary\nfrom employee_salaries) as salary_ranks\nwhere (salary_ranks.ranking <= 5)\n order by dept, ranking;\n+---------+-------------+--------------+--------+\n| ranking | dept | name | salary |\n+---------+-------------+--------------+--------+\n| 1 | Engineering | Dharma | 3500 |\n| 2 | Engineering | Binh | 3000 |\n| 3 | Engineering | Adalynn | 2800 |\n| 4 | Engineering | Samuel | 2500 |\n| 5 | Engineering | Cveta | 2200 |\n| 1 | Sales | Carbry | 500 |\n| 2 | Sales | Clytemnestra | 400 |\n| 3 | Sales | Juraj | 300 |\n| 3 | Sales | Kalpana | 300 |\n| 5 | Sales | Svantepolk | 250 |\n+---------+-------------+--------------+--------+\n\nURL: https://mariadb.com/kb/en/window-functions-overview/','','https://mariadb.com/kb/en/window-functions-overview/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (772,41,'CUME_DIST','Syntax\n------\n\nCUME_DIST() OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nCUME_DIST() is a window function that returns the cumulative distribution of a\ngiven row. The following formula is used to calculate the value:\n\n(number of rows <= current row) / (total rows)\n\nExamples\n--------\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| 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| 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 pct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\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\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 (773,41,'DENSE_RANK','Syntax\n------\n\nDENSE_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nDENSE_RANK() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving the same result. Unlike the RANK() function,\nthere are no skipped values if the preceding results are identical. It is also\nsimilar to the ROW_NUMBER() function except that in that function, identical\nvalues will receive a different row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (774,41,'FIRST_VALUE','Syntax\n------\n\nFIRST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nFIRST_VALUE returns the first result from an ordered set, or NULL if no such\nresult exists.\n\nExamples\n--------\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 (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 and 1 FOLLOWING) AS\nf_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS\nl_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f\nFROM t1;\n\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p | f_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\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 (775,41,'LAG','Syntax\n------\n\nLAG (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ]\n < ORDER BY order_list >\n)\n\nDescription\n-----------\n\nThe LAG function accesses data from a previous row according to the ORDER BY\nclause without the need for a self-join. The specific row is determined by the\noffset (default 1), which specifies the number of rows behind the current row\nto use. An offset of 0 is the current row.\n\nExamples\n--------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), 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| 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\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 (776,41,'LEAD','Syntax\n------\n\nLEAD (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe LEAD function accesses data from a following row in the same result set\nwithout the need for a self-join. The specific row is determined by the offset\n(default 1), which specifies the number of rows ahead the current row to use.\nAn offset of 0 is the current row.\n\nExample\n-------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), 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| 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\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 (777,41,'Median Window Function','MariaDB starting with 10.3.3\n----------------------------\nThe MEDIAN() window function was first introduced with in MariaDB 10.3.3.\n\nSyntax\n------\n\nMEDIAN(median expression) OVER (\n [ PARTITION BY partition_expression ]\n)\n\nDescription\n-----------\n\nMEDIAN() is a window function that returns the median value of a range of\nvalues.\n\nIt is a specific case of PERCENTILE_CONT, with an argument of 0.5 and the\nORDER BY column the one in MEDIAN\'s argument.\n\nMEDIAN(<median-arg>) OVER ( [ PARTITION BY partition_expression] )\n\nIs equivalent to:\n\nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY <median-arg>) OVER ( [ PARTITION BY partition_expression ])\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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) FROM book_rating;\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\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 (778,41,'NTH_VALUE','Syntax\n------\n\nNTH_VALUE (expr[, num_row]) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe NTH_VALUE function returns the value evaluated at row number num_row of\nthe window frame, starting from 1, or NULL if the row does not exist.\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 (779,41,'NTILE','Syntax\n------\n\nNTILE (expr) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nNTILE() is a window function that returns an integer indicating which group a\ngiven row falls into. The number of groups is specified in the argument\n(expr), starting at one. Ordered rows in the partition are divided into the\nspecified number of groups with as equal a size as possible.\n\nExamples\n--------\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| 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| 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\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 (780,41,'PERCENT_RANK','Syntax\n------\n\nPERCENT_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nPERCENT_RANK() is a window function that returns the relative percent rank of\na given row. The following formula is used to calculate the percent rank:\n\n(rank - 1) / (number of rows in the window or partition - 1)\n\nExamples\n--------\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| 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| 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 pct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\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\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 (781,41,'PERCENTILE_CONT','MariaDB starting with 10.3.3\n----------------------------\nThe PERCENTILE_CONT() window function was first introduced with in MariaDB\n10.3.3.\n\nSyntax\n------\n\nDescription\n-----------\n\nPERCENTILE_CONT() (standing for continuous percentile) is a window function\nwhich returns a value which corresponds to the given fraction in the sort\norder. If required, it will interpolate between adjacent input items.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition, denoted by N\n* RN = p*(N-1), where p denotes the argument to the PERCENTILE_CONT function\n* calculate the FRN(floor row number) and CRN(column row number for the group(\nFRN= floor(RN) and CRN = ceil(RN))\n* look up rows FRN and CRN\n* If (CRN = FRN = RN) then the result is (value of expression from row at RN)\n* Otherwise 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, equivalent to\nPERCENTILE_CONT(0.5).\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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\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 (782,41,'PERCENTILE_DISC','MariaDB starting with 10.3.3\n----------------------------\nThe PERCENTILE_DISC() window function was first introduced with in MariaDB\n10.3.3.\n\nSyntax\n------\n\nDescription\n-----------\n\nPERCENTILE_DISC() (standing for discrete percentile) is a window function\nwhich returns the first value in the set whose ordered position is the same or\nmore than the specified fraction.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition.\n* Walk through the partition, in order, until finding the the first row with\nCUME_DIST() >= function_argument.\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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 star_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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\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 (783,41,'RANK','Syntax\n------\n\nRANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nRANK() is a window function that displays the number of a given row, starting\nat one and following the ORDER BY sequence of the window function, with\nidentical values receiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will receive a\ndifferent row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (784,41,'ROW_NUMBER','Syntax\n------\n\nROW_NUMBER() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nROW_NUMBER() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving different row numbers. It is similar to the\nRANK() and DENSE_RANK() functions except that in that function, identical\nvalues will receive the same rank for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (785,41,'Aggregate Functions as Window Functions','It is possible to use aggregate functions as window functions. An aggregate\nfunction used as a window function must have the OVER clause. For example,\nhere\'s COUNT() used as a window function:\n\nselect COUNT(*) over (order by column) from table;\n\nMariaDB currently allows these aggregate functions to be used as window\nfunctions:\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* JSON_ARRAYAGG\n* JSON_OBJECTAGG\n* MAX\n* MIN\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nURL: https://mariadb.com/kb/en/aggregate-functions-as-window-functions/','','https://mariadb.com/kb/en/aggregate-functions-as-window-functions/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (786,41,'ColumnStore Window Functions','Introduction\n------------\n\nMariaDB ColumnStore provides support for window functions broadly following\nthe SQL 2003 specification. A window function allows for calculations relating\nto a window of data surrounding the current row in a result set. This\ncapability provides for simplified queries in support of common business\nquestions such as cumulative totals, rolling averages, and top 10 lists.\n\nAggregate functions are utilized for window functions however differ in\nbehavior from a group by query because the rows remain ungrouped. This\nprovides support for cumulative sums and rolling averages, for example.\n\nTwo key concepts for window functions are Partition and Frame:\n\n* A Partition is a group of rows, or window, that have the same value for a\nspecific column, for example a Partition can be created over a time period\nsuch as a quarter or lookup values.\n* The Frame for each row is a subset of the row\'s Partition. The frame\ntypically is dynamic allowing for a sliding frame of rows within the\nPartition. The Frame determines the range of rows for the windowing function.\nA Frame could be defined as the last X rows and next Y rows all the way up to\nthe entire Partition.\n\nWindow functions are applied after joins, group by, and having clauses are\ncalculated.\n\nSyntax\n------\n\nA window function is applied in the select clause using the following syntax:\n\nfunction_name ([expression [, expression ... ]]) OVER ( window_definition )\n\nwhere window_definition is defined as:\n\n[ PARTITION BY expression [, ...] ]\n[ ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] ]\n[ frame_clause ]\n\nPARTITION BY:\n\n* Divides the window result set into groups based on one or more expressions.\n* An expression may be a constant, column, and non window function expressions.\n* A query is not limited to a single partition by clause. Different partition\nclauses can be used across different window function applications.\n* The partition by columns do not need to be in the select list but do need to\nbe available from the query result set.\n* If there is no PARTITION BY clause, all rows of the result set define the\ngroup.\n\nORDER BY\n\n* Defines the ordering of values within the partition.\n* Can be ordered by multiple keys which may be a constant, column or non\nwindow function expression.\n* The order by columns do not need to be in the select list but need to be\navailable from the query result set.\n* Use of a select column alias from the query is not supported.\n* ASC (default) and DESC options allow for ordering ascending or descending.\n* NULLS FIRST and NULL_LAST options specify whether null values come first or\nlast in the ordering sequence. NULLS_FIRST is the default for ASC order, and\nNULLS_LAST is the default for DESC order.\n\nand the optional frame_clause is defined as:\n\n{ RANGE | ROWS } frame_start\n{ RANGE | ROWS } BETWEEN frame_start AND frame_end\n\nand the optional frame_start and frame_end are defined as (value being a\nnumeric expression):\n\nUNBOUNDED PRECEDING\nvalue PRECEDING\nCURRENT ROW\nvalue FOLLOWING\nUNBOUNDED FOLLOWING\n\nRANGE/ROWS:\n\n* Defines the windowing clause for calculating the set of rows that the\nfunction applies to for calculating a given rows window function result.\n* Requires an ORDER BY clause to define the row order for the window.\n* ROWS specify the window in physical units, i.e. result set rows and must be\na constant or expression evaluating to a positive numeric value.\n* RANGE specifies the window as a logical offset. If the the expression\nevaluates to a numeric value then the ORDER BY expression must be a numeric or\nDATE type. If the expression evaluates to an interval value then the ORDER BY\nexpression must be a DATE data type.\n* UNBOUNDED PRECEDING indicates the window starts at the first row of the\npartition.\n* UNBOUNDED FOLLOWING indicates the window ends at the last row of the\npartition.\n* CURRENT ROW specifies the window start or ends at the current row or value.\n* If omitted, the default is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.\n\nSupported Functions\n-------------------\n\n+--------------------------------+-------------------------------------------+\n| Function | Description |\n+--------------------------------+-------------------------------------------+\n| AVG() | The average of all input values. |\n+--------------------------------+-------------------------------------------+\n| COUNT() | Number of input rows. |\n+--------------------------------+-------------------------------------------+\n| CUME_DIST() | Calculates the cumulative distribution, |\n| | or relative rank, of the current row to |\n| | other rows in the same partition. Number |\n| | of peer or preceding rows / number of |\n| | rows in partition. |\n+--------------------------------+-------------------------------------------+\n| DENSE_RANK() | Ranks items in a group leaving no gaps |\n| | in ranking sequence when there are ties. |\n+--------------------------------+-------------------------------------------+\n| FIRST_VALUE() | The value evaluated at the row that is |\n| | the first row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| LAG() | The value evaluated at the row that is |\n| | offset rows before the current row |\n| | within the partition; if there is no |\n| | such row, instead return default. Both |\n| | offset and default are evaluated with |\n| | respect to the current row. If omitted, |\n| | offset defaults to 1 and default to |\n| | null. LAG provides access to more than |\n| | one row of a table at the same time |\n| | without a self-join. Given a series of |\n| | rows returned from a query and a |\n| | position of the cursor, LAG provides |\n| | access to a row at a given physical |\n| | offset prior to that position. |\n+--------------------------------+-------------------------------------------+\n| LAST_VALUE() | The value evaluated at the row that is |\n| | the last row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| LEAD() | Provides access to a row at a given |\n| | physical offset beyond that position. |\n| | Returns value evaluated at the row that |\n| | is offset rows after the current row |\n| | within the partition; if there is no |\n| | such row, instead return default. Both |\n| | offset and default are evaluated with |\n| | respect to the current row. If omitted, |\n| | offset defaults to 1 and default to null. |\n+--------------------------------+-------------------------------------------+\n| MAX() | Maximum value of expression across all |\n| | input values. |\n+--------------------------------+-------------------------------------------+\n| MEDIAN() | An inverse distribution function that |\n| | assumes a continuous distribution model. |\n| | It takes a numeric or datetime value and |\n| | returns the middle value or an |\n| | interpolated value that would be the |\n| | middle value once the values are sorted. |\n| | Nulls are ignored in the calculation. |\n+--------------------------------+-------------------------------------------+\n| MIN() | Minimum value of expression across all |\n| | input values. |\n+--------------------------------+-------------------------------------------+\n| NTH_VALUE() | The value evaluated at the row that is |\n| | the nth row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| NTILE() | Divides an ordered data set into a |\n| | number of buckets indicated by expr and |\n| | assigns the appropriate bucket number to |\n| | each row. The buckets are numbered 1 |\n| | through expr. The expr value must |\n| | resolve to a positive constant for each |\n| | partition. Integer ranging from 1 to the |\n| | argument value, dividing the partition |\n| | as equally as possible. |\n+--------------------------------+-------------------------------------------+\n| PERCENT_RANK() | relative rank of the current row: (rank |\n| | - 1) / (total rows - 1). |\n+--------------------------------+-------------------------------------------+\n| PERCENTILE_CONT() | An inverse distribution function that |\n| | assumes a continuous distribution model. |\n| | It takes a percentile value and a sort |\n| | specification, and returns an |\n| | interpolated value that would fall into |\n| | that percentile value with respect to |\n| | the sort specification. Nulls are |\n| | ignored in the calculation. |\n+--------------------------------+-------------------------------------------+\n| PERCENTILE_DISC() | An inverse distribution function that |\n| | assumes a discrete distribution model. |\n| | It takes a percentile value and a sort |\n| | specification and returns an element |\n| | from the set. Nulls are ignored in the |\n| | calculation. |\n+--------------------------------+-------------------------------------------+\n| RANK() | rank of the current row with gaps; same |\n| | as row_number of its first peer. |\n+--------------------------------+-------------------------------------------+\n| ROW_NUMBER() | number of the current row within its |\n| | partition, counting from 1 |\n+--------------------------------+-------------------------------------------+\n| STDDEV() STDDEV_POP() | Computes the population standard |\n| | deviation and returns the square root of |\n| | the population variance. |\n+--------------------------------+-------------------------------------------+\n| STDDEV_SAMP() | Computes the cumulative sample standard |\n| | deviation and returns the square root of |\n| | the sample variance. |\n+--------------------------------+-------------------------------------------+\n| SUM() | Sum of expression across all input |\n| | values. |\n+--------------------------------+-------------------------------------------+\n| VARIANCE() VAR_POP() | Population variance of the input values |\n| | (square of the population standard |\n| | deviation). |\n+--------------------------------+-------------------------------------------+\n| VAR_SAMP() | Sample variance of the input values |\n| | (square of the sample standard |\n| | deviation). |\n+--------------------------------+-------------------------------------------+\n\nExamples\n--------\n\nExample Schema\n--------------\n\nThe examples are all based on the following simplified sales opportunity table:\n\ncreate table opportunities (\nid int,\naccountName varchar(20),\nname varchar(128),\nowner varchar(7),\namount decimal(10,2),\ncloseDate date,\nstageName varchar(11)\n) engine=columnstore;\n\nSome example values are (thanks to https://www.mockaroo.com for sample data\ngeneration):\n\n+----+---------------+------+--------+---------+-------------+-------------+\n| id | accountName | name | owner | amount | closeDate | stageName |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 1 | Browseblab | Mult | Bob | 26444.8 | 2016-10-20 | Negotiating |','','https://mariadb.com/kb/en/window-functions-columnstore-window-functions/');
-update help_topic set description = CONCAT(description, '\n| | | -lat | | | | |\n| | | ral | | | | |\n| | | exec | | | | |\n| | | tive | | | | |\n| | | func | | | | |\n| | | ion | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 2 | Mita | Orga | Maria | 477878. | 2016-11-28 | ClosedWon |\n| | | ic | | 1 | | |\n| | | dema | | | | |\n| | | d-dr | | | | |\n| | | ven | | | | |\n| | | benc | | | | |\n| | | mark | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 3 | Miboo | De-e | Olivie | 80181.7 | 2017-01-05 | ClosedWon |\n| | | gine | | | | |\n| | | red | | | | |\n| | | hybr | | | | |\n| | | d | | | | |\n| | | grou | | | | |\n| | | ware | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 4 | Youbridge | Ente | Chris | 946245. | 2016-07-02 | ClosedWon |\n| | | pris | | 9 | | |\n| | | -wid | | | | |\n| | | | | | | |\n| | | bott | | | | |\n| | | m-li | | | | |\n| | | e | | | | |\n| | | Grap | | | | |\n| | | ic | | | | |\n| | | Inte | | | | |\n| | | face | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 5 | Skyba | Reve | Maria | 696241. | 2017-02-17 | Negotiating |\n| | | se-e | | 2 | | |\n| | | gine | | | | |\n| | | red | | | | |\n| | | fres | | | | |\n| | | -thi | | | | |\n| | | king | | | | |\n| | | stan | | | | |\n| | | ardi | | | | |\n| | | atio | | | | |\n| | | | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 6 | Eayo | Fund | Bob | 765605. | 2016-08-27 | Prospecting |\n| | | ment | | 2 | | |\n| | | l | | | | |\n| | | well | | | | |\n| | | modu | | | | |\n| | | ated | | | | |\n| | | arti | | | | |\n| | | icia | | | | |\n| | | | | | | |\n| | | inte | | | | |\n| | | lige | | | | |\n| | | ce | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 7 | Yotz | Exte | Chris | 319624. | 2017-01-06 | ClosedLost |\n| | | ded | | 0 | | |\n| | | seco | | | | |\n| | | dary | | | | |\n| | | infr | | | | |\n| | | stru | | | | |\n| | | ture | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 8 | Oloo | Conf | Chris | 321016. | 2017-03-08 | ClosedLost |\n| | | gura | | 6 | | |\n| | | le | | | | |\n| | | web- | | | | |\n| | | nabl | | | | |\n| | | d | | | | |\n| | | data | | | | |\n| | | ware | | | | |\n| | | ouse | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 9 | Kaymbo | Mult | Bob | 690881. | 2017-01-02 | Developing |\n| | | -lat | | 1 | | |\n| | | ral | | | | |\n| | | web- | | | | |\n| | | nabl | | | | |\n| | | d | | | | |\n| | | defi | | | | |\n| | | itio | | | | |\n| | | | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 10 | Rhyloo | Publ | Chris | 965477. | 2016-11-07 | Prospecting |\n| | | c-ke | | 4 | | |\n| | | | | | | |\n| | | cohe | | | | |\n| | | ent | | | | |\n| | | infr | | | | |\n| | | stru | | | | |\n| | | ture | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n\nThe schema, sample data, and queries are available as an attachment to this\narticle.\n\nCumulative Sum and Running Max Example\n--------------------------------------\n\nWindow functions can be used to achieve cumulative / running calculations on a\ndetail report. In this case a won opportunity report for a 7 day period adds\ncolumns to show the accumulated won amount as well as the current highest\nopportunity amount in preceding rows.\n\nselect owner, \naccountName, \nCloseDate, \namount, \nsum(amount) over (order by CloseDate rows between unbounded preceding and\ncurrent row) cumeWon, \nmax(amount) over (order by CloseDate rows between unbounded preceding and\ncurrent row) runningMax\nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by CloseDate;\n\nwith example results:\n\n+--------+---------------+-------------+---------+----------+--------------+\n| owner | accountName | CloseDate | amount | cumeWon | runningMax |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.4 | 437636.47 |\n| | | | 7 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 583722.9 | 437636.47 |\n| | | | 1 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 1417958. | 834235.93 |\n| | | | 3 | 1 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 2458738. | 834235.93 |\n| | | | 5 | 5 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 1918761. | 834235.93 |\n| | | | 9 | 0 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Latz | 2016-10-08 | 857254. | 3315993. | 857254.87 |\n| | | | 7 | 2 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 4015560. | 857254.87 |\n| | | | 6 | 8 | |\n+--------+---------------+-------------+---------+----------+--------------+\n\nPartitioned Cumulative Sum and Running Max Example\n--------------------------------------------------\n\nThe above example can be partitioned, so that the window functions are over a\nparticular field grouping such as owner and accumulate within that grouping.\nThis is achieved by adding the syntax \"partition by <columns>\" in the window\nfunction clause.\n\nselect owner, \naccountName, \nCloseDate, \namount, \nsum(amount) over (partition by owner order by CloseDate rows between unbounded\npreceding and current row) cumeWon, \nmax(amount) over (partition by owner order by CloseDate rows between unbounded\npreceding and current row) runningMax \nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by owner, CloseDate;\n\nwith example results:\n\n+--------+---------------+-------------+---------+----------+--------------+\n| owner | accountName | CloseDate | amount | cumeWon | runningMax |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.4 | 437636.47 |\n| | | | 7 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 583722.9 | 437636.47 |\n| | | | 1 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Latz | 2016-10-08 | 857254. | 1440977. | 857254.87 |\n| | | | 7 | 5 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 539977.4 | 539977.45 |\n| | | | 5 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 1239544. | 699566.86 |\n| | | | 6 | 1 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 834235.9 | 834235.93 |\n| | | | 3 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 1335038. | 834235.93 |\n| | | | 9 | 2 | |\n+--------+---------------+-------------+---------+----------+--------------+\n\nRanking / Top Results\n---------------------\n\nThe rank window function allows for ranking or assigning a numeric order value\nbased on the window function definition. Using the Rank() function will result\nin the same value for ties / equal values and the next rank value skipped. The\nDense_Rank() function behaves similarly except the next consecutive number is\nused after a tie rather than skipped. The Row_Number() function will provide a\nunique ordering value. The example query shows the Rank() function being\napplied to rank sales reps by the number of opportunities for Q4 2016.\n\nselect owner, \nwonCount, \nrank() over (order by wonCount desc) rank \nfrom (\n select owner,\n count(*) wonCount\n from opportunities\n where stageName=\'ClosedWon\'\n and closeDate >= \'2016-10-01\' and closeDate < \'2016-12-31\'\n group by owner\n) t\norder by rank;\n\nwith example results (note the query is technically incorrect by using\ncloseDate < \'2016-12-31\' however this creates a tie scenario for illustrative\npurposes):\n\n+----------------------+----------------------------------+------------------+\n| owner | wonCount | rank |\n+----------------------+----------------------------------+------------------+\n| Bill | 19 | 1 |\n+----------------------+----------------------------------+------------------+\n| Chris | 15 | 2 |') WHERE help_topic_id = 786;
-update help_topic set description = CONCAT(description, '\n+----------------------+----------------------------------+------------------+\n| Maria | 14 | 3 |\n+----------------------+----------------------------------+------------------+\n| Bob | 14 | 3 |\n+----------------------+----------------------------------+------------------+\n| Olivier | 10 | 5 |\n+----------------------+----------------------------------+------------------+\n\nIf the dense_rank function is used the rank values would be 1,2,3,3,4 and for\nthe row_number function the values would be 1,2,3,4,5.\n\nFirst and Last Values\n---------------------\n\nThe first_value and last_value functions allow determining the first and last\nvalues of a given range. Combined with a group by this allows summarizing\nopening and closing values. The example shows a more complex case where\ndetailed information is presented for first and last opportunity by quarter.\n\nselect a.year, \na.quarter, \nf.accountName firstAccountName, \nf.owner firstOwner, \nf.amount firstAmount, \nl.accountName lastAccountName, \nl.owner lastOwner, \nl.amount lastAmount \nfrom (\n select year,\n quarter,\n min(firstId) firstId,\n min(lastId) lastId\n from (\n select year(closeDate) year,\n quarter(closeDate) quarter,\n first_value(id) over (partition by year(closeDate), quarter(closeDate)\norder by closeDate rows between unbounded preceding and current row) firstId, \n last_value(id) over (partition by year(closeDate), quarter(closeDate)\norder by closeDate rows between current row and unbounded following) lastId \n from opportunities where stageName=\'ClosedWon\'\n ) t\n group by year, quarter order by year,quarter\n) a \njoin opportunities f on a.firstId = f.id \njoin opportunities l on a.lastId = l.id \norder by year, quarter;\n\nwith example results:\n\n+----+------+------------+--------+---------+-----------+-------+--------+\n| ye | quar | firstAccou | firstO | firstAm | lastAccou | lastO | lastAm |\n| r | er | tName | ner | unt | tName | ner | unt |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 3 | Skidoo | Bill | 523295. | Skipstorm | Bill | 151420 |\n| 6 | | | | 7 | | | 86 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 4 | Skimia | Chris | 961513. | Avamm | Maria | 112493 |\n| 6 | | | | 9 | | | 65 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 1 | Yombu | Bob | 536875. | Skaboo | Chris | 270273 |\n| 7 | | | | 1 | | | 08 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n\nPrior and Next Example\n----------------------\n\nSometimes it useful to understand the previous and next values in the context\nof a given row. The lag and lead window functions provide this capability. By\ndefault the offset is one providing the prior or next value but can also be\nprovided to get a larger offset. The example query is a report of\nopportunities by account name showing the opportunity amount, and the prior\nand next opportunity amount for that account by close date.\n\nselect accountName, \ncloseDate, \namount currentOppAmount, \nlag(amount) over (partition by accountName order by closeDate) priorAmount,\nlead(amount) over (partition by accountName order by closeDate) nextAmount \nfrom opportunities \norder by accountName, closeDate \nlimit 9;\n\nwith example results:\n\n+--------------+-----------+-------------------+--------------+-------------+\n| accountName | closeDate | currentOppAmount | priorAmount | nextAmount |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-09-1 | 645098.45 | NULL | 161086.82 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-10-1 | 161086.82 | 645098.45 | 350235.75 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-12-1 | 350235.75 | 161086.82 | 878595.89 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-12-3 | 878595.89 | 350235.75 | 922322.39 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2017-01-2 | 922322.39 | 878595.89 | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abatz | 2016-10-1 | 795424.15 | NULL | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-07-0 | 288974.84 | NULL | 914461.49 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-09-0 | 914461.49 | 288974.84 | 176645.52 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-09-2 | 176645.52 | 914461.49 | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n\nQuartiles Example\n-----------------\n\nThe NTile window function allows for breaking up a data set into portions\nassigned a numeric value to each portion of the range. NTile(4) breaks the\ndata up into quartiles (4 sets). The example query produces a report of all\nopportunities summarizing the quartile boundaries of amount values.\n\nselect t.quartile, \nmin(t.amount) min, \nmax(t.amount) max \nfrom (\n select amount,\n ntile(4) over (order by amount asc) quartile\n from opportunities\n where closeDate >= \'2016-10-01\' and closeDate <= \'2016-12-31\'\n ) t\ngroup by quartile \norder by quartile;\n\nWith example results:\n\n+-----------------------------------------+----------------+----------------+\n| quartile | min | max |\n+-----------------------------------------+----------------+----------------+\n| 1 | 6337.15 | 287634.01 |\n+-----------------------------------------+----------------+----------------+\n| 2 | 288796.14 | 539977.45 |\n+-----------------------------------------+----------------+----------------+\n| 3 | 540070.04 | 748727.51 |\n+-----------------------------------------+----------------+----------------+\n| 4 | 753670.77 | 998864.47 |\n+-----------------------------------------+----------------+----------------+\n\nPercentile Example\n------------------\n\nThe percentile functions have a slightly different syntax from other window\nfunctions as can be seen in the example below. These functions can be only\napplied against numeric values. The argument to the function is the percentile\nto evaluate. Following \'within group\' is the sort expression which indicates\nthe sort column and optionally order. Finally after \'over\' is an optional\npartition by clause, for no partition clause use \'over ()\'. The example below\nutilizes the value 0.5 to calculate the median opportunity amount in the rows.\nThe values differ sometimes because percentile_cont will return the average of\nthe 2 middle rows for an even data set while percentile_desc returns the first\nencountered in the sort.\n\nselect owner, \naccountName, \nCloseDate, \namount,\npercentile_cont(0.5) within group (order by amount) over (partition by owner)\npct_cont,\npercentile_disc(0.5) within group (order by amount) over (partition by owner)\npct_disc\nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by owner, CloseDate;\n\nWith example results:\n\n+--------+----------------+-------------+---------+------------+------------+\n| owner | accountName | CloseDate | amount | pct_cont | pct_disc |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.470 | 437636.47 |\n| | | | 7 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 437636.470 | 437636.47 |\n| | | | 1 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Latz | 2016-10-08 | 857254. | 437636.470 | 437636.47 |\n| | | | 7 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 619772.155 | 539977.45 |\n| | | | 5 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 619772.155 | 539977.45 |\n| | | | 6 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 667519.110 | 500802.29 |\n| | | | 3 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 667519.110 | 500802.29 |\n| | | | 9 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n\nURL: https://mariadb.com/kb/en/window-functions-columnstore-window-functions/') WHERE help_topic_id = 786;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (787,41,'Window Frames','Syntax\n------\n\nframe_clause:\n {ROWS | RANGE} {frame_border | BETWEEN frame_border AND frame_border}\n\nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n\nDescription\n-----------\n\nA basic overview of window functions is described in Window Functions\nOverview. Window frames expand this functionality by allowing the function to\ninclude a specified a number of rows around the current row.\n\nThese include:\n\n* All rows before the current row (UNBOUNDED PRECEDING), for example RANGE\nBETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n* All rows after the current row (UNBOUNDED FOLLOWING), for example RANGE\nBETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING\n* A set number of rows before the current row (expr PRECEDING) for example\nRANGE BETWEEN 6 PRECEDING AND CURRENT ROW\n* A set number of rows after the current row (expr PRECEDING AND expr\nFOLLOWING) for example RANGE BETWEEN CURRENT ROW AND 2 FOLLOWING\n* A specified number of rows both before and after the current row, for\nexample RANGE BETWEEN 6 PRECEDING AND 3 FOLLOWING\n\nThe following functions operate on window frames:\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* LEAD\n* MAX\n* MIN\n* NTILE\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nWindow frames are determined by the frame_clause in the window function\nrequest.\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| 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 clause, the SUM function is run over the entire\ndataset. However, if we specify an ORDER BY condition based on score (and\norder the entire result in the same way for clarity), the following result is\nreturned:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score) AS total_score\n FROM student_test ORDER BY score;\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 current row, and all\nprevious rows. The window frame in this example expands as the function\nproceeds.\n\nThe above query makes use of the default to define the window frame. It could\nbe written explicitly as follows:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS\ntotal_score \n FROM student_test ORDER BY score;\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 all following\nrows can be done with the use of UNBOUNDED FOLLOWING:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS\ntotal_score \n FROM student_test ORDER BY score;\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 entire unbounded\nfollowing or preceding set. The following example takes the current row, as\nwell as the previous row:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS\ntotal_score \n FROM student_test ORDER BY score;\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 FOLLOWING) AS\ntotal_score \n FROM student_test ORDER BY score;\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\nURL: https://mariadb.com/kb/en/window-frames/','','https://mariadb.com/kb/en/window-frames/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (788,42,'SPIDER_BG_DIRECT_SQL','Syntax\n------\n\nSPIDER_BG_DIRECT_SQL(\'sql\', \'tmp_table_list\', \'parameters\')\n\nDescription\n-----------\n\nExecutes the given SQL statement in the background on the remote server, as\ndefined in the parameters listing. If the query returns a result-set, it\nsttores the results in the given temporary table. When the given SQL statement\nexecutes successfully, this function returns the number of called UDF\'s. It\nreturns 0 when the given SQL statement fails.\n\nThis function is a UDF installed with the Spider storage engine.\n\nExamples\n--------\n\nSELECT SPIDER_BG_DIRECT_SQL(\'SELECT * FROM example_table\', \'\', \n \'srv \"node1\", port \"8607\"\') AS \"Direct Query\";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n\nParameters\n----------\n\nerror_rw_mode\n-------------\n\n* Description: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n\n* Default Table Value: 0\n* DSN Parameter Name: erwm\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 (789,42,'SPIDER_COPY_TABLES','Syntax\n------\n\nSPIDER_COPY_TABLES(spider_table_name, \n source_link_id, destination_link_id_list [,parameters])\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function copies table\ndata from source_link_id to destination_link_id_list. The service does not\nneed to be stopped in order to copy.\n\nIf the Spider table is partitioned, the name must be of the format\ntable_name#P#partition_name. The partition name can be viewed in the\nmysql.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 copying the data failed.\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 (790,42,'SPIDER_DIRECT_SQL','Syntax\n------\n\nSPIDER_DIRECT_SQL(\'sql\', \'tmp_table_list\', \'parameters\')\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function is used to\nexecute the SQL string sql on the remote server, as defined in parameters. If\nany resultsets are returned, they are stored in the tmp_table_list.\n\nThe function returns 1 if the SQL executes successfully, or 0 if it fails.\n\nExamples\n--------\n\nSELECT SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv \"node1\", port \"8607\"\');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv \"node1\", port \"8607\"\') |\n+----------------------------------------------------------------------+\n| 1 |\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 (791,42,'SPIDER_FLUSH_TABLE_MON_CACHE','Syntax\n------\n\nSPIDER_FLUSH_TABLE_MON_CACHE()\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function is used for\nrefreshing monitoring server information. It returns a value of 1.\n\nExamples\n--------\n\nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\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 (792,43,'COLUMN_ADD','Syntax\n------\n\nCOLUMN_ADD(dyncol_blob, column_nr, value [as type], [column_nr, value [as\ntype]]...);\nCOLUMN_ADD(dyncol_blob, column_name, value [as type], [column_name, value [as\ntype]]...);\n\nDescription\n-----------\n\nAdds or updates dynamic columns.\n\n* dyncol_blob must be either a valid dynamic columns blob (for example,\nCOLUMN_CREATE returns such blob), or an empty string.\n* column_name specifies the name of the column to be added. If dyncol_blob\nalready has a column with this name, it will be overwritten.\n* value specifies the new value for the column. Passing a NULL value will\ncause the column to be deleted.\n* as type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nExamples\n--------\n\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, \"column_name\", \"value\")\nWHERE id=1;\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order\nto update the value in the table you have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\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 (793,43,'COLUMN_CHECK','Syntax\n------\n\nCOLUMN_CHECK(dyncol_blob);\n\nDescription\n-----------\n\nCheck if dyncol_blob is a valid packed dynamic columns blob. Return value of 1\nmeans the blob is valid, return value of 0 means it is not.\n\nRationale: Normally, one works with valid dynamic column blobs. Functions like\nCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column\nblobs. However, if a dynamic column blob is accidentally truncated, or\ntranscoded from one character set to another, it will be corrupted. This\nfunction can be used to check if a value in a blob field is a valid dynamic\ncolumn blob.\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 (794,43,'COLUMN_CREATE','Syntax\n------\n\nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name, value [as type]]...);\n\nDescription\n-----------\n\nReturns a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n* storing in a table\n* further modification with other dynamic columns functions\n\nThe as type part allows one to specify the value type. In most cases, this is\nredundant because MariaDB will be able to deduce the type of the value.\nExplicit type specification may be needed when the type of the value is not\napparent. For example, a literal \'2012-12-01\' has a CHAR type by default, one\nwill need to specify \'2012-12-01\' AS DATE to have it stored as a date. See\nDynamic Columns:Datatypes for further details.\n\nExamples\n--------\n\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\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 (795,43,'COLUMN_DELETE','Syntax\n------\n\nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n\nDescription\n-----------\n\nDeletes a dynamic column with the specified name. Multiple names can be given.\nThe return value is a dynamic column blob after the modification.\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 (796,43,'COLUMN_EXISTS','Syntax\n------\n\nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n\nDescription\n-----------\n\nChecks if a column with name column_name exists in dyncol_blob. If yes, return\n1, otherwise return 0. See dynamic columns for more information.\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 (797,43,'COLUMN_GET','Syntax\n------\n\nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n\nDescription\n-----------\n\nGets the value of a dynamic column by its name. If no column with the given\nname exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic\ncolumn they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype\nthey\'re retrieving? Can\'t the dynamic columns system figure the datatype from\nthe data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs\nto know the datatypes of all expressions before the query is run (for example,\nwhen one is using prepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the client about the\ndatatype of the column being read before the query is executed and the server\ncan see what datatype the column actually has).\n\nLengths\n-------\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, not as CHAR(n)),\nMariaDB will report the maximum length of the resultset column to be\n16,777,216. This may cause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum resultset width. To avoid\nthis problem, use CHAR(n) whenever you\'re using COLUMN_GET in the select list.\n\nSee Dynamic Columns:Datatypes for more information about datatypes.\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 (798,43,'COLUMN_JSON','Syntax\n------\n\nCOLUMN_JSON(dyncol_blob)\n\nDescription\n-----------\n\nReturns a JSON representation of data in dyncol_blob. Can also be used to\ndisplay nested columns. See dynamic columns for more information.\n\nExample\n-------\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 years\"} |\n+-----------------+----------------------------------------+\n\nLimitation: COLUMN_JSON will decode nested dynamic columns at a nesting level\nof not more than 10 levels deep. Dynamic columns that are nested deeper than\n10 levels will be shown as BINARY string, without encoding.\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 (799,43,'COLUMN_LIST','Syntax\n------\n\nCOLUMN_LIST(dyncol_blob);\n\nDescription\n-----------\n\nReturns a comma-separated list of column names. The names are quoted with\nbackticks.\n\nSee dynamic columns for more information.\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 (800,44,'WSREP_LAST_SEEN_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_LAST_SEEN_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_LAST_SEEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction\nobserved by the client.\n\nThe result can be useful to determine the transaction to provide to\nWSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking purposes.\n\nURL: https://mariadb.com/kb/en/wsrep_last_seen_gtid/','','https://mariadb.com/kb/en/wsrep_last_seen_gtid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (801,44,'WSREP_LAST_WRITTEN_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_LAST_WRITTEN_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_LAST_WRITTEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction\nperformed by the client.\n\nURL: https://mariadb.com/kb/en/wsrep_last_written_gtid/','','https://mariadb.com/kb/en/wsrep_last_written_gtid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (802,44,'WSREP_SYNC_WAIT_UPTO_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_SYNC_WAIT_UPTO_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_SYNC_WAIT_UPTO_GTID(gtid[,timeout])\n\nDescription\n-----------\n\nBlocks the client until the transaction specified by the given Global\nTransaction ID is applied and committed by the node.\n\nThe optional timeout argument can be used to specify a block timeout in\nseconds. If not provided, the timeout will be indefinite.\n\nReturns the node that applied and committed the Global Transaction ID,\nER_LOCAL_WAIT_TIMEOUT if the function is timed out before this, or\nER_WRONG_ARGUMENTS if the function is given an invalid GTID.\n\nThe result from WSREP_LAST_SEEN_GTID can be useful to determine the\ntransaction to provide to WSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking\npurposes.\n\nURL: https://mariadb.com/kb/en/wsrep_sync_wait_upto_gtid/','','https://mariadb.com/kb/en/wsrep_sync_wait_upto_gtid/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (803,45,'System-Versioned Tables','MariaDB supports temporal data tables in the form of system-versioning tables\n(allowing you to query and operate on historic data, discussed below),\napplication-time periods (allow you to query and operate on a temporal range\nof data), and bitemporal tables (which combine both system-versioning and\napplication-time periods).\n\nSystem-Versioned Tables\n-----------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSupport for system-versioned tables was added in MariaDB 10.3.4.\n\nSystem-versioned tables store the history of all changes, not only data which\nis currently valid. This allows data analysis for any point in time, auditing\nof changes and comparison of data from different points in time. Typical uses\ncases are:\n\n* Forensic analysis & legal requirements to store data for N years.\n* Data analytics (retrospective, trends etc.), e.g. to get your staff\ninformation as of one year ago.\n* Point-in-time recovery - recover a table state as of particular point in\ntime.\n\nSystem-versioned tables were first introduced in the SQL:2011 standard.\n\nCreating a System-Versioned Table\n---------------------------------\n\nThe CREATE TABLE syntax has been extended to permit creating a\nsystem-versioned table. To be system-versioned, according to SQL:2011, a table\nmust have two generated columns, a period, and a special table option clause:\n\nCREATE TABLE t(\n x INT,\n start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)\n) WITH SYSTEM VERSIONING;\n\nIn MariaDB one can also use a simplified syntax:\n\nCREATE TABLE t (\n x INT\n) WITH SYSTEM VERSIONING;\n\nIn the latter case no extra columns will be created and they won\'t clutter the\noutput of, say, SELECT * FROM t. The versioning information will still be\nstored, and it can be accessed via the pseudo-columns ROW_START and ROW_END:\n\nSELECT x, ROW_START, ROW_END FROM t;\n\nAdding or Removing System Versioning To/From a Table\n----------------------------------------------------\n\nAn existing table can be altered to enable system versioning for it.\n\nCREATE TABLE t(\n x INT\n);\n\nALTER TABLE t ADD SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n\nSimilarly, system versioning can be removed from a table:\n\nALTER TABLE t DROP SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nOne can also add system versioning with all columns created explicitly:\n\nALTER TABLE t ADD COLUMN ts TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n ADD COLUMN te TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n ADD PERIOD FOR SYSTEM_TIME(ts, te),\n ADD SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL,\n `ts` timestamp(6) GENERATED ALWAYS AS ROW START,\n `te` timestamp(6) GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME (`ts`, `te`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n\nQuerying Historical Data\n------------------------\n\nSELECT\n------\n\nTo query the historical data one uses the clause FOR SYSTEM_TIME directly\nafter the table name (before the table alias, if any). SQL:2011 provides three\nsyntactic extensions:\n\n* AS OF is used to see the table as it was at a specific point in time in the\npast:\n\nSELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09 08:07:06\';\n\n* BETWEEN start AND end will show all rows that were visible at any point\nbetween two specified points in time. It works inclusively, a row visible\nexactly at start or exactly at end will be shown too.\n\nSELECT * FROM t FOR SYSTEM_TIME BETWEEN (NOW() - INTERVAL 1 YEAR) AND NOW();\n\n* FROM start TO end will also show all rows that were visible at any point\nbetween two specified points in time, including start, but excluding end.\n\nSELECT * FROM t FOR SYSTEM_TIME FROM \'2016-01-01 00:00:00\' TO \'2017-01-01\n00:00:00\';\n\nAdditionally MariaDB implements a non-standard extension:\n\n* ALL will show all rows, historical and current.\n\nSELECT * FROM t FOR SYSTEM_TIME ALL;\n\nIf the FOR SYSTEM_TIME clause is not used, the table will show the current\ndata, as if one had specified FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP.\n\nViews and Subqueries\n--------------------\n\nWhen a system-versioned tables is used in a view or in a subquery in the from\nclause, FOR SYSTEM_TIME can be used directly in the view or subquery body, or\n(non-standard) applied to the whole view when it\'s being used in a SELECT:\n\nCREATE VIEW v1 AS SELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09\n08:07:06\';\n\nOr\n\nCREATE VIEW v1 AS SELECT * FROM t;\nSELECT * FROM v1 FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09 08:07:06\';\n\nUse in Replication and Binary Logs\n----------------------------------\n\nTables that use system-versioning implicitly add the row_end column to the\nPrimary Key. While this is generally not an issue for most use cases, it can\nlead to problems when re-applying write statements from the binary log or in\nreplication environments, where a primary retries an SQL statement on the\nreplica.\n\nSpecifically, these writes include a value on the row_end column containing\nthe timestamp from when the write was initially made. The re-occurrence of the\nPrimary Key with the old system-versioning columns raises an error due to the\nduplication.\n\nTo mitigate this with MariaDB Replication, set the secure_timestamp system\nvariable to YES on the replica. When set, the replica uses its own system\nclock when applying to the row log, meaning that the primary can retry as many\ntimes as needed without causing a conflict. The retries generate new\nhistorical rows with new values for the row_start and row_end columns.\n\nTransaction-Precise History in InnoDB\n-------------------------------------\n\nA point in time when a row was inserted or deleted does not necessarily mean\nthat a change became visible at the same moment. With transactional tables, a\nrow might have been inserted in a long transaction, and became visible hours\nafter it was inserted.\n\nFor some applications — for example, when doing data analytics on one-year-old\ndata — this distinction does not matter much. For others — forensic analysis —\nit might be crucial.\n\nMariaDB supports transaction-precise history (only for the InnoDB storage\nengine) that allows seeing the data exactly as it would\'ve been seen by a new\nconnection doing a SELECT at the specified point in time — rows inserted\nbefore that point, but committed after will not be shown.\n\nTo use transaction-precise history, InnoDB needs to remember not timestamps,\nbut transaction identifier per row. This is done by creating generated columns\nas BIGINT UNSIGNED, not TIMESTAMP(6):\n\nCREATE TABLE t(\n x INT,\n start_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW START,\n end_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME(start_trxid, end_trxid)\n) WITH SYSTEM VERSIONING;\n\nThese columns must be specified explicitly, but they can be made INVISIBLE to\navoid cluttering SELECT * output.\n\nWhen one uses transaction-precise history, one can optionally use transaction\nidentifiers in the FOR SYSTEM_TIME clause:\n\nSELECT * FROM t FOR SYSTEM_TIME AS OF TRANSACTION 12345;\n\nThis will show the data, exactly as it was seen by the transaction with the\nidentifier 12345.\n\nStoring the History Separately\n------------------------------\n\nWhen the history is stored together with the current data, it increases the\nsize of the table, so current data queries — table scans and index searches —\nwill take more time, because they will need to skip over historical data. If\nmost queries on that table use only current data, it might make sense to store\nthe history separately, to reduce the overhead from versioning.\n\nThis is done by partitioning the table by SYSTEM_TIME. Because of the\npartition pruning optimization, all current data queries will only access one\npartition, the one that stores current data.\n\nThis example shows how to create such a partitioned table:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME (\n PARTITION p_hist HISTORY,\n PARTITION p_cur CURRENT\n );\n\nIn this example all history will be stored in the partition p_hist while all\ncurrent data will be in the partition p_cur. The table must have exactly one\ncurrent partition and at least one historical partition.\n\nPartitioning by SYSTEM_TIME also supports automatic partition rotation. One\ncan rotate historical partitions by time or by size. This example shows how to\nrotate partitions by size:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME LIMIT 100000 (\n PARTITION p0 HISTORY,\n PARTITION p1 HISTORY,\n PARTITION pcur CURRENT\n );\n\nMariaDB will start writing history rows into partition p0, and when it reaches\na size of 100000 rows, MariaDB will switch to partition p1. There are only two\nhistorical partitions, so when p1 overflows, MariaDB will issue a warning, but\nwill continue writing into it.\n\nSimilarly, one can rotate partitions by time:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 WEEK (\n PARTITION p0 HISTORY,\n PARTITION p1 HISTORY,\n PARTITION p2 HISTORY,\n PARTITION pcur CURRENT\n );\n\nThis means that the history for the first week after the table was created\nwill be stored in p0. The history for the second week — in p1, and all later\nhistory will go into p2. One can see the exact rotation time for each\npartition in the INFORMATION_SCHEMA.PARTITIONS table.\n\nIt is possible to combine partitioning by SYSTEM_TIME and subpartitions:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME\n SUBPARTITION BY KEY (x)\n SUBPARTITIONS 4 (\n PARTITION ph HISTORY,\n PARTITION pc CURRENT\n );\n\nDefault Partitions\n------------------\n\nMariaDB starting with 10.5.0\n----------------------------\nSince partitioning by current and historical data is such a typical usecase,\nfrom MariaDB 10.5, it is possible to use a simplified statement to do so. For\nexample, instead of\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME (\n PARTITION p0 HISTORY,\n PARTITION pn CURRENT\n);\n\nyou can use\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME;\n\nYou can also specify the number of partitions, which is useful if you want to\nrotate history by time, for example:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME\n INTERVAL 1 MONTH\n PARTITIONS 12;\n\nSpecifying the number of partitions without specifying a rotation condition\nwill result in a warning:\n\nCREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME PARTITIONS 12;\nQuery OK, 0 rows affected, 1 warning (0.518 sec)\n\nWarning (Code 4115): Maybe missing parameters: no rotation condition for\nmultiple HISTORY partitions.\n\nwhile specifying only 1 partition will result in an error:\n\nCREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME PARTITIONS 1;\nERROR 4128 (HY000): Wrong partitions for `t`: must have at least one HISTORY\nand exactly one last CURRENT\n\nAutomatically Creating Partitions\n---------------------------------\n\nMariaDB starting with 10.9.1\n----------------------------\nFrom MariaDB 10.9.1, the AUTO keyword can be used to automatically create\nhistory partitions.\n\nFor example\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 MONTH\n STARTS \'2021-01-01 00:00:00\' AUTO PARTITIONS 12;\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME LIMIT 1000 AUTO;\n\nOr with explicit partitions:\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO\n (PARTITION p0 HISTORY, PARTITION pn CURRENT);\n\nTo disable or enable auto-creation one can use ALTER TABLE by adding or\nremoving AUTO from the partitioning specification:\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\n# Disables auto-creation:\nALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR;\n\n# Enables auto-creation:\nALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\nIf the rest of the partitioning specification is identical to CREATE TABLE, no\nrepartitioning will be done (for details see MDEV-27328).\n\nRemoving Old History\n--------------------\n\nBecause it stores all the history, a system-versioned table might grow very\nlarge over time. There are many options to trim down the space and remove the\nold history.\n\nOne can completely drop the versioning from the table and add it back again,\nthis will delete all the history:\n\nALTER TABLE t DROP SYSTEM VERSIONING;\nALTER TABLE t ADD SYSTEM VERSIONING;\n\nIt might be a rather time-consuming operation, though, as the table will need\nto be rebuilt, possibly twice (depending on the storage engine).\n\nAnother option would be to use partitioning and drop some of historical\npartitions:\n\nALTER TABLE t DROP PARTITION p0;\n\nNote, that one cannot drop a current partition or the only historical\npartition.\n\nAnd the third option; one can use a variant of the DELETE statement to prune\nthe history:\n\nDELETE HISTORY FROM t;\n\nor only old history up to a specific point in time:\n\nDELETE HISTORY FROM t BEFORE SYSTEM_TIME \'2016-10-09 08:07:06\';\n\nor to a specific transaction (with BEFORE SYSTEM_TIME TRANSACTION xxx).\n\nTo protect the integrity of the history, this statement requires a special\nDELETE HISTORY privilege.\n\nCurrently, using the DELETE HISTORY statement with a BEFORE SYSTEM_TIME\ngreater than the ROW_END of the active records (as a TIMESTAMP, this has a\nmaximum value of \'2038-01-19 03:14:07\' UTC) will result in the historical\nrecords being dropped, and the active records being deleted and moved to\nhistory. See MDEV-25468.\n','','https://mariadb.com/kb/en/system-versioned-tables/');
-update help_topic set description = CONCAT(description, '\nPrior to MariaDB 10.4.5, the TRUNCATE TABLE statement drops all historical\nrecords from a system-versioned-table.\n\nFrom MariaDB 10.4.5, historic data is protected from TRUNCATE statements, as\nper the SQL standard, and an Error 4137 is instead raised:\n\nTRUNCATE t;\nERROR 4137 (HY000): System-versioned tables do not support TRUNCATE TABLE\n\nExcluding Columns From Versioning\n---------------------------------\n\nAnother MariaDB extension allows to version only a subset of columns in a\ntable. This is useful, for example, if you have a table with user information\nthat should be versioned, but one column is, let\'s say, a login counter that\nis incremented often and is not interesting to version. Such a column can be\nexcluded from versioning by declaring it WITHOUT VERSIONING\n\nCREATE TABLE t (\n x INT,\n y INT WITHOUT SYSTEM VERSIONING\n) WITH SYSTEM VERSIONING;\n\nA column can also be declared WITH VERSIONING, that will automatically make\nthe table versioned. The statement below is equivalent to the one above:\n\nCREATE TABLE t (\n x INT WITH SYSTEM VERSIONING,\n y INT\n);\n\nChanges in other sections: https://mariadb.com/kb/en/create-table/\nhttps://mariadb.com/kb/en/alter-table/ https://mariadb.com/kb/en/join-syntax/\nhttps://mariadb.com/kb/en/partitioning-types-overview/\nhttps://mariadb.com/kb/en/date-and-time-units/\nhttps://mariadb.com/kb/en/delete/ https://mariadb.com/kb/en/grant/\n\nthey all reference back to this page\n\nAlso, TODO:\n\n* limitations (size, speed, adding history to unique not nullable columns)\n\nSystem Variables\n----------------\n\nThere are a number of system variables related to system-versioned tables:\n\nsystem_versioning_alter_history\n-------------------------------\n\n* Description: SQL:2011 does not allow ALTER TABLE on system-versioned tables.\nWhen this variable is set to ERROR, an attempt to alter a system-versioned\ntable will result in an error. When this variable is set to KEEP, ALTER TABLE\nwill be allowed, but the history will become incorrect — querying historical\ndata will show the new table structure. This mode is still useful, for\nexample, when adding new columns to a table. Note that if historical data\ncontains or would contain nulls, attempting to ALTER these columns to be NOT\nNULL will return an error (or warning if strict_mode is not set).\n* Commandline: --system-versioning-alter-history=value\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Enum\n* Default Value: ERROR\n* Valid Values: ERROR, KEEP\n* Introduced: MariaDB 10.3.4\n\nsystem_versioning_asof\n----------------------\n\n* Description: If set to a specific timestamp value, an implicit FOR\nSYSTEM_TIME AS OF clause will be applied to all queries. This is useful if one\nwants to do many queries for history at the specific point in time. Set it to\nDEFAULT to restore the default behavior. Has no effect on DML, so queries such\nas INSERT .. SELECT and REPLACE .. SELECT need to state AS OF explicitly.\n* Commandline: None\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Varchar\n* Default Value: DEFAULT\n* Introduced: MariaDB 10.3.4\n\nsystem_versioning_innodb_algorithm_simple\n-----------------------------------------\n\n* Description: Never fully implemented and removed in the following release.\n* Commandline: --system-versioning-innodb-algorithm-simple[={0|1}]\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Boolean\n* Default Value: ON\n* Introduced: MariaDB 10.3.4\n* Removed: MariaDB 10.3.5\n\nsystem_versioning_insert_history\n--------------------------------\n\n* Description: Allows direct inserts into ROW_START and ROW_END columns if\nsecure_timestamp allows changing timestamp.\n* Commandline: --system-versioning-insert-history[={0|1}]\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Boolean\n* Default Value: OFF\n* Introduced: MariaDB 10.11.0\n\nLimitations\n-----------\n\n* Versioning clauses can not be applied to generated (virtual and persistent)\ncolumns.\n* mysqldump does not read historical rows from versioned tables, and so\nhistorical data will not be backed up. Also, a restore of the timestamps would\nnot be possible as they cannot be defined by an insert/a user.\n\nURL: https://mariadb.com/kb/en/system-versioned-tables/') WHERE help_topic_id = 803;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (804,45,'Application-Time Periods','MariaDB starting with 10.4.3\n----------------------------\nSupport for application-time period-versioning was added in MariaDB 10.4.3.\n\nExtending system-versioned tables, MariaDB 10.4 supports application-time\nperiod tables. Time periods are defined by a range between two temporal\ncolumns. The columns must be of the same temporal data type, i.e. DATE,\nTIMESTAMP or DATETIME (TIME and YEAR are not supported), and of the same width.\n\nUsing time periods implicitly defines the two columns as NOT NULL. It also\nadds a constraint to check whether the first value is less than the second\nvalue. The constraint is invisible to SHOW CREATE TABLE statements. The name\nof this constraint is prefixed by the time period name, to avoid conflict with\nother constraints.\n\nCreating Tables with Time Periods\n---------------------------------\n\nTo create a table with a time period, use a CREATE TABLE statement with the\nPERIOD table option.\n\nCREATE TABLE t1(\n name VARCHAR(50),\n date_1 DATE,\n date_2 DATE,\n PERIOD FOR date_period(date_1, date_2));\n\nThis creates a table with a time_period period and populates the table with\nsome basic temporal values.\n\nExamples are available in the MariaDB Server source code, at\nmysql-test/suite/period/r/create.result.\n\nAdding and Removing Time Periods\n--------------------------------\n\nThe ALTER TABLE statement now supports syntax for adding and removing time\nperiods from a table. To add a period, use the ADD PERIOD clause.\n\nFor example:\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE\n );\n\nALTER TABLE rooms ADD PERIOD FOR p(checkin,checkout);\n\nTo remove a period, use the DROP PERIOD clause:\n\nALTER TABLE rooms DROP PERIOD FOR p;\n\nBoth ADD PERIOD and DROP PERIOD clauses include an option to handle whether\nthe period already exists:\n\nALTER TABLE rooms ADD PERIOD IF NOT EXISTS FOR p(checkin,checkout);\n\nALTER TABLE rooms DROP PERIOD IF EXISTS FOR p;\n\nDeletion by Portion\n-------------------\n\nYou can also remove rows that fall within certain time periods.\n\nWhen MariaDB executes a DELETE FOR PORTION statement, it removes the row:\n\n* When the row period falls completely within the delete period, it removes\nthe row.\n* When the row period overlaps the delete period, it shrinks the row, removing\nthe overlap from the first or second row period value.\n* When the delete period falls completely within the row period, it splits the\nrow into two rows. The first row runs from the starting row period to the\nstarting delete period. The second runs from the ending delete period to the\nending row period.\n\nTo test this, first populate the table with some data to operate on:\n\nCREATE TABLE t1(\n name VARCHAR(50),\n date_1 DATE,\n date_2 DATE,\n PERIOD FOR date_period(date_1, date_2));\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n (\'a\', \'1999-01-01\', \'2000-01-01\'),\n (\'b\', \'1999-01-01\', \'2018-12-12\'),\n (\'c\', \'1999-01-01\', \'2017-01-01\'),\n (\'d\', \'2017-01-01\', \'2019-01-01\');\n\nSELECT * FROM t1;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2017-01-01 |\n| d | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nThen, run the DELETE FOR PORTION statement:\n\nDELETE FROM t1\nFOR PORTION OF date_period\n FROM \'2001-01-01\' TO \'2018-01-01\';\nQuery OK, 3 rows affected (0.028 sec)\n\nSELECT * FROM t1 ORDER BY name;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2001-01-01 |\n| b | 2018-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2001-01-01 |\n| d | 2018-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nHere:\n\n* a is unchanged, as the range falls entirely out of the specified portion to\nbe deleted.\n* b, with values ranging from 1999 to 2018, is split into two rows, 1999 to\n2000 and 2018-01 to 2018-12.\n* c, with values ranging from 1999 to 2017, where only the upper value falls\nwithin the portion to be deleted, has been shrunk to 1999 to 2001.\n* d, with values ranging from 2017 to 2019, where only the lower value falls\nwithin the portion to be deleted, has been shrunk to 2018 to 2019.\n\nThe DELETE FOR PORTION statement has the following restrictions\n\n* The FROM...TO clause must be constant\n* Multi-delete is not supported\n\nIf there are DELETE or INSERT triggers, it works as follows: any matched row\nis deleted, and then one or two rows are inserted. If the record is deleted\ncompletely, nothing is inserted.\n\nUpdating by Portion\n-------------------\n\nThe UPDATE syntax now supports UPDATE FOR PORTION, which modifies rows based\non their occurrence in a range:\n\nTo test it, first populate the table with some data:\n\nTRUNCATE t1;\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n (\'a\', \'1999-01-01\', \'2000-01-01\'),\n (\'b\', \'1999-01-01\', \'2018-12-12\'),\n (\'c\', \'1999-01-01\', \'2017-01-01\'),\n (\'d\', \'2017-01-01\', \'2019-01-01\');\n\nSELECT * FROM t1;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2017-01-01 |\n| d | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nThen run the update:\n\nUPDATE t1 FOR PORTION OF date_period\n FROM \'2000-01-01\' TO \'2018-01-01\'\nSET name = CONCAT(name,\'_original\');\n\nSELECT * FROM t1 ORDER BY name;\n+------------+------------+------------+\n| name | date_1 | date_2 |\n+------------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2000-01-01 |\n| b | 2018-01-01 | 2018-12-12 |\n| b_original | 2000-01-01 | 2018-01-01 |\n| c | 1999-01-01 | 2000-01-01 |\n| c_original | 2000-01-01 | 2017-01-01 |\n| d | 2018-01-01 | 2019-01-01 |\n| d_original | 2017-01-01 | 2018-01-01 |\n+------------+------------+------------+\n\n* a is unchanged, as the range falls entirely out of the specified portion to\nbe deleted.\n* b, with values ranging from 1999 to 2018, is split into two rows, 1999 to\n2000 and 2018-01 to 2018-12.\n* c, with values ranging from 1999 to 2017, where only the upper value falls\nwithin the portion to be deleted, has been shrunk to 1999 to 2001.\n* d, with values ranging from 2017 to 2019, where only the lower value falls\nwithin the portion to be deleted, has been shrunk to 2018 to 2019. \n* Original rows affected by the update have \"_original\" appended to the name.\n\nThe UPDATE FOR PORTION statement has the following limitations:\n\n* The operation cannot modify the two temporal columns used by the time period\n* The operation cannot reference period values in the SET expression\n* FROM...TO expressions must be constant\n\nWITHOUT OVERLAPS\n----------------\n\nMariaDB starting with 10.5.3\n----------------------------\nMariaDB 10.5 introduced a new clause, WITHOUT OVERLAPS, which allows one to\ncreate an index specifying that application time periods should not overlap.\n\nAn index constrained by WITHOUT OVERLAPS is required to be either a primary\nkey or a unique index.\n\nTake the following example, an application time period table for a booking\nsystem:\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout)\n );\n\nINSERT INTO rooms VALUES \n (1, \'Regina\', \'2020-10-01\', \'2020-10-03\'),\n (2, \'Cochise\', \'2020-10-02\', \'2020-10-05\'),\n (1, \'Nowell\', \'2020-10-03\', \'2020-10-07\'),\n (2, \'Eusebius\', \'2020-10-04\', \'2020-10-06\');\n\nOur system is not intended to permit overlapping bookings, so the fourth\nrecord above should not have been inserted. Using WITHOUT OVERLAPS in a unique\nindex (in this case based on a combination of room number and the application\ntime period) allows us to specify this constraint in the table definition.\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout),\n UNIQUE (room_number, p WITHOUT OVERLAPS)\n );\n\nINSERT INTO rooms VALUES \n (1, \'Regina\', \'2020-10-01\', \'2020-10-03\'),\n (2, \'Cochise\', \'2020-10-02\', \'2020-10-05\'),\n (1, \'Nowell\', \'2020-10-03\', \'2020-10-07\'),\n (2, \'Eusebius\', \'2020-10-04\', \'2020-10-06\');\nERROR 1062 (23000): Duplicate entry \'2-2020-10-06-2020-10-04\' for key\n\'room_number\'\n\nFurther Examples\n----------------\n\nThe implicit change from NULL to NOT NULL:\n\nCREATE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime DEFAULT NULL,\n `d2` datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\n\nSHOW CREATE TABLE t2\\G\n*************************** 1. row ***************************\n Table: t2\nCreate Table: CREATE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime NOT NULL,\n `d2` datetime NOT NULL,\n PERIOD FOR `p` (`d1`, `d2`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nDue to this constraint, trying to add a time period where null data already\nexists will fail.\n\nCREATE OR REPLACE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime DEFAULT NULL,\n `d2` datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nINSERT INTO t2(id) VALUES(1);\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\nERROR 1265 (01000): Data truncated for column \'d1\' at row 1\n\nURL: https://mariadb.com/kb/en/application-time-periods/','','https://mariadb.com/kb/en/application-time-periods/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (805,45,'Bitemporal Tables','MariaDB starting with 10.4.3\n----------------------------\nBitemporal tables are tables that use versioning both at the system and\napplication-time period levels.\n\nUsing Bitemporal Tables\n-----------------------\n\nTo create a bitemporal table, use:\n\nCREATE TABLE test.t3 (\n date_1 DATE,\n date_2 DATE,\n row_start TIMESTAMP(6) AS ROW START INVISIBLE,\n row_end TIMESTAMP(6) AS ROW END INVISIBLE,\n PERIOD FOR application_time(date_1, date_2),\n PERIOD FOR system_time(row_start, row_end))\nWITH SYSTEM VERSIONING;\n\nNote that, while system_time here is also a time period, it cannot be used in\nDELETE FOR PORTION or UPDATE FOR PORTION statements.\n\nDELETE FROM test.t3 \nFOR PORTION OF system_time \n FROM \'2000-01-01\' TO \'2018-01-01\';\nERROR 42000: You have an error in your SQL syntax; check the manual that\ncorresponds \n to your MariaDB server version for the right syntax to use near\n \'of system_time from \'2000-01-01\' to \'2018-01-01\'\' at line 1\n\nURL: https://mariadb.com/kb/en/bitemporal-tables/','','https://mariadb.com/kb/en/bitemporal-tables/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (806,46,'ST_AsGeoJSON','Syntax\n------\n\nST_AsGeoJSON(g[, max_decimals[, options]])\n\nDescription\n-----------\n\nReturns the given geometry g as a GeoJSON element. The optional max_decimals\nlimits the maximum number of decimals displayed.\n\nThe optional options flag can be set to 1 to add a bounding box to the output.\n\nExamples\n--------\n\nSELECT ST_AsGeoJSON(ST_GeomFromText(\'POINT(5.3 7.2)\'));\n+-------------------------------------------------+\n| ST_AsGeoJSON(ST_GeomFromText(\'POINT(5.3 7.2)\')) |\n+-------------------------------------------------+\n| {\"type\": \"Point\", \"coordinates\": [5.3, 7.2]} |\n+-------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/geojson-st_asgeojson/','','https://mariadb.com/kb/en/geojson-st_asgeojson/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (807,46,'ST_GeomFromGeoJSON','MariaDB starting with 10.2.4\n----------------------------\nST_GeomFromGeoJSON was added in MariaDB 10.2.4\n\nSyntax\n------\n\nST_GeomFromGeoJSON(g[, option])\n\nDescription\n-----------\n\nGiven a GeoJSON input g, returns a geometry object. The option specifies what\nto do if g contains geometries with coordinate dimensions higher than 2.\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| 1 | Return an error (the default) |\n+---------------------------+------------------------------------------------+\n| 2 - 4 | The document is accepted, but the coordinates |\n| | for higher coordinate dimensions are stripped |\n| | off. |\n+---------------------------+------------------------------------------------+\n\nNote that this function did not work correctly before MariaDB 10.2.8 - see\nMDEV-12180.\n\nExamples\n--------\n\nSET @j = \'{ \"type\": \"Point\", \"coordinates\": [5.3, 15.0]}\';\n\nSELECT ST_AsText(ST_GeomFromGeoJSON(@j));\n+-----------------------------------+\n| ST_AsText(ST_GeomFromGeoJSON(@j)) |\n+-----------------------------------+\n| POINT(5.3 15) |\n+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geomfromgeojson/','','https://mariadb.com/kb/en/st_geomfromgeojson/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (808,47,'Operator Precedence','The precedence is the order in which the SQL operators are evaluated.\n\nThe following list shows the SQL operator precedence. Operators that appear\nfirst in the list have a higher precedence. Operators which are listed\ntogether have the same precedence.\n\n* INTERVAL\n* BINARY, COLLATE\n* !\n* - (unary minus), [[bitwise-not|]] (unary bit inversion)\n* || (string concatenation)\n* ^\n* *, /, DIV, %, MOD\n* -, +\n* <<, >>\n* &\n* |\n* = (comparison), <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN\n* BETWEEN, CASE, WHEN, THEN, ELSE, END\n* NOT\n* &&, AND\n* XOR\n* || (logical or), OR\n* = (assignment), :=\n\nFunctions precedence is always higher than operators precedence.\n\nIn this page CASE refers to the CASE operator, not to the CASE statement.\n\nIf the HIGH_NOT_PRECEDENCE SQL_MODE is set, NOT has the same precedence as !.\n\nThe || operator\'s precedence, as well as its meaning, depends on the\nPIPES_AS_CONCAT SQL_MODE flag: if it is on, || can be used to concatenate\nstrings (like the CONCAT() function) and has a higher precedence.\n\nThe = operator\'s precedence depends on the context - it is higher when = is\nused as a comparison operator.\n\nParenthesis can be used to modify the operators precedence in an expression.\n\nShort-circuit evaluation\n------------------------\n\nThe AND, OR, && and || operators support short-circuit evaluation. This means\nthat, in some cases, the expression on the right of those operators is not\nevaluated, because its result cannot affect the result. In the following\ncases, short-circuit evaluation is used and x() is not evaluated:\n\n* FALSE AND x()\n* FALSE && x()\n* TRUE OR x()\n* TRUE || x()\n* NULL BETWEEN x() AND x()\n\nNote however that the short-circuit evaluation does not apply to NULL AND x().\nAlso, BETWEEN\'s right operands are not evaluated if the left operand is NULL,\nbut in all other cases all the operands are evaluated.\n\nThis is a speed optimization. Also, since functions can have side-effects,\nthis behavior can be used to choose whether execute them or not using a\nconcise syntax:\n\nSELECT some_function() OR log_error();\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 (809,48,'Addition Operator (+)','Syntax\n------\n\n+\n\nDescription\n-----------\n\nAddition.\n\nIf both operands are integers, the result is calculated with BIGINT precision.\nIf either integer is unsigned, the result is also an unsigned integer.\n\nFor real or string operands, the operand with the highest precision determines\nthe result precision.\n\nExamples\n--------\n\nSELECT 3+5;\n+-----+\n| 3+5 |\n+-----+\n| 8 |\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 (810,48,'Division Operator (/)','Syntax\n------\n\n/\n\nDescription\n-----------\n\nDivision operator. Dividing by zero will return NULL. By default, returns four\ndigits after the decimal. This is determined by the server system variable\ndiv_precision_increment which by default is four. It can be set from 0 to 30.\n\nDividing by zero returns NULL. If the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is\nused (the default since MariaDB 10.2.4), a division by zero also produces a\nwarning.\n\nExamples\n--------\n\nSELECT 4/5;\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| 300/7 |\n+---------+\n| 42.8571 |\n+---------+\n\nChanging div_precision_increment for the session from the default of four to\nsix:\n\nSET div_precision_increment = 6;\n\nSELECT 300/7;\n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n\nSELECT 300/7;\n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\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 (811,48,'Modulo Operator (%)','Syntax\n------\n\nN % M\n\nDescription\n-----------\n\nModulo operator. Returns the remainder of N divided by M. See also MOD.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\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 (812,48,'Multiplication Operator (*)','Syntax\n------\n\n*\n\nDescription\n-----------\n\nMultiplication operator.\n\nExamples\n--------\n\nSELECT 7*6;\n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n\nSELECT 1234567890*9876543210;\n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n\nSELECT 18014398509481984*18014398509481984.0;\n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n\nSELECT 18014398509481984*18014398509481984;\n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\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 (813,48,'Subtraction Operator (-)','Syntax\n------\n\n-\n\nDescription\n-----------\n\nSubtraction. The operator is also used as the unary minus for changing sign.\n\nIf both operands are integers, the result is calculated with BIGINT precision.\nIf either integer is unsigned, the result is also an unsigned integer, unless\nthe NO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case the result is\nalways signed.\n\nFor real or string operands, the operand with the highest precision determines\nthe result precision.\n\nExamples\n--------\n\nSELECT 96-9;\n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n\nSELECT 15-17;\n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n\nSELECT 3.66 + 1.333;\n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n\nUnary minus:\n\nSELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\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 (814,49,'CHANGE MASTER TO','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nCHANGE MASTER [\'connection_name\'] TO master_def [, master_def] ... \n [FOR CHANNEL \'channel_name\']\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 | MASTER_DEMOTE_TO_SLAVE = bool\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n\nDescription\n-----------\n\nThe CHANGE MASTER statement sets the options that a replica uses to connect to\nand replicate from a primary.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nto using the channel_name directly after CHANGE MASTER.\n\nMulti-Source Replication\n------------------------\n\nIf you are using multi-source replication, then you need to specify a\nconnection name when you execute CHANGE MASTER. There are two ways to do this:\n\n* Setting the default_master_connection system variable prior to executing\nCHANGE MASTER.\n* Setting the connection_name parameter when executing CHANGE MASTER.\n\ndefault_master_connection\n-------------------------\n\nSET default_master_connection = \'gandalf\';\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nconnection_name\n---------------\n\nSTOP SLAVE \'gandalf\';\nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE \'gandalf\';\n\nOptions\n-------\n\nConnection Options\n------------------\n\nMASTER_USER\n-----------\n\nThe MASTER_USER option for CHANGE MASTER defines the user account that the\nreplica will use to connect to the primary.\n\nThis user account will need the REPLICATION SLAVE privilege (or, from MariaDB\n10.5.1, the REPLICATION REPLICA on the primary.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_USER string is 96 characters until MariaDB\n10.5, and 128 characters from MariaDB 10.6.\n\nMASTER_PASSWORD\n---------------\n\nThe MASTER_USER option for CHANGE MASTER defines the password that the replica\nwill use to connect to the primary as the user account defined by the\nMASTER_USER option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_PASSWORD string is 32 characters.\n\nMASTER_HOST\n-----------\n\nThe MASTER_HOST option for CHANGE MASTER defines the hostname or IP address of\nthe primary.\n\nIf you set the value of the MASTER_HOST option to the empty string, then that\nis not the same as not setting the option\'s value at all. If you set the value\nof the MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwill fail with an error. In MariaDB 5.3 and before, if you set the value of\nthe MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwould succeed, but the subsequent START SLAVE command would fail.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nIf you set the value of the MASTER_HOST option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nThe maximum length of the MASTER_HOST string is 60 characters until MariaDB\n10.5, and 255 characters from MariaDB 10.6.\n\nMASTER_PORT\n-----------\n\nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP port of the\nprimary.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nIf you set the value of the MASTER_PORT option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nMASTER_CONNECT_RETRY\n--------------------\n\nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines how many seconds\nthat the replica will wait between connection retries. The default is 60.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\nSTART SLAVE;\n\nThe number of connection attempts is limited by the master_retry_count option.\nIt can be set either on the command-line or in a server option group in an\noption file prior to starting up the server. For example:\n\n[mariadb]\n...\nmaster_retry_count=4294967295\n\nMASTER_BIND\n-----------\n\nThe MASTER_BIND option for CHANGE MASTER is only supported by MySQL 5.6.2 and\nlater and by MySQL NDB Cluster 7.3.1 and later. This option is not supported\nby MariaDB. See MDEV-19248 for more information.\n\nThe MASTER_BIND option for CHANGE MASTER can be used on replicas that have\nmultiple network interfaces to choose which network interface the replica will\nuse to connect to the primary.\n\nMASTER_HEARTBEAT_PERIOD\n-----------------------\n\nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be used to set the\ninterval in seconds between replication heartbeats. Whenever the primary\'s\nbinary log is updated with an event, the waiting period for the next heartbeat\nis reset.\n\nThis option\'s interval argument has the following characteristics:\n\n* It is a decimal value with a range of 0 to 4294967 seconds.\n* It has a resolution of hundredths of a second.\n* Its smallest valid non-zero value is 0.001.\n* Its default value is the value of the slave_net_timeout system variable\ndivided by 2.\n* If it\'s set to 0, then heartbeats are disabled.\n\nHeartbeats are sent by the primary only if there are no unsent events in the\nbinary log file for a period longer than the interval.\n\nIf the RESET SLAVE statement is executed, then the heartbeat interval is reset\nto the default.\n\nIf the slave_net_timeout system variable is set to a value that is lower than\nthe current heartbeat interval, then a warning will be issued.\n\nTLS Options\n-----------\n\nThe TLS options are used for providing information about TLS. The options can\nbe set even on replicas that are compiled without TLS support. The TLS options\nare saved to either the default master.info file or the file that is\nconfigured by the master_info_file option, but these TLS options are ignored\nunless the replica supports TLS.\n\nSee Replication with Secure Connections for more information.\n\nMASTER_SSL\n----------\n\nThe MASTER_SSL option for CHANGE MASTER tells the replica whether to force TLS\nfor the connection. The valid values are 0 or 1.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL=1;\nSTART SLAVE;\n\nMASTER_SSL_CA\n-------------\n\nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more X509 certificates for trusted Certificate\nAuthorities (CAs) to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA string is 511 characters.\n\nMASTER_SSL_CAPATH\n-----------------\n\nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one X509\ncertificate for a trusted Certificate Authority (CA) to use for TLS. This\noption requires that you use the absolute path, not a relative path. The\ndirectory specified by this option needs to be run through the openssl rehash\ncommand. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA_PATH string is 511 characters.\n\nMASTER_SSL_CERT\n---------------\n\nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path to the X509\ncertificate file to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CERT string is 511 characters.\n\nMASTER_SSL_CRL\n--------------\n\nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more revoked X509 certificates to use for TLS. This\noption requires that you use the absolute path, not a relative path.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\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\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL string is 511 characters.\n\nMASTER_SSL_CRLPATH\n------------------\n\nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one revoked X509\ncertificate to use for TLS. This option requires that you use the absolute\npath, not a relative path. The directory specified by this variable needs to\nbe run through the openssl rehash command.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\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/\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL_PATH string is 511 characters.\n\nMASTER_SSL_KEY\n--------------\n\nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path to a private key\nfile to use for TLS. This option requires that you use the absolute path, not\na relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_KEY string is 511 characters.\n\nMASTER_SSL_CIPHER\n-----------------\n\nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the list of permitted\nciphers or cipher suites to use for TLS. Besides cipher names, if MariaDB was','','https://mariadb.com/kb/en/change-master-to/');
-update help_topic set description = CONCAT(description, '\ncompiled with OpenSSL, this option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot\nbe excluded when using OpenSSL, even by using this option. See Using TLSv1.3\nfor details. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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\';\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CIPHER string is 511 characters.\n\nMASTER_SSL_VERIFY_SERVER_CERT\n-----------------------------\n\nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER enables server\ncertificate verification. This option is disabled by default.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Server Certificate Verification for more\ninformation.\n\nBinary Log Options\n------------------\n\nThese options are related to the binary log position on the primary.\n\nMASTER_LOG_FILE\n---------------\n\nThe MASTER_LOG_FILE option for CHANGE MASTER can be used along with\nMASTER_LOG_POS to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nMASTER_LOG_POS\n--------------\n\nThe MASTER_LOG_POS option for CHANGE MASTER can be used along with\nMASTER_LOG_FILE to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nRelay Log Options\n-----------------\n\nThese options are related to the relay log position on the replica.\n\nRELAY_LOG_FILE\n--------------\n\nThe RELAY_LOG_FILE option for CHANGE MASTER can be used along with the\nRELAY_LOG_POS option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nRELAY_LOG_POS\n-------------\n\nThe RELAY_LOG_POS option for CHANGE MASTER can be used along with the\nRELAY_LOG_FILE option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nGTID Options\n------------\n\nMASTER_USE_GTID\n---------------\n\nThe MASTER_USE_GTID option for CHANGE MASTER can be used to configure the\nreplica to use the global transaction ID (GTID) when connecting to a primary.\nThe possible values are:\n\n* current_pos - Replicate in GTID mode and use gtid_current_pos as the\nposition to start downloading transactions from the primary. Deprecated from\nMariaDB 10.10. Using to transition to primary can break the replication state\nif the replica executes local transactions due to actively updating\ngtid_current_pos with gtid_binlog_pos and gtid_slave_pos. Use the new, safe,\nMASTER_DEMOTE_TO_SLAVE=<bool> option instead.\n* slave_pos - Replicate in GTID mode and use gtid_slave_pos as the position to\nstart downloading transactions from the primary. From MariaDB 10.5.1,\nreplica_pos is an alias for slave_pos.\n* no - Don\'t replicate in GTID mode.\n\nMASTER_DEMOTE_TO_SLAVE\n----------------------\n\nMariaDB starting with 10.10\n---------------------------\nUsed to transition a primary to become a replica. Replaces the old\nMASTER_USE_GTID=current_pos with a safe alternative by forcing users to set\nUsing_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once at\nCHANGE MASTER TO time. If gtid_slave_pos is more recent than gtid_binlog_pos\n(as in the case of chain replication), the replication state should be\npreserved.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\nSTART SLAVE;\n\nOr:\n\nSTOP SLAVE;\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID = slave_pos;\nSTART SLAVE;\n\nReplication Filter Options\n--------------------------\n\nAlso see Replication filters.\n\nIGNORE_SERVER_IDS\n-----------------\n\nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events that originated from certain servers.\nFiltered binary log events will not get logged to the replica’s relay log, and\nthey will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\nserver_id values. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n\nDO_DOMAIN_IDS\n-------------\n\nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica\nto only apply binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the DO_DOMAIN_IDS\noption, and the IGNORE_DOMAIN_IDS option was previously set, then you need to\nclear the value of the IGNORE_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\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 replica is replicating\nin GTID mode. Therefore, the MASTER_USE_GTID option must also be set to some\nvalue other than no in order to use this option.\n\nIGNORE_DOMAIN_IDS\n-----------------\n\nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the IGNORE_DOMAIN_IDS\noption, and the DO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\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 replica is\nreplicating in GTID mode. Therefore, the MASTER_USE_GTID option must also be\nset to some value other than no in order to use this option.\n\nDelayed Replication Options\n---------------------------\n\nMASTER_DELAY\n------------\n\nThe MASTER_DELAY option for CHANGE MASTER can be used to enable delayed\nreplication. This option specifies the time in seconds (at least) that a\nreplica should lag behind the primary up to a maximum value of 2147483647, or\nabout 68 years. Before executing an event, the replica will first wait, if\nnecessary, until the given time has passed since the event was created on the\nprimary. The result is that the replica will reflect the state of the primary\nsome time back in the past. The default is zero, no delay.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_DELAY=3600;\nSTART SLAVE;\n\nChanging Option Values\n----------------------\n\nIf you don\'t specify a given option when executing the CHANGE MASTER\nstatement, then the option keeps its old value in most cases. Most of the\ntime, there is no need to specify the options that do not need to change. For\nexample, if the password for the user account that the replica uses to connect\nto its primary has changed, but no other options need to change, then you can\njust change the MASTER_PASSWORD option by executing the following commands:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThere are some cases where options are implicitly reset, such as when the\nMASTER_HOST and MASTER_PORT options are changed.\n\nOption Persistence\n------------------\n\nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options (i.e. the binary\nlog position on the primary) and most other options are written to either the\ndefault master.info file or the file that is configured by the\nmaster_info_file option. The replica\'s I/O thread keeps this binary log\nposition updated as it downloads events only when MASTER_USE_GTID option is\nset to NO. Otherwise the file is not updated on a per event basis.\n\nThe master_info_file option can be set either on the command-line or in a\nserver option group in an option file prior to starting up the server. For\nexample:\n\n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n\nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options (i.e. the relay log\nposition) are written to either the default relay-log.info file or the file\nthat is configured by the relay_log_info_file system variable. The replica\'s\nSQL thread keeps this relay log position updated as it applies events.\n\nThe relay_log_info_file system variable can be set either on the command-line\nor in a server option group in an option file prior to starting up the server.\nFor example:\n\n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n\nGTID Persistence\n----------------\n\nIf the replica is replicating binary log events that contain GTIDs, then the\nreplica\'s SQL thread will write every GTID that it applies to the\nmysql.gtid_slave_pos table. This GTID can be inspected and modified through\nthe gtid_slave_pos system variable.\n\nIf the replica has the log_slave_updates system variable enabled and if the\nreplica has the binary log enabled, then every write by the replica\'s SQL\nthread will also go into the replica\'s binary log. This means that GTIDs of\nreplicated transactions would be reflected in the value of the gtid_binlog_pos\nsystem variable.\n\nCreating a Replica from a Backup\n--------------------------------\n\nThe CHANGE MASTER statement is useful for setting up a replica when you have a\nbackup of the primary and you also have the binary log position or GTID\nposition corresponding to the backup.\n\nAfter restoring the backup on the replica, you could execute something like\nthis to use the binary log position:\n\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nOr you could execute something like this to use the GTID position:\n\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nSee Setting up a Replication Slave with Mariabackup for more information on\nhow to do this with Mariabackup.\n\nExample') WHERE help_topic_id = 814;
-update help_topic set description = CONCAT(description, '\n-------\n\nThe following example changes the primary and primary\'s binary log\ncoordinates. This is used when you want to set up the replica to replicate the\nprimary:\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;\nSTART SLAVE;\n\nURL: https://mariadb.com/kb/en/change-master-to/') WHERE help_topic_id = 814;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (815,49,'START SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTART SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR\nCHANNEL \"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> [FOR CHANNEL \"connection_name\"]\nSTART ALL SLAVES [thread_type [, thread_type]]\n\nSTART REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> -- from 10.5.1\nSTART ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nSTART SLAVE (START REPLICA from MariaDB 10.5.1) with no thread_type options\nstarts both of the replica threads (see replication). The I/O thread reads\nevents from the primary server and stores them in the relay log. The SQL\nthread reads events from the relay log and executes them. START SLAVE requires\nthe SUPER privilege, or, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN\nprivilege.\n\nIf START SLAVE succeeds in starting the replica threads, it returns without\nany error. However, even in that case, it might be that the replica threads\nstart and then later stop (for example, because they do not manage to connect\nto the primary or read its binary log, or some other problem). START SLAVE\ndoes not warn you about this. You must check the replica\'s error log for error\nmessages generated by the replica threads, or check that they are running\nsatisfactorily with SHOW SLAVE STATUS (SHOW REPLICA STATUS from MariaDB\n10.5.1).\n\nSTART SLAVE UNTIL\n-----------------\n\nSTART SLAVE UNTIL refers to the SQL_THREAD replica position at which the\nSQL_THREAD replication will halt. If SQL_THREAD isn\'t specified both threads\nare started.\n\nSTART SLAVE UNTIL master_gtid_pos=xxx is also supported. See Global\nTransaction ID/START SLAVE UNTIL master_gtid_pos=xxx for more details.\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the START SLAVE statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after START SLAVE.\n\nSTART ALL SLAVES\n----------------\n\nSTART ALL SLAVES starts all configured replicas (replicas with master_host not\nempty) that were not started before. It will give a note for all started\nconnections. You can check the notes with SHOW WARNINGS.\n\nSTART REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTART REPLICA is an alias for START SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/start-replica/','','https://mariadb.com/kb/en/start-replica/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (816,49,'STOP SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTOP SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR CHANNEL\n\"connection_name\"]\n\nSTOP ALL SLAVES [thread_type [, thread_type]]\n\nSTOP REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\n\nSTOP ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nStops the replica threads. STOP SLAVE requires the SUPER privilege, or, from\nMariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and SQL_THREAD\noptions to name the thread or threads to be stopped. In almost all cases, one\nnever need to use the thread_type options.\n\nSTOP SLAVE waits until any current replication event group affecting one or\nmore non-transactional tables has finished executing (if there is any such\nreplication group), or until the user issues a KILL QUERY or KILL CONNECTION\nstatement.\n\nNote that STOP SLAVE doesn\'t delete the connection permanently. Next time you\nexecute START SLAVE or the MariaDB server restarts, the replica connection is\nrestored with it\'s original arguments. If you want to delete a connection, you\nshould execute RESET SLAVE.\n\nSTOP ALL SLAVES\n---------------\n\nSTOP ALL SLAVES stops all your running replicas. It will give you a note for\nevery stopped connection. You can check the notes with SHOW WARNINGS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless master, or the default master (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after STOP SLAVE.\n\nSTOP REPLICA\n------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTOP REPLICA is an alias for STOP SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/stop-replica/','','https://mariadb.com/kb/en/stop-replica/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (817,49,'RESET REPLICA/SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nRESET REPLICA [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"] --\nfrom MariaDB 10.5.1 \nRESET SLAVE [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"]\n\nDescription\n-----------\n\nRESET REPLICA/SLAVE makes the replica forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean start. It\ndeletes the master.info and relay-log.info files, all the relay log files, and\nstarts a new relay log file. To use RESET REPLICA/SLAVE, the replica threads\nmust be stopped (use STOP REPLICA/SLAVE if necessary).\n\nNote: All relay log files are deleted, even if they have not been completely\nexecuted by the slave SQL thread. (This is a condition likely to exist on a\nreplication slave if you have issued a STOP REPLICA/SLAVE statement or if the\nslave is highly loaded.)\n\nNote: RESET REPLICA does not reset the global gtid_slave_pos variable. This\nmeans that a replica server configured with CHANGE MASTER TO\nMASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring before\nthe state saved in gtid_slave_pos. If the intent is to reprocess these events,\ngtid_slave_pos must be manually reset, e.g. by executing set global\ngtid_slave_pos=\"\".\n\nConnection information stored in the master.info file is immediately reset\nusing any values specified in the corresponding startup options. This\ninformation includes values such as master host, master port, master user, and\nmaster password. If the replica SQL thread was in the middle of replicating\ntemporary tables when it was stopped, and RESET REPLICA/SLAVE is issued, these\nreplicated temporary tables are deleted on the slave.\n\nThe ALL also resets the PORT, HOST, USER and PASSWORD parameters for the\nslave. If you are using a connection name, it will permanently delete it and\nit will not show up anymore in SHOW ALL REPLICAS/SLAVE STATUS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the RESET REPLICA/SLAVE statement will apply to\nthe specified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after RESET REPLICA.\n\nRESET REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nRESET REPLICA is an alias for RESET SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/reset-replica/','','https://mariadb.com/kb/en/reset-replica/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (818,49,'RESET MASTER','RESET MASTER [TO #]\n\nDeletes all binary log files listed in the index file, resets the binary log\nindex file to be empty, and creates a new binary log file with a suffix of\n.000001.\n\nIf TO # is given, then the first new binary log file will start from number #.\n\nThis statement is for use only when the master is started for the first time,\nand should never be used if any slaves are actively replicating from the\nbinary log.\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 (819,50,'EXECUTE Statement','Syntax\n------\n\nEXECUTE stmt_name\n [USING expression[, expression] ...]\n\nMariaDB starting with 10.2.3\n----------------------------\nEXECUTE with expression as parameters was introduced in MariaDB 10.2.3. Before\nthat one could only use variables (@var_name) as parameters.\n\nDescription\n-----------\n\nAfter preparing a statement with PREPARE, you execute it with an EXECUTE\nstatement that refers to the prepared statement name. If the prepared\nstatement contains any parameter markers, you must supply a USING clause that\nlists user variables containing the values to be bound to the parameters.\nParameter values can be supplied only by user variables, and the USING clause\nmust name exactly as many variables as the number of parameter markers in the\nstatement.\n\nYou can execute a given prepared statement multiple times, passing different\nvariables to it or setting the variables to different values before each\nexecution.\n\nIf the specified statement has not been PREPAREd, an error similar to the\nfollowing is produced:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nEXECUTE\n\nExample\n-------\n\nSee example in PREPARE.\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 (820,50,'PREPARE Statement','Syntax\n------\n\nPREPARE stmt_name FROM preparable_stmt\n\nDescription\n-----------\n\nThe PREPARE statement prepares a statement and assigns it a name, stmt_name,\nby which to refer to the statement later. Statement names are not case\nsensitive. preparable_stmt is either a string literal or a user variable (not\na local variable, an SQL expression or a subquery) that contains the text of\nthe statement. The text must represent a single SQL statement, not multiple\nstatements. Within the statement, \"?\" characters can be used as parameter\nmarkers to indicate where data values are to be bound to the query later when\nyou execute it. The \"?\" characters should not be enclosed within quotes, even\nif you intend to bind them to string values. Parameter markers can be used\nonly where expressions should appear, not for SQL keywords, identifiers, and\nso forth.\n\nThe scope of a prepared statement is the session within which it is created.\nOther sessions cannot see it.\n\nIf a prepared statement with the given name already exists, it is deallocated\nimplicitly before the new statement is prepared. This means that if the new\nstatement contains an error and cannot be prepared, an error is returned and\nno statement with the given name exists.\n\nPrepared statements can be PREPAREd and EXECUTEd in a stored procedure, but\nnot in a stored function or trigger. Also, even if the statement is PREPAREd\nin a procedure, it will not be deallocated when the procedure execution ends.\n\nA prepared statement can access user-defined variables, but not local\nvariables or procedure\'s parameters.\n\nIf the prepared statement contains a syntax error, PREPARE will fail. As a\nside effect, stored procedures can use it to check if a statement is valid.\nFor 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 immediatly after\nEXECUTE, return the number of rows read or affected by the prepared\nstatements; however, if they are called after DEALLOCATE PREPARE, they provide\ninformation about this statement. If the prepared statement produces errors or\nwarnings, GET DIAGNOSTICS return information about them. DEALLOCATE PREPARE\nshouldn\'t clear the diagnostics area, unless it produces an error.\n\nA prepared statement is executed with EXECUTE and released with DEALLOCATE\nPREPARE.\n\nThe max_prepared_stmt_count server system variable determines the number of\nallowed prepared statements that can be prepared on the server. If it is set\nto 0, prepared statements are not allowed. If the limit is reached, an error\nsimilar to the following will be produced:\n\nERROR 1461 (42000): Can\'t create more than max_prepared_stmt_count statements \n (current value: 0)\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, PREPARE stmt FROM \'SELECT :1, :2\' is used,\ninstead of ?.\n\nPermitted Statements\n--------------------\n\nMariaDB starting with 10.6.2\n----------------------------\nAll statements can be prepared, except PREPARE, EXECUTE, and DEALLOCATE / DROP\nPREPARE.\n\nPrior to this, not all statements can be prepared. Only the following SQL\ncommands are permitted:\n\n* ALTER TABLE\n* ANALYZE TABLE\n* BINLOG\n* CACHE INDEX\n* CALL\n* CHANGE MASTER\n* CHECKSUM {TABLE | TABLES}\n* COMMIT\n* {CREATE | DROP} DATABASE\n* {CREATE | DROP} INDEX\n* {CREATE | RENAME | DROP} TABLE\n* {CREATE | RENAME | DROP} USER\n* {CREATE | DROP} VIEW\n* DELETE\n* DESCRIBE\n* DO\n* EXPLAIN\n* FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES | LOGS |\nSTATUS | \n MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY CACHE |\nTABLE_STATISTICS | \n INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\n* GRANT\n* INSERT\n* INSTALL {PLUGIN | SONAME}\n* HANDLER READ\n* KILL\n* LOAD INDEX INTO CACHE\n* OPTIMIZE TABLE\n* REPAIR TABLE\n* REPLACE\n* RESET {MASTER | SLAVE | QUERY CACHE}\n* REVOKE\n* ROLLBACK\n* SELECT\n* SET\n* SET GLOBAL SQL_SLAVE_SKIP_COUNTER\n* SET ROLE\n* SET SQL_LOG_BIN\n* SET TRANSACTION ISOLATION LEVEL\n* SHOW EXPLAIN\n* SHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS | COLUMNS | INDEX |\nTRIGGERS | \n EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES | PLUGINS [SONAME] |\nPRIVILEGES | \n PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS | WARNINGS | ERRORS |\n TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS |\nAUTHORS | \n CONTRIBUTORS}\n* SHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION | TRIGGER |\nEVENT}\n* SHOW {FUNCTION | PROCEDURE} CODE\n* SHOW BINLOG EVENTS\n* SHOW SLAVE HOSTS\n* SHOW {MASTER | BINARY} LOGS\n* SHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION | PROCEDURE} STATUS\n* SLAVE {START | STOP}\n* TRUNCATE TABLE\n* SHUTDOWN\n* UNINSTALL {PLUGIN | SONAME}\n* UPDATE\n\nSynonyms are not listed here, but can be used. For example, DESC can be used\ninstead of DESCRIBE.\n\nCompound statements can be prepared too.\n\nNote that if a statement can be run in a stored routine, it will work even if\nit is called by a prepared statement. For example, SIGNAL can\'t be directly\nprepared. However, it is allowed in stored routines. If the x() procedure\ncontains SIGNAL, you can still prepare and execute the \'CALL x();\' prepared\nstatement.\n\nPREPARE supports most kinds of expressions as well, for example:\n\nPREPARE stmt FROM CONCAT(\'SELECT * FROM \', table_name);\n\nWhen PREPARE is used with a statement which is not supported, the following\nerror is produced:\n\nERROR 1295 (HY000): This command is not supported in the prepared statement\nprotocol yet\n\nExample\n-------\n\ncreate table t1 (a int,b char(10));\ninsert into t1 values (1,\"one\"),(2, \"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 parameters,\nsometimes it is necessary to dynamically compose an SQL statement. This\ntechnique is called dynamic SQL). The following example shows how to use\ndynamic 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\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 (821,50,'DEALLOCATE / DROP PREPARE','Syntax\n------\n\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nDescription\n-----------\n\nTo deallocate a prepared statement produced with PREPARE, use a DEALLOCATE\nPREPARE statement that refers to the prepared statement name.\n\nA prepared statement is implicitly deallocated when a new PREPARE command is\nissued. In that case, there is no need to use DEALLOCATE.\n\nAttempting to execute a prepared statement after deallocating it results in an\nerror, as if it was not prepared at all:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nEXECUTE\n\nIf the specified statement has not been PREPAREd, an error similar to the\nfollowing will be produced:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nDEALLOCATE PREPARE\n\nExample\n-------\n\nSee example in PREPARE.\n\nURL: https://mariadb.com/kb/en/deallocate-drop-prepare/','','https://mariadb.com/kb/en/deallocate-drop-prepare/');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (822,50,'EXECUTE IMMEDIATE','MariaDB starting with 10.2.3\n----------------------------\nEXECUTE IMMEDIATE was introduced in MariaDB 10.2.3.\n\nSyntax\n------\n\nEXECUTE IMMEDIATE statement\n\nDescription\n-----------\n\nEXECUTE IMMEDIATE executes a dynamic SQL statement created on the fly, which\ncan reduce performance overhead.\n\nFor example:\n\nEXECUTE IMMEDIATE \'SELECT 1\'\n\nwhich is shorthand for:\n\nprepare stmt from \"select 1\";\nexecute stmt;\ndeallocate prepare stmt;\n\nEXECUTE IMMEDIATE supports complex expressions as prepare source and\nparameters:\n\nEXECUTE IMMEDIATE CONCAT(\'SELECT COUNT(*) FROM \', \'t1\', \' WHERE a=?\') USING\n5+5;\n\nLimitations: subselects and stored function calls are not supported as a\nprepare source.\n\nThe following examples return an error:\n\nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN \'SELECT * FROM t1\';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support subqueries or stored\nfunctions\n\nEXECUTE IMMEDIATE (SELECT \'SELECT * FROM t1\');\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat \n corresponds to your MariaDB server version for the right syntax 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 subqueries or stored\nfunctions\n\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING (SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat \n corresponds to your MariaDB server version for the right syntax 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 \'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 @param;\n\nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING @param;\n\nEXECUTE IMMEDIATE supports user variables and SP variables as 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 procedures but is\nnot allowed in stored functions.\n\nThis example uses EXECUTE IMMEDIATE inside a stored procedure:\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 function or trigger\n\nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as bind parameters:\n\nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING DEFAULT;\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 10 |\n+------+\n\nEXECUTE IMMEDIATE increments the Com_execute_immediate status variable, as\nwell as the Com_stmt_prepare, Com_stmt_execute and Com_stmt_close status\nvariables.\n\nNote, EXECUTE IMMEDIATE does not increment the Com_execute_sql status\nvariable. Com_execute_sql is used only for PREPARE..EXECUTE.\n\nThis session screenshot demonstrates how EXECUTE IMMEDIATE affects status\nvariables:\n\nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_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 VARIABLE_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\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 (287,23,'UUID Data Type','MariaDB starting with 10.7.0\n----------------------------\nThe UUID data type was added in a MariaDB 10.7.0 preview.\n\nSyntax\n------\n\nUUID\n\nDescription\n-----------\n\nThe UUID data type is intended for the storage of 128-bit UUID (Universally\nUnique Identifier) data. See the UUID function page for more details on UUIDs\nthemselves.\n\nRetrieval\n---------\n\nData retrieved by this data type is in the string representation defined in\nRFC4122.\n\nCasting\n-------\n\nString literals of hexadecimal characters and CHAR/VARCHAR/TEXT can be cast to\nthe UUID data type. Likewise hexadecimal literals, binary-literals, and\nBINARY/VARBINARY/BLOB types can also be cast to UUID.\n\nThe data type will not accept a short UUID generated with the UUID_SHORT\nfunction, but will accept a value without the - character generated by the\nSYS_GUID function (or inserted directly). Hyphens can be partially omitted as\nwell, or included after any group of two digits.\n\nThe type does not accept UUIDs in braces, permitted by some implementations.\n\nStorage\n-------\n\nUUID are stored in an index friendly manner, the order of a UUID of\nllllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn is stored as:\n\nnnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll\n\nThis provides a sorting order, if a UUIDv1 (node and timestamp) is used, of\nthe node, followed by the timestamp.\n\nExamples\n--------\n\nCREATE TABLE t1 (id UUID);\n\nDirectly Inserting via string literals:\n\nINSERT INTO t1 VALUES(\'123e4567-e89b-12d3-a456-426655440000\');\n\nDirectly Inserting via hexadecimal literals:\n\nINSERT INTO t1 VALUES (x\'fffffffffffffffffffffffffffffffe\');\n\nGenerating and inserting via the UUID function.\n\nINSERT INTO t1 VALUES (UUID());\n\nRetrieval:\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nThe UUID_SHORT function does not generate valid full-length UUID:\n\nINSERT INTO t1 VALUES (UUID_SHORT());\nERROR 1292 (22007): Incorrect uuid value: \'99440417627439104\' \n for column `test`.`t1`.`id` at row 1\n\nAccepting a value without the - character, either directly or generated by the\nSYS_GUID function:\n\nINSERT INTO t1 VALUES (SYS_GUID());\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n| ea0368d3-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nSELECT SYS_GUID();\n+----------------------------------+\n| SYS_GUID() |\n+----------------------------------+\n| ff5b6bcc1a1411ecab4ef859713e4be4 |\n+----------------------------------+\n\nINSERT INTO t1 VALUES (\'ff5b6bcc1a1411ecab4ef859713e4be4\');\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| 123e4567-e89b-12d3-a456-426655440000 |\n| ffffffff-ffff-ffff-ffff-fffffffffffe |\n| 93aac041-1a14-11ec-ab4e-f859713e4be4 |\n| ea0368d3-1a14-11ec-ab4e-f859713e4be4 |\n| ff5b6bcc-1a14-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nValid and invalid hyphen and brace usage:\n\nTRUNCATE t1;\n\nINSERT INTO t1 VALUES (\'f8aa-ed66-1a1b-11ec-ab4e-f859-713e-4be4\');\n\nINSERT INTO t1 VALUES (\'1b80667f1a1c-11ecab4ef859713e4be4\');\n\nINSERT INTO t1 VALUES (\'2fd6c945-1a-1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'49-c9-f9-59-1a-1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'57-96-da-c1-1a-1c-11-ec-ab-4e-f8-59-71-3e-4b-e4\');\n\nINSERT INTO t1 VALUES (\'6-eb74f8f-1a1c-11ec-ab4e-f859713e4be4\');\n\nINSERT INTO t1 VALUES (\'{29bad136-1a1d-11ec-ab4e-f859713e4be4}\');\nERROR 1292 (22007): Incorrect uuid value:\n\'{29bad136-1a1d-11ec-ab4e-f859713e4be4}\' \n for column `test`.`t1`.`id` at row 1\n\nSELECT * FROM t1;\n+--------------------------------------+\n| id |\n+--------------------------------------+\n| f8aaed66-1a1b-11ec-ab4e-f859713e4be4 |\n| 1b80667f-1a1c-11ec-ab4e-f859713e4be4 |\n| 2fd6c945-1a1c-11ec-ab4e-f859713e4be4 |\n| 49c9f959-1a1c-11ec-ab4e-f859713e4be4 |\n| 5796dac1-1a1c-11ec-ab4e-f859713e4be4 |\n| 6eb74f8f-1a1c-11ec-ab4e-f859713e4be4 |\n+--------------------------------------+\n\nURL: https://mariadb.com/kb/en/uuid-data-type/','','https://mariadb.com/kb/en/uuid-data-type/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (288,23,'DATE','Syntax\n------\n\nDATE\n\nDescription\n-----------\n\nA date. The supported range is \'1000-01-01\' to \'9999-12-31\'. MariaDB displays\nDATE values in \'YYYY-MM-DD\' format, but can be assigned dates in looser\nformats, including strings or numbers, as long as they make sense. These\ninclude a short year, YY-MM-DD, no delimiters, YYMMDD, or any other acceptable\ndelimiter, for example YYYY/MM/DD. For details, see date and time literals.\n\n\'0000-00-00\' is a permitted special value (zero-date), unless the NO_ZERO_DATE\nSQL_MODE is used. Also, individual components of a date can be set to 0 (for\nexample: \'2015-00-12\'), unless the NO_ZERO_IN_DATE SQL_MODE is used. In many\ncases, the result of en expression involving a zero-date, or a date with\nzero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the\nday part is in the range between 1 and 31, the date does not produce any\nerror, even for months that have less than 31 days.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATE);\n\nINSERT INTO t1 VALUES (\"2010-01-12\"), (\"2011-2-28\"), (\'120314\'),(\'13*04*21\');\n\nSELECT * FROM t1;\n+------------+\n| d |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\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 (289,23,'TIME','Syntax\n------\n\nTIME [(<microsecond precision>)]\n\nDescription\n-----------\n\nA time. The range is \'-838:59:59.999999\' to \'838:59:59.999999\'. Microsecond\nprecision can be from 0-6; if not specified 0 is used. Microseconds have been\navailable since MariaDB 5.3.\n\nMariaDB displays TIME values in \'HH:MM:SS.ssssss\' format, but allows\nassignment of times in looser formats, including \'D HH:MM:SS\', \'HH:MM:SS\',\n\'HH:MM\', \'D HH:MM\', \'D HH\', \'SS\', or \'HHMMSS\', as well as permitting dropping\nof any leading zeros when a delimiter is provided, for example \'3:9:10\'. For\ndetails, see date and time literals.\n\nMariaDB starting with 10.1.2\n----------------------------\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store TIMEs using the same low-level format MySQL 5.6\nuses.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace 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 the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_time\\G\n*************************** 1. row ***************************\n Table: mariadb5312_time\nCreate Table: CREATE TABLE `mariadb5312_time` (\n `t0` time /* mariadb-5.3 */ DEFAULT NULL,\n `t6` time(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nNote, columns with the current format are not marked with a comment.\n\nExamples\n--------\n\nINSERT INTO time VALUES (\'90:00:00\'), (\'800:00:00\'), (800), (22), (151413),\n(\'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\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 (290,23,'DATETIME','Syntax\n------\n\nDATETIME [(microsecond precision)]\n\nDescription\n-----------\n\nA date and time combination.\n\nMariaDB displays DATETIME values in \'YYYY-MM-DD HH:MM:SS.ffffff\' format, but\nallows assignment of values to DATETIME columns using either strings or\nnumbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nMariaDB 10.1.2 introduced the --mysql56-temporal-format option, on by default,\nwhich allows MariaDB to store DATETMEs using the same low-level format MySQL\n5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the DATETIME data type in a format that\nsupports values between 1000-01-01 00:00:00.000000 and 9999-12-31\n23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nMariaDB also supports \'0000-00-00\' as a special zero-date value, unless\nNO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of\na date can be set to 0 (for example: \'2015-00-12\'), unless NO_ZERO_IN_DATE is\nspecified in the SQL_MODE. In many cases, the result of en expression\ninvolving a zero-date, or a date with zero-parts, is NULL. If the\nALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range\nbetween 1 and 31, the date does not produce any error, even for months that\nhave less than 31 days.\n\nTime Zones\n----------\n\nIf a column uses the DATETIME data type, then any inserted values are stored\nas-is, so no automatic time zone conversions are performed.\n\nMariaDB also does not currently support time zone literals that contain time\nzone identifiers. See MDEV-11829 for more information.\n\nMariaDB validates DATETIME literals against the session\'s time zone. For\nexample, if a specific time range never occurred in a specific time zone due\nto daylight savings time, then DATETIME values within that range would be\ninvalid for that time zone.\n\nFor example, daylight savings time started on March 10, 2019 in the US, so the\ntime range between 02:00:00 and 02:59:59 is invalid for that day in US time\nzones:\n\nSET time_zone = \'America/New_York\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nERROR 1292 (22007): Incorrect datetime value: \'2019-03-10 02:55:05\' for column\n`db1`.`timestamp_test`.`timestamp_test` at row 1\n\nBut that same time range is fine in other time zones, such as Coordinated\nUniversal Time (UTC). For example:\n\nSET time_zone = \'UTC\';\nQuery OK, 0 rows affected (0.000 sec)\n\nINSERT INTO timestamp_test VALUES (\'2019-03-10 02:55:05\');\nQuery OK, 1 row affected (0.002 sec)\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, DATE with a time portion is a synonym for\nDATETIME. See also mariadb_schema.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace 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 the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_datetime\\G\n*************************** 1. row ***************************\n Table: mariadb5312_datetime\nCreate Table: CREATE TABLE `mariadb5312_datetime` (\n `dt0` datetime /* mariadb-5.3 */ DEFAULT NULL,\n `dt6` datetime(6) /* mariadb-5.3 */ DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\n\nINSERT INTO t1 VALUES (\"2011-03-11\"), (\"2012-04-19 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t1;\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 13:08:22\"),\n (\"2013-07-18 13:44:22.123456\");\n\nSELECT * FROM t2;\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 to datetime(6).\nIf you want to have a datetime without seconds, you should use\nCONVERT(..,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\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 (291,23,'TIMESTAMP','Syntax\n------\n\nTIMESTAMP [(<microsecond precision)]\n\nDescription\n-----------\n\nA timestamp in the format YYYY-MM-DD HH:MM:SS.ffffff.\n\nThe timestamp field is generally used to define at which moment in time a row\nwas added or updated and by default will automatically be assigned the current\ndatetime when a record is inserted or updated. The automatic properties only\napply to the first TIMESTAMP in the record; subsequent TIMESTAMP columns will\nnot be changed.\n\nMariaDB includes the --mysql56-temporal-format option, on by default, which\nallows MariaDB to store TIMESTAMPs using the same low-level format MySQL 5.6\nuses.\n\nFor more information, see Internal Format.\n\nSupported Values\n----------------\n\nMariaDB stores values that use the TIMESTAMP data type as the number of\nseconds since \'1970-01-01 00:00:00\' (UTC). This means that the TIMESTAMP data\ntype can hold values between \'1970-01-01 00:00:01\' (UTC) and \'2038-01-19\n03:14:07\' (UTC).\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no\nmicrosecond precision is specified, then 0 is used by default.\n\nAutomatic Values\n----------------\n\nMariaDB has special behavior for the first column that uses the TIMESTAMP data\ntype in a specific table. For the first column that uses the TIMESTAMP data\ntype in a specific table, MariaDB automatically assigns the following\nproperties to the column:\n\n* DEFAULT CURRENT_TIMESTAMP\n* ON UPDATE CURRENT_TIMESTAMP\n\nThis means that if the column is not explicitly assigned a value in an INSERT\nor UPDATE query, then MariaDB will automatically initialize the column\'s value\nwith the current date and time.\n\nThis automatic initialization for INSERT and UPDATE queries can also be\nexplicitly enabled for a column that uses the TIMESTAMP data type by\nspecifying the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP\nclauses for the column. In these clauses, any synonym of CURRENT_TIMESTAMP is\naccepted, including CURRENT_TIMESTAMP(), NOW(), LOCALTIME, LOCALTIME(),\nLOCALTIMESTAMP, and LOCALTIMESTAMP().\n\nThis automatic initialization for INSERT queries can also be explicitly\ndisabled for a column that uses the TIMESTAMP data type by specifying a\nconstant DEFAULT value. For example, DEFAULT 0.\n\nThis automatic initialization for UPDATE queries can also be explicitly\ndisabled for a column that uses the TIMESTAMP data type by specifying a\nDEFAULT clause for the column, but no ON UPDATE clause. If a DEFAULT clause is\nexplicitly specified for a column that uses the TIMESTAMP data type, but an ON\nUPDATE clause is not specified for the column, then the timestamp value will\nnot automatically change when an UPDATE statement is executed.\n\nMariaDB also has special behavior if NULL is assigned to column that uses the\nTIMESTAMP data type. If the column is assigned the NULL value in an INSERT or\nUPDATE query, then MariaDB will automatically initialize the column\'s value\nwith the current date and time. For details, see NULL values in MariaDB.\n\nThis automatic initialization for NULL values can also be explicitly disabled\nfor a column that uses the TIMESTAMP data type by specifying the NULL\nattribute for the column. In this case, if the column\'s value is set to NULL,\nthen the column\'s value will actually be set to NULL.\n\nTime Zones\n----------\n\nIf a column uses the TIMESTAMP data type, then any inserted values are\nconverted from the session\'s time zone to Coordinated Universal Time (UTC)\nwhen stored, and converted back to the session\'s time zone when retrieved.\n\nMariaDB does not currently store any time zone identifier with the value of\nthe TIMESTAMP data type. See MDEV-10018 for more information.\n\nMariaDB does not currently support time zone literals that contain time zone\nidentifiers. See MDEV-11829 for more information.\n\nLimitations\n-----------\n\n* Because the TIMESTAMP value is stored as Epoch Seconds, the timestamp value\n\'1970-01-01 00:00:00\' (UTC) is reserved since the second #0 is used to\nrepresent \'0000-00-00 00:00:00\'.\n* In MariaDB 5.5 and before there could only be one TIMESTAMP column per table\nthat had CURRENT_TIMESTAMP defined as its default value. This limit has no\nlonger applied since MariaDB 10.0.\n\nSQL_MODE=MAXDB\n--------------\n\nIf the SQL_MODE is set to MAXDB, TIMESTAMP fields will be silently converted\nto DATETIME.\n\nInternal Format\n---------------\n\nIn MariaDB 10.1.2 a new temporal format was introduced from MySQL 5.6 that\nalters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels.\nThese changes allow these temporal data types to have fractional parts and\nnegative values. You can disable this feature using the\nmysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of\nMariaDB or that were created while the mysql56_temporal_format system variable\nwas disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format,\nexecute an ALTER TABLE... MODIFY COLUMN statement that changes the column to\nthe *same* data type. This change may be needed if you want to export the\ntable\'s tablespace and import it onto a server that has\nmysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIMESTAMP 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 TIMESTAMP;\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the\nolder temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data\ntypes that you want to switch over to the new format, make sure the system\nvariable is enabled, then perform a dump and restore using mysqldump. The\ncolumns using relevant temporal data types are restored using the new temporal\nformat.\n\nStarting from MariaDB 10.5.1 columns with old temporal formats are marked with\na /* mariadb-5.3 */ comment in the output of SHOW CREATE TABLE, SHOW COLUMNS,\nDESCRIBE statements, as well as in the COLUMN_TYPE column of the\nINFORMATION_SCHEMA.COLUMNS Table.\n\nSHOW CREATE TABLE mariadb5312_timestamp\\G\n*************************** 1. row ***************************\n Table: mariadb5312_timestamp\nCreate Table: CREATE TABLE `mariadb5312_timestamp` (\n `ts0` timestamp /* mariadb-5.3 */ NOT NULL DEFAULT current_timestamp() ON\nUPDATE current_timestamp(),\n `ts6` timestamp(6) /* mariadb-5.3 */ NOT NULL DEFAULT \'0000-00-00\n00:00:00.000000\'\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n\nNote: Prior to MySQL 4.1 a different format for the TIMESTAMP datatype was\nused. This format is unsupported in MariaDB 5.1 and upwards.\n\nExamples\n--------\n\nCREATE TABLE t (id INT, ts TIMESTAMP);\n\nDESC t;\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n| Field | Type | Null | Key | Default | Extra \n |\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n| id | int(11) | YES | | NULL | \n |\n| ts | timestamp | NO | | CURRENT_TIMESTAMP | on update\nCURRENT_TIMESTAMP |\n+-------+-----------+------+-----+-------------------+-------------------------\n---+\n\nINSERT INTO t(id) VALUES (1),(2);\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 1 | 2013-07-22 12:50:05 |\n| 2 | 2013-07-22 12:50:05 |\n+------+---------------------+\n\nINSERT INTO t VALUES (3,NULL),(4,\'2001-07-22 12:12:12\');\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 1 | 2013-07-22 12:50:05 |\n| 2 | 2013-07-22 12:50:05 |\n| 3 | 2013-07-22 12:51:56 |\n| 4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nConverting to Unix epoch:\n\nSELECT ts, UNIX_TIMESTAMP(ts) FROM t;\n+---------------------+--------------------+\n| ts | UNIX_TIMESTAMP(ts) |\n+---------------------+--------------------+\n| 2013-07-22 12:50:05 | 1374490205 |\n| 2013-07-22 12:50:05 | 1374490205 |\n| 2013-07-22 12:51:56 | 1374490316 |\n| 2001-07-22 12:12:12 | 995796732 |\n+---------------------+--------------------+\n\nUpdate also changes the timestamp:\n\nUPDATE t set id=5 WHERE id=1;\n\nSELECT * FROM t;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 5 | 2013-07-22 14:52:33 |\n| 2 | 2013-07-22 12:50:05 |\n| 3 | 2013-07-22 12:51:56 |\n| 4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nDefault NULL:\n\nCREATE TABLE t2 (id INT, ts TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP);\n\nINSERT INTO t(id) VALUES (1),(2);\n\nSELECT * FROM t2;\n\nINSERT INTO t2(id) VALUES (1),(2);\n\nSELECT * FROM t2;\n+------+------+\n| id | ts |\n+------+------+\n| 1 | NULL |\n| 2 | NULL |\n+------+------+\n\nUPDATE t2 SET id=3 WHERE id=1;\n\nSELECT * FROM t2;\n+------+---------------------+\n| id | ts |\n+------+---------------------+\n| 3 | 2013-07-22 15:32:22 |\n| 2 | NULL |\n+------+---------------------+\n\nOnly the first timestamp is automatically inserted and updated:\n\nCREATE TABLE t3 (id INT, ts1 TIMESTAMP, ts2 TIMESTAMP);\n\nINSERT INTO t3(id) VALUES (1),(2);\n\nSELECT * FROM t3;\n+------+---------------------+---------------------+\n| id | ts1 | ts2 |\n+------+---------------------+---------------------+\n| 1 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 2 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n+------+---------------------+---------------------+\n\nDESC t3;\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n| Field | Type | Null | Key | Default | Extra \n |\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n| id | int(11) | YES | | NULL | \n |\n| ts1 | timestamp | NO | | CURRENT_TIMESTAMP | on update\nCURRENT_TIMESTAMP |\n| ts2 | timestamp | NO | | 0000-00-00 00:00:00 | \n |\n+-------+-----------+------+-----+---------------------+-----------------------\n-----+\n\nExplicitly setting a timestamp with the CURRENT_TIMESTAMP function:\n\nINSERT INTO t3(id,ts2) VALUES (3,CURRENT_TIMESTAMP());\n\nSELECT * FROM t3;\n+------+---------------------+---------------------+\n| id | ts1 | ts2 |\n+------+---------------------+---------------------+\n| 1 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 2 | 2013-07-22 15:35:07 | 0000-00-00 00:00:00 |\n| 3 | 2013-07-22 15:38:52 | 2013-07-22 15:38:52 |\n+------+---------------------+---------------------+\n\nSpecifying the timestamp as NOT NULL:\n\nCREATE TABLE t4 (id INT, ts TIMESTAMP NOT NULL);\n\nINSERT INTO t4(id) VALUES (1);\nSELECT SLEEP(1);\nINSERT INTO t4(id,ts) VALUES (2,NULL);\n\nSELECT * FROM t4;\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 (292,23,'YEAR Data Type','Syntax\n------\n\nYEAR[(4)]\n\nDescription\n-----------\n\nA year in two-digit or four-digit format. The default is four-digit format.\nNote that the two-digit format has been deprecated since MariaDB 5.5.27.\n\nIn four-digit format, the allowable values are 1901 to 2155, and 0000. In\ntwo-digit format, the allowable values are 70 to 69, representing years from\n1970 to 2069. MariaDB displays YEAR values in YYYY format, but allows you to\nassign values to YEAR columns using either strings or numbers.\n\nInserting numeric zero has a different result for YEAR(4) and YEAR(2). For\nYEAR(2), the value 00 reflects the year 2000. For YEAR(4), the value 0000\nreflects the year zero. This only applies to numeric zero. String zero always\nreflects the year 2000.\n\nExamples\n--------\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\nWith strict_mode set, the default from MariaDB 10.2.4:\n\nOut of range:\n\nINSERT INTO y VALUES (1005),(\'3080\');\nERROR 1264 (22003): Out of range value for column \'y\' at row 1\n\nINSERT INTO y VALUES (\'2013-12-12\');\nERROR 1265 (01000): Data truncated for column \'y\' at row 1\n\nSELECT * FROM y;\n+------+\n| y |\n+------+\n| 1990 |\n| 2012 |\n+------+\n\nWith strict_mode unset, the default until MariaDB 10.2.3:\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 row 1 |\n| Warning | 1264 | Out of range value for column \'y\' at row 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\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 numeric 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 removed in a future\nrelease. \n Please use YEAR(4) instead\n\nINSERT INTO y2 VALUES(0,0),(\'0\',\'0\');\n\nSELECT YEAR(y),YEAR(y2) FROM y2;\n+---------+----------+\n| YEAR(y) | YEAR(y2) |\n+---------+----------+\n| 0 | 2000 |\n| 2000 | 2000 |\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 (293,23,'AUTO_INCREMENT','Description\n-----------\n\nThe AUTO_INCREMENT attribute can be used to generate a unique identity for new\nrows. When you insert a new record to the table (or upon adding an\nAUTO_INCREMENT attribute with the ALTER TABLE statement), and the\nauto_increment field is NULL or DEFAULT (in the case of an INSERT), the value\nwill automatically be incremented. This also applies to 0, unless the\nNO_AUTO_VALUE_ON_ZERO SQL_MODE is enabled.\n\nAUTO_INCREMENT columns start from 1 by default. The automatically generated\nvalue can never be lower than 0.\n\nEach table can have only one AUTO_INCREMENT column. It must defined as a key\n(not necessarily the PRIMARY KEY or UNIQUE key). In some storage engines\n(including the default InnoDB), if the key consists of multiple columns, the\nAUTO_INCREMENT column must be the first column. Storage engines that permit\nthe column to be placed elsewhere are Aria, MyISAM, MERGE, Spider, TokuDB,\nBLACKHOLE, FederatedX and 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| 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 AUTO_INCREMENT UNIQUE.\n\nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n\nSHOW CREATE TABLE t \\G\n*************************** 1. row ***************************\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--------------------------------------------\n\nYou can use an ALTER TABLE statement to assign a new value to the\nauto_increment table option, or set the insert_id server system variable to\nchange the next AUTO_INCREMENT value inserted by the current session.\n\nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT value inserted by\nthe current session.\n\nALTER TABLE animals AUTO_INCREMENT=8;\n\nINSERT INTO animals (name) VALUES (\'aardvark\');\n\nSELECT * FROM animals;\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| 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\n------\n\nUntil MariaDB 10.2.3, InnoDB used an auto-increment counter that is stored in\nmemory. When the server restarts, the counter is re-initialized to the highest\nvalue used in the table, which cancels the effects of any AUTO_INCREMENT = N\noption in the table statements.\n\nFrom MariaDB 10.2.4, this restriction has been lifted and AUTO_INCREMENT is\npersistent.\n\nSee also AUTO_INCREMENT Handling in InnoDB.\n\nSetting Explicit Values\n-----------------------\n\nIt is possible to specify a value for an AUTO_INCREMENT column. If the key is\nprimary or unique, the value must not already exist in the key.\n\nIf the new value is higher than the current maximum value, the AUTO_INCREMENT\nvalue is updated, so the next value will be higher. If the new value is lower\nthan the current maximum value, the AUTO_INCREMENT value remains unchanged.\n\nThe following example demonstrates these behaviors:\n\nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE =\nInnoDB;\n\nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n+----+\n| id |\n+----+\n| 1 |\n+----+\n\nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\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| id |\n+----+\n| 1 |\n| 2 |\n| 10 |\n| 11 |\n+----+\n\nThe ARCHIVE storage engine does not allow to insert a value that is lower than\nthe current maximum.\n\nMissing Values\n--------------\n\nAn AUTO_INCREMENT column normally has missing values. This happens because if\na row is deleted, or an AUTO_INCREMENT value is explicitly updated, old values\nare never re-used. The REPLACE statement also deletes a row, and its value is\nwasted. With InnoDB, values can be reserved by a transaction; but if the\ntransaction fails (for example, because of a ROLLBACK) the reserved value will\nbe lost.\n\nThus AUTO_INCREMENT values can be used to sort results in a chronological\norder, but not to create a numeric sequence.\n\nReplication\n-----------\n\nTo make master-master or Galera safe to use AUTO_INCREMENT one should use the\nsystem variables auto_increment_increment and auto_increment_offset to\ngenerate unique values for each server.\n\nCHECK Constraints, DEFAULT Values and Virtual Columns\n-----------------------------------------------------\n\nMariaDB starting with 10.2.6\n----------------------------\nFrom MariaDB 10.2.6 auto_increment columns are no longer permitted in CHECK\nconstraints, DEFAULT value expressions and virtual columns. They were\npermitted in earlier versions, but did not work correctly. See MDEV-11117.\n\nGenerating Auto_Increment Values When Adding the Attribute\n----------------------------------------------------------\n\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (0),(0),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 1 |\n| 2 |\n| 3 |\n+---+\n\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (5),(0),(8),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 5 |\n| 6 |\n| 8 |\n| 9 |\n+---+\n\nIf the NO_AUTO_VALUE_ON_ZERO SQL_MODE is set, zero values will not be\nautomatically incremented:\n\nSET SQL_MODE=\'no_auto_value_on_zero\';\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (3), (0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT * FROM t1;\n+---+\n| a |\n+---+\n| 0 |\n| 3 |\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 (294,24,'Using Compound Statements Outside of Stored Programs','Compound statements can also be used outside of stored programs.\n\ndelimiter |\nIF @have_innodb THEN\n CREATE TABLE IF NOT EXISTS innodb_index_stats (\n database_name VARCHAR(64) NOT NULL,\n table_name VARCHAR(64) NOT NULL,\n index_name VARCHAR(64) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE\nCURRENT_TIMESTAMP,\n stat_name VARCHAR(64) NOT NULL,\n stat_value BIGINT UNSIGNED NOT NULL,\n sample_size BIGINT UNSIGNED,\n stat_description VARCHAR(1024) NOT NULL,\n PRIMARY KEY (database_name, table_name, index_name, stat_name)\n ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;\nEND IF|\nQuery OK, 0 rows affected, 2 warnings (0.00 sec)\n\nNote, that using compound statements this way is subject to following\nlimitations:\n\n* Only BEGIN, IF, CASE, LOOP, WHILE, REPEAT statements may start a compound\nstatement outside of stored programs.\n* BEGIN must use the BEGIN NOT ATOMIC syntax (otherwise it\'ll be confused with\nBEGIN that starts a transaction).\n* A compound statement might not start with a label.\n* A compound statement is parsed completely—note \"2 warnings\" in the above\nexample, even if the condition was false (InnoDB was, indeed, disabled), and\nthe CREATE TABLE statement was not executed, it was still parsed and the\nparser produced \"Unknown storage engine\" warning.\n\nInside a compound block first three limitations do not apply, one can use\nanything that can be used inside a stored program — including labels,\ncondition handlers, variables, and so on:\n\nBEGIN NOT ATOMIC\n DECLARE foo CONDITION FOR 1146;\n DECLARE x INT DEFAULT 0;\n DECLARE CONTINUE HANDLER FOR SET x=1;\n INSERT INTO test.t1 VALUES (\"hndlr1\", val, 2);\n END|\n\nExample how to use IF:\n\nIF (1>0) THEN BEGIN NOT ATOMIC SELECT 1; END ; END IF;;\n\nExample of how to use WHILE loop:\n\nDELIMITER |\nBEGIN NOT ATOMIC\n DECLARE x INT DEFAULT 0;\n WHILE x <= 10 DO\n SET x = x + 1;\n SELECT x;\n END WHILE;\nEND|\nDELIMITER ;\n\nURL:\nhttps://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/','','https://mariadb.com/kb/en/using-compound-statements-outside-of-stored-programs/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (295,24,'BEGIN END','Syntax\n------\n\n[begin_label:] BEGIN [NOT ATOMIC]\n [statement_list]\nEND [end_label]\n\nNOT ATOMIC is required when used outside of a stored procedure. Inside stored\nprocedures or within an anonymous block, BEGIN alone starts a new anonymous\nblock.\n\nDescription\n-----------\n\nBEGIN ... END syntax is used for writing compound statements. A compound\nstatement can contain multiple statements, enclosed by the BEGIN and END\nkeywords. statement_list represents a list of one or more statements, each\nterminated by a semicolon (i.e., ;) statement delimiter. statement_list is\noptional, which means that the empty compound statement (BEGIN END) is legal.\n\nNote that END will perform a commit. If you are running in autocommit mode,\nevery statement will be committed separately. If you are not running in\nautocommit mode, you must 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 send statement\nstrings containing the ; statement delimiter. This is handled in the mysql\ncommand-line client with the DELIMITER command. Changing the ;\nend-of-statement delimiter (for example, to //) allows ; to be used in a\nprogram body.\n\nA compound statement within a stored program can be labeled. end_label cannot\nbe given unless begin_label also is present. If both are present, they must be\nthe same.\n\nBEGIN ... END constructs can be nested. Each block can define its own\nvariables, a CONDITION, a HANDLER and a CURSOR, which don\'t exist in the outer\nblocks. The most local declarations override the outer objects which use the\nsame name (see example below).\n\nThe declarations order is the following:\n\n* DECLARE local variables;\n* DECLARE CONDITIONs;\n* DECLARE CURSORs;\n* DECLARE HANDLERs;\n\nNote that DECLARE HANDLER contains another BEGIN ... END construct.\n\nHere is an example of a very simple, anonymous block:\n\nBEGIN NOT ATOMIC\nSET @a=1;\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 BEGIN\n DECLARE x CHAR(2) DEFAULT \'02\';\n DECLARE y TINYINT UNSIGNED DEFAULT 10;\n SELECT x, y;\n END;\n SELECT x;\nEND;\n\nIn this example, a TINYINT variable, x is declared in the outter block. But in\nthe inner block x is re-declared as a CHAR and an y variable is declared. The\ninner SELECT shows the \"new\" value of x, and the value of y. But when x is\nselected in the outer block, the \"old\" value is returned. The final SELECT\ndoesn\'t try to read y, because it doesn\'t exist in that context.\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 (296,24,'CASE Statement','Syntax\n------\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-----------\n\nThe text on this page describes the CASE statement for stored programs. See\nthe CASE OPERATOR for details on the CASE operator outside of stored programs.\n\nThe CASE statement for stored programs implements a complex conditional\nconstruct. If a search_condition evaluates to true, the corresponding SQL\nstatement list is executed. If no search condition matches, the statement list\nin the ELSE clause is executed. Each statement_list consists of one or more\nstatements.\n\nThe CASE statement cannot have an ELSE NULL clause, and it is terminated with\nEND CASE instead of END. implements a complex conditional construct. If a\nsearch_condition evaluates to true, the corresponding SQL statement list is\nexecuted. If no search condition matches, the statement list in the ELSE\nclause is executed. Each statement_list consists of one or more statements.\n\nIf no when_value or search_condition matches the value tested and the CASE\nstatement contains no ELSE clause, a Case not found for CASE statement error\nresults.\n\nEach statement_list consists of one or more statements; an empty\nstatement_list is not allowed. To handle situations where no value is matched\nby any WHEN clause, use an ELSE containing an empty BEGIN ... END block, as\nshown in this example:\n\nDELIMITER |\nCREATE PROCEDURE p()\nBEGIN\n DECLARE v INT DEFAULT 1;\n CASE v\n WHEN 2 THEN SELECT v;\n WHEN 3 THEN SELECT 0;\n ELSE BEGIN END;\n END CASE;\nEND;\n|\n\nThe indentation used here in the ELSE clause is for purposes of clarity only,\nand is not otherwise significant. See Delimiters in the mysql client for more\non the use of the delimiter command.\n\nNote: The syntax of the CASE statement used inside stored programs differs\nslightly from that of the SQL CASE expression described in CASE OPERATOR. The\nCASE statement cannot have an ELSE NULL clause, and it is terminated with END\nCASE instead of END.\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 (297,24,'DECLARE CONDITION','Syntax\n------\n\nDECLARE condition_name CONDITION FOR condition_value\n\ncondition_value:\n SQLSTATE [VALUE] sqlstate_value\n | mysql_error_code\n\nDescription\n-----------\n\nThe DECLARE ... CONDITION statement defines a named error condition. It\nspecifies a condition that needs specific handling and associates a name with\nthat condition. Later, the name can be used in a DECLARE ... HANDLER, SIGNAL\nor RESIGNAL statement (as long as the statement is located in the same BEGIN\n... END block).\n\nConditions must be declared after local variables, but before CURSORs and\nHANDLERs.\n\nA condition_value for DECLARE ... CONDITION can be an SQLSTATE value (a\n5-character string literal) or a MySQL error code (a number). You should not\nuse SQLSTATE value \'00000\' or MySQL error code 0, because those indicate\nsucess rather than an error condition. If you try, or if you specify an\ninvalid SQLSTATE value, an error like this is produced:\n\nERROR 1407 (42000): Bad SQLSTATE: \'00000\'\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\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 (298,24,'DECLARE HANDLER','Syntax\n------\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-----------\n\nThe DECLARE ... HANDLER statement specifies handlers that each may deal with\none or more conditions. If one of these conditions occurs, the specified\nstatement is executed. statement can be a simple statement (for example, SET\nvar_name = value), or it can be a compound statement written using BEGIN and\nEND.\n\nHandlers must be declared after local variables, a CONDITION and a CURSOR.\n\nFor a CONTINUE handler, execution of the current program continues after\nexecution of the handler statement. For an EXIT handler, execution terminates\nfor the BEGIN ... END compound statement in which the handler is declared.\n(This is true even if the condition occurs in an inner block.) The UNDO\nhandler type statement is not supported.\n\nIf a condition occurs for which no handler has been declared, the default\naction is EXIT.\n\nA condition_value for DECLARE ... HANDLER can be any of the following values:\n\n* An SQLSTATE value (a 5-character string literal) or a MariaDB error\ncode (a number). You should not use SQLSTATE value \'00000\' or MariaDB\nerror code 0, because those indicate sucess rather than an error\ncondition. For a list of SQLSTATE values and MariaDB error codes, see\nMariaDB Error Codes.\n* A condition name previously specified with DECLARE ... CONDITION. It must be\nin the same stored program. See DECLARE CONDITION.\n* SQLWARNING is shorthand for the class of SQLSTATE values that begin\nwith \'01\'.\n* NOT FOUND is shorthand for the class of SQLSTATE values that begin\nwith \'02\'. This is relevant only the context of cursors and is used to\ncontrol what happens when a cursor reaches the end of a data set. If\nno more rows are available, a No Data condition occurs with SQLSTATE\nvalue 02000. To detect this condition, you can set up a handler for it\n(or for a NOT FOUND condition). An example is shown in Cursor Overview. This\ncondition also occurs for SELECT ... INTO var_list statements that retrieve no\nrows.\n* SQLEXCEPTION is shorthand for the class of SQLSTATE values that do\nnot begin with \'00\', \'01\', or \'02\'.\n\nWhen an error raises, in some cases it could be handled by multiple HANDLERs.\nFor example, there may be an handler for 1050 error, a separate handler for\nthe 42S01 SQLSTATE, and another separate handler for the SQLEXCEPTION class:\nin theory all occurrences of HANDLER may catch the 1050 error, but MariaDB\nchooses the HANDLER with the highest precedence. Here are the precedence rules:\n\n* Handlers which refer to an error code have the highest precedence.\n* Handlers which refer to a SQLSTATE come next.\n* Handlers which refer to an error class have the lowest precedence.\n\nIn some cases, a statement could produce multiple errors. If this happens, in\nsome cases multiple handlers could have the highest precedence. In such cases,\nthe choice of the handler is indeterminate.\n\nNote that if an error occurs within a CONTINUE HANDLER block, it can be\nhandled by another HANDLER. However, a HANDLER which is already in the stack\n(that is, it has been called to handle an error and its execution didn\'t\nfinish yet) cannot handle new errors—this prevents endless loops. For example,\nsuppose that a stored procedure contains a CONTINUE HANDLER for SQLWARNING and\nanother CONTINUE HANDLER for NOT FOUND. At some point, a NOT FOUND error\noccurs, and the execution enters the NOT FOUND HANDLER. But within that\nhandler, a warning occurs, and the execution enters the SQLWARNING HANDLER. If\nanother NOT FOUND error occurs, it cannot be handled again by the NOT FOUND\nHANDLER, because its execution is not finished.\n\nWhen a DECLARE HANDLER block can handle more than one error condition, it may\nbe useful to know which errors occurred. To do so, you can use the GET\nDIAGNOSTICS statement.\n\nAn error that is handled by a DECLARE HANDLER construct can be issued again\nusing 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 = 1;\n SET @x = 1;\n INSERT INTO test.t VALUES (1);\n SET @x = 2;\n INSERT INTO test.t VALUES (1);\n SET @x = 3;\n END;\n //\n\nDELIMITER ;\n\nCALL handlerdemo( );\n\nSELECT @x;\n+------+\n| @x |\n+------+\n| 3 |\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 (299,24,'DECLARE Variable','Syntax\n------\n\nDECLARE var_name [, var_name] ... [[ROW] TYPE OF]] type [DEFAULT value]\n\nDescription\n-----------\n\nThis statement is used to declare local variables within stored programs. To\nprovide a default value for the variable, include a DEFAULT clause. The value\ncan be specified as an expression (even subqueries are permitted); it need not\nbe a constant. If the DEFAULT clause is missing, the initial value is NULL.\n\nLocal variables are treated like stored routine parameters with respect to\ndata type and overflow checking. See CREATE PROCEDURE.\n\nLocal variables must be declared before CONDITIONs, CURSORs and HANDLERs.\n\nLocal variable names are not case sensitive.\n\nThe scope of a local variable is within the BEGIN ... END block where it is\ndeclared. The variable can be referred to in blocks nested within the\ndeclaring block, except those blocks that declare a variable with the same\nname.\n\nTYPE OF / ROW TYPE OF\n---------------------\n\nMariaDB starting with 10.3\n--------------------------\nTYPE OF and ROW TYPE OF anchored data types for stored routines were\nintroduced in MariaDB 10.3.\n\nAnchored data types allow a data type to be defined based on another object,\nsuch as a table row, rather than specifically set in the declaration. If the\nanchor object changes, so will the anchored data type. This can lead to\nroutines being easier to maintain, so that if the data type in the table is\nchanged, it will automatically be changed in the routine as well.\n\nVariables declared with ROW TYPE OF will have the same features as implicit\nROW variables. It is not possible to use ROW TYPE OF variables in a LIMIT\nclause.\n\nThe real data type of TYPE OF and ROW TYPE OF table_name will become known at\nthe very beginning of the stored routine call. ALTER TABLE or DROP TABLE\nstatements performed inside the current routine on the tables that appear in\nanchors won\'t affect the data type of the anchored variables, even if the\nvariable is declared after an ALTER TABLE or DROP TABLE statement.\n\nThe real data type of a ROW TYPE OF cursor_name variable will become known\nwhen execution enters into the block where the variable is declared. Data type\ninstantiation will happen only once. In a cursor ROW TYPE OF variable that is\ndeclared inside a loop, its data type will become known on the very first\niteration and won\'t change on further loop iterations.\n\nThe tables referenced in TYPE OF and ROW TYPE OF declarations will be checked\nfor existence at the beginning of the stored routine call. CREATE PROCEDURE or\nCREATE FUNCTION will not check the referenced tables for existence.\n\nExamples\n--------\n\nTYPE OF and ROW TYPE OF from MariaDB 10.3:\n\nDECLARE tmp TYPE OF t1.a; -- Get the data type from the column {{a}} in the\ntable {{t1}}\n\nDECLARE rec1 ROW TYPE OF t1; -- Get the row data type from the table {{t1}}\n\nDECLARE rec2 ROW TYPE OF cur1; -- Get the row data type from the cursor\n{{cur1}}\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 (300,24,'FOR','MariaDB starting with 10.3\n--------------------------\nFOR loops were introduced in MariaDB 10.3.\n\nSyntax\n------\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 [ ( cursor_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 [ ( cursor_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-----------\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 bound and upper\nbound values, and assign the lower bound value to a counter. If REVERSE is not\nspecified, and the upper bound value is greater than or equal to the counter,\nthe counter will be incremented and the statement will continue, after which\nthe loop is entered again. If the upper bound value is greater than the\ncounter, the loop will be exited.\n\nIf REVERSE is specified, the counter is decremented, and the upper bound value\nneeds to be less than or equal for the loop to continue.\n\nExamples\n--------\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\nDELIMITER ;\n\nSELECT * FROM t1;\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 4..12\n DO\n INSERT INTO t1 VALUES (i);\nEND FOR;\n//\nQuery OK, 9 rows affected (0.422 sec)\n\nDELIMITER ;\n\nSELECT * FROM t1;\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;\nBEGIN\n FOR rec IN cur(pa)\n LOOP\n SELECT rec.a, rec.b;\n END LOOP;\nEND;\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\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 (301,24,'GOTO','MariaDB starting with 10.3\n--------------------------\nThe GOTO statement was introduced in MariaDB 10.3 for Oracle compatibility.\n\nSyntax\n------\n\nGOTO label\n\nDescription\n-----------\n\nThe GOTO statement causes the code to jump to the specified label, and\ncontinue operating from there. It is only accepted when in Oracle mode.\n\nExample\n-------\n\nSET sql_mode=ORACLE;\n\nDELIMITER //\n\nCREATE OR REPLACE PROCEDURE p1 AS\n\nBEGIN\n\nSELECT 1;\n GOTO label;\n SELECT 2;\n <<label>>\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\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 (302,24,'IF','Syntax\n------\n\nIF search_condition THEN statement_list\n [ELSEIF search_condition THEN statement_list] ...\n [ELSE statement_list]\nEND IF;\n\nDescription\n-----------\n\nIF implements a basic conditional construct. If the search_condition evaluates\nto true, the corresponding SQL statement list is executed. If no\nsearch_condition matches, the statement list in the ELSE clause is executed.\nEach statement_list consists of one or more statements.\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 (303,24,'ITERATE','Syntax\n------\n\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements. ITERATE\nmeans \"do the loop again\", and uses the statement\'s label to determine which\nstatements to repeat. The 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 the label is\nassociated to a construct which is not a loop, the following error will be\nproduced:\n\nERROR 1308 (42000): ITERATE with no matching label: <label_name>\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 IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND\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 (304,24,'Labels','Syntax\n------\n\nlabel: <construct>\n[label]\n\nLabels are MariaDB identifiers which can be used to identify a BEGIN ... END\nconstruct or a loop. They have a maximum length of 16 characters and can be\nquoted with backticks (i.e.., `).\n\nLabels have a start part and an end part. The start part must precede the\nportion of code it refers to, must be followed by a colon (:) and can be on\nthe same or different line. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must precede the\nconstruct\'s delimiter (;). Constructs identified by a label can be nested.\nEach construct can be identified by only one label.\n\nLabels need not be unique in the stored program they belong to. However, a\nlabel for an inner loop cannot be identical to a label for an outer loop. In\nthis case, the following error would be produced:\n\nERROR 1309 (42000): Redefining label <label_name>\n\nLEAVE and ITERATE statements can be used to exit or repeat a portion of code\nidentified by a label. They must be in the same Stored Routine, Trigger or\nEvent which contains the target label.\n\nBelow is an example using a simple label that is used to exit a LOOP:\n\nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n LEAVE `my_label`;\n END LOOP;\n SELECT \'out of loop\';\nEND;\n\nThe following label is used to exit a procedure, and has an end part:\n\nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n END IF;\n DO something();\nEND `my_label`;\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 (305,24,'LEAVE','Syntax\n------\n\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the given\nlabel. The label must be in the same stored program, not in a caller\nprocedure. LEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE). In Stored Procedures, Triggers and Events, LEAVE can refer to\nthe outmost BEGIN ... END construct; in that case, the program exits the\nprocedure. In Stored Functions, RETURN can be used instead.\n\nNote that LEAVE cannot be used to exit a DECLARE HANDLER block.\n\nIf you try to LEAVE a non-existing label, or if you try to LEAVE a HANDLER\nblock, the following error will be produced:\n\nERROR 1308 (42000): LEAVE with no matching label: <label_name>\n\nThe following example uses LEAVE to exit the procedure if a condition is true:\n\nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n IF p < 1 THEN\n LEAVE `whole_proc`;\n END IF;\n SELECT 2;\nEND;\n\nCALL proc(0);\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\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 (306,24,'LOOP','Syntax\n------\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nDescription\n-----------\n\nLOOP implements a simple loop construct, enabling repeated execution of the\nstatement list, which consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter. The statements within the loop are\nrepeated until the loop is exited; usually this is accomplished with a LEAVE\nstatement.\n\nA LOOP statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on delimiter usage in the client.\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 (307,24,'REPEAT LOOP','Syntax\n------\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 until the\nsearch_condition is true. Thus, a REPEAT always enters the loop at least once.\nstatement_list consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter.\n\nA REPEAT statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on client delimiter usage.\n\nDELIMITER //\n\nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n END\n//\n\nCALL dorepeat(1000)//\n\nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\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 (308,24,'RESIGNAL','Syntax\n------\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 = <error_property_value>\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-----------\n\nThe syntax of RESIGNAL and its semantics are very similar to SIGNAL. This\nstatement can only be used within an error HANDLER. It produces an error, like\nSIGNAL. RESIGNAL clauses are the same as SIGNAL, except that they all are\noptional, even SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error that was received\nby the error HANDLER. For a description of the clauses, see diagnostics area.\n\nNote that RESIGNAL does not empty the diagnostics area: it just appends\nanother error condition.\n\nRESIGNAL, without any clauses, produces an error which is identical to the\nerror that was received by HANDLER.\n\nIf used out of a HANDLER construct, RESIGNAL produces the following error:\n\nERROR 1645 (0K000): RESIGNAL when handler not active\n\nIn MariaDB 5.5, if a HANDLER contained a CALL to another procedure, that\nprocedure could use RESIGNAL. Since MariaDB 10.0, trying to do this raises the\nabove error.\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nThe following procedure tries to query two tables which don\'t exist, producing\na 1146 error in both cases. Those errors will trigger the HANDLER. The first\ntime the error will be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will receive 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 END IF;\n END;\n SET @hide_errors = TRUE;\n SELECT \'Next error will be ignored\' AS msg;\n SELECT `c` FROM `temptab_one`;\n SELECT \'Next error won\'\'t be ignored\' AS msg;\n SET @hide_errors = FALSE;\n SELECT `c` FROM `temptab_two`;\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 exist\n\nThe following procedure re-signals an error, modifying only the error message\nto 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 END;\n SELECT `c` FROM `temptab`;\nEND;\n\nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n\nAs explained above, this works on MariaDB 5.5, but produces a 1645 error since\n10.0.\n\nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\nEND;\nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\nEND;\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 (309,24,'RETURN','Syntax\n------\n\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and returns the\nvalue expr to the function caller. There must be at least one RETURN statement\nin a stored function. If the function has multiple exit points, all exit\npoints must have a RETURN.\n\nThis statement is not used in stored procedures, triggers, or events. LEAVE\ncan be used instead.\n\nThe following example shows that RETURN can return the result of a scalar\nsubquery:\n\nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\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 (310,24,'SELECT INTO','Syntax\n------\n\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nDescription\n-----------\n\nSELECT ... INTO enables selected columns to be stored directly into variables.\nNo resultset is produced. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and the\nvariable values remain unchanged. If the query returns multiple rows, error\n1172 occurs (Result consisted of more than one row). If it is possible that\nthe statement may retrieve multiple rows, you can use LIMIT 1 to limit the\nresult set to a single row.\n\nThe INTO clause can also be specified at the end of the statement.\n\nIn the context of such statements that occur as part of events executed by the\nEvent Scheduler, diagnostics messages (not only errors, but also warnings) are\nwritten to the error log, and, on Windows, to the application event log.\n\nThis statement can be used with both local variables and user-defined\nvariables.\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 even if SQL_CACHE is\nspecified.\n\nExamples\n--------\n\nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\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 (311,24,'SIGNAL','Syntax\n------\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 = <error_property_value>\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 error. This\nstatement can be used anywhere, but is generally useful when used inside a\nstored program. When the error is produced, it can be caught by a HANDLER. If\nnot, the current stored program, or the current statement, will terminate with\nthe specified error.\n\nSometimes an error HANDLER just needs to SIGNAL the same error it received,\noptionally with some changes. Usually the RESIGNAL statement is the most\nconvenient way to do this.\n\nerror_condition can be an SQLSTATE value or a named error condition defined\nvia DECLARE CONDITION. SQLSTATE must be a constant string consisting of five\ncharacters. These codes are standard to ODBC and ANSI SQL. For customized\nerrors, the recommended SQLSTATE is \'45000\'. For a list of SQLSTATE values\nused by MariaDB, see the MariaDB Error Codes page. The SQLSTATE can be read\nvia the API method mysql_sqlstate( ).\n\nTo specify error properties user-defined variables and local variables can be\nused, as well as character set conversions (but you can\'t set a collation).\n\nThe error properties, their type and their default values are explained in the\ndiagnostics area page.\n\nErrors\n------\n\nIf the SQLSTATE is not valid, the following error like this will be produced:\n\nERROR 1407 (42000): Bad SQLSTATE: \'123456\'\n\nIf a property is specified more than once, an error like this will be produced:\n\nERROR 1641 (42000): Duplicate condition information item \'MESSAGE_TEXT\'\n\nIf you specify a condition name which is not declared, an error like this will\nbe produced:\n\nERROR 1319 (42000): Undefined CONDITION: cond_name\n\nIf MYSQL_ERRNO is out of range, you will get an error like this:\n\nERROR 1231 (42000): Variable \'MYSQL_ERRNO\' can\'t be set to the value of \'0\'\n\nExamples\n--------\n\nHere\'s what happens if SIGNAL is used in the client to generate errors:\n\nSIGNAL SQLSTATE \'01000\';\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+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n\nSIGNAL SQLSTATE \'02000\';\nERROR 1643 (02000): Unhandled user-defined not found condition\n\nHow to specify MYSQL_ERRNO and MESSAGE_TEXT properties:\n\nSIGNAL SQLSTATE \'45000\' SET MYSQL_ERRNO=30001, MESSAGE_TEXT=\'H\nello, world!\';\n\nERROR 30001 (45000): Hello, world!\n\nThe following code shows how to use user variables, local variables and\ncharacter set conversion with SIGNAL:\n\nCREATE PROCEDURE test_error(x INT)\nBEGIN\n DECLARE errno SMALLINT UNSIGNED DEFAULT 31001;\n SET @errmsg = \'Hello, world!\';\n IF x = 1 THEN\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = @errmsg;\n ELSE\n SIGNAL SQLSTATE \'45000\' SET\n MYSQL_ERRNO = errno,\n MESSAGE_TEXT = _utf8\'Hello, world!\';\n END IF;\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 IF n > 10 THEN\n SIGNAL `too_big`;\n END IF;\nEND;\n\nIn this example, we\'ll define a HANDLER for an error code. When the error\noccurs, we SIGNAL a more informative error which 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 init()\nprocedure?\';\n END;\n -- this will produce a 1146 error\n SELECT `c` FROM `temptab`;\nEND;\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 (312,24,'WHILE','Syntax\n------\n\n[begin_label:] WHILE search_condition DO\n statement_list\nEND WHILE [end_label]\n\nDescription\n-----------\n\nThe statement list within a WHILE statement is repeated as long as the\nsearch_condition is true. statement_list consists of one or more statements.\nIf the loop must be executed at least once, REPEAT ... LOOP can be used\ninstead.\n\nA WHILE statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nExamples\n--------\n\nCREATE PROCEDURE dowhile()\nBEGIN\n DECLARE v1 INT DEFAULT 5;\n\nWHILE v1 > 0 DO\n ...\n SET v1 = v1 - 1;\n END WHILE;\nEND\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 (313,24,'Cursor Overview','Description\n-----------\n\nA cursor is a structure that allows you to go over records sequentially, and\nperform processing based on the result.\n\nMariaDB permits cursors inside stored programs, and MariaDB cursors are\nnon-scrollable, read-only and asensitive.\n\n* Non-scrollable means that the rows can only be fetched in the order\nspecified by the SELECT statement. Rows cannot be skipped, you cannot jump to\na specific row, and you cannot fetch rows in reverse order.\n* Read-only means that data cannot be updated through the cursor.\n* Asensitive means that the cursor points to the actual underlying data. This\nkind of cursor is quicker than the alternative, an insensitive cursor, as no\ndata is copied to a temporary table. However, changes to the data being used\nby the cursor will affect the cursor data.\n\nCursors are created with a DECLARE CURSOR statement and opened with an OPEN\nstatement. Rows are read with a FETCH statement before the cursor is finally\nclosed with a CLOSE statement.\n\nWhen FETCH is issued and there are no more rows to extract, the following\nerror is produced:\n\nERROR 1329 (02000): No data - zero rows fetched, selected, or processed\n\nTo avoid problems, a DECLARE HANDLER statement is generally used. The HANDLER\nshould handler the 1329 error, or the \'02000\' SQLSTATE, or the NOT FOUND error\nclass.\n\nOnly SELECT statements are allowed for cursors, and they cannot be contained\nin a variable - so, they cannot be composed dynamically. However, it is\npossible to SELECT from a view. Since the CREATE VIEW statement can be\nexecuted as a prepared statement, it is possible to dynamically create the\nview that is queried by the cursor.\n\nFrom MariaDB 10.3.0, cursors can have parameters. Cursor parameters can appear\nin any part of the DECLARE CURSOR select_statement where a stored procedure\nvariable is allowed (select list, WHERE, HAVING, LIMIT etc). See DECLARE\nCURSOR and OPEN for syntax, and below for an example:\n\nExamples\n--------\n\nCREATE TABLE c1(i INT);\n\nCREATE TABLE c2(i INT);\n\nCREATE TABLE c3(i INT);\n\nDELIMITER //\n\nCREATE PROCEDURE p1()\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE x, y INT;\n DECLARE cur1 CURSOR FOR SELECT i FROM test.c1;\n DECLARE cur2 CURSOR FOR SELECT i FROM test.c2;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;\n\nOPEN cur1;\n OPEN cur2;\n\nread_loop: LOOP\n FETCH cur1 INTO x;\n FETCH cur2 INTO y;\n IF done THEN\n LEAVE read_loop;\n END IF;\n IF x < y THEN\n INSERT INTO test.c3 VALUES (x);\n ELSE\n INSERT INTO test.c3 VALUES (y);\n END IF;\n END LOOP;\n\nCLOSE cur1;\n CLOSE cur2;\nEND; //\n\nDELIMITER ;\n\nINSERT INTO c1 VALUES(5),(50),(500);\n\nINSERT INTO c2 VALUES(10),(20),(30);\n\nCALL p1;\n\nSELECT * FROM c3;\n+------+\n| i |\n+------+\n| 5 |\n| 20 |\n| 30 |\n+------+\n\nFrom MariaDB 10.3.0\n\nDROP PROCEDURE IF EXISTS p1;\nDROP TABLE IF EXISTS t1;\nCREATE TABLE t1 (a INT, b VARCHAR(10));\n\nINSERT INTO t1 VALUES (1,\'old\'),(2,\'old\'),(3,\'old\'),(4,\'old\'),(5,\'old\');\n\nDELIMITER //\n\nCREATE PROCEDURE p1(min INT,max INT)\nBEGIN\n DECLARE done INT DEFAULT FALSE;\n DECLARE va INT;\n DECLARE cur CURSOR(pmin INT, pmax INT) FOR SELECT a FROM t1 WHERE a BETWEEN\npmin AND pmax;\n DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;\n OPEN cur(min,max);\n read_loop: LOOP\n FETCH cur INTO va;\n IF done THEN\n LEAVE read_loop;\n END IF;\n INSERT INTO t1 VALUES (va,\'new\');\n END LOOP;\n CLOSE cur;\nEND;\n//\n\nDELIMITER ;\n\nCALL p1(2,4);\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 1 | old |\n| 2 | old |\n| 3 | old |\n| 4 | old |\n| 5 | old |\n| 2 | new |\n| 3 | new |\n| 4 | new |\n+------+------+\n\nURL: https://mariadb.com/kb/en/cursor-overview/','','https://mariadb.com/kb/en/cursor-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (314,24,'DECLARE CURSOR','Syntax\n------\n\n<= MariaDB 10.2\n\nDECLARE cursor_name CURSOR FOR select_statement\n\nFrom MariaDB 10.3\n\nDECLARE cursor_name CURSOR [(cursor_formal_parameter[,...])] FOR\nselect_statement\n\ncursor_formal_parameter:\n name type [collate clause]\n\nFrom MariaDB 10.8\n\nDECLARE cursor_name CURSOR [(cursor_formal_parameter[,...])] FOR\nselect_statement\n\ncursor_formal_parameter:\n [IN] name type [collate clause]\n\nDescription\n-----------\n\nThis statement declares a cursor. Multiple cursors may be declared in a stored\nprogram, but each cursor in a given block must have a unique name.\n\nselect_statement is not executed until the OPEN statement is executed. It is\nimportant to remember this if the query produces an error, or calls functions\nwhich have side effects.\n\nA SELECT associated to a cursor can use variables, but the query itself cannot\nbe a variable, and cannot be dynamically composed. The SELECT statement cannot\nhave an INTO clause.\n\nCursors must be declared before HANDLERs, but after local variables and\nCONDITIONs.\n\nParameters\n----------\n\nMariaDB starting with 10.3.0\n----------------------------\nFrom MariaDB 10.3.0, cursors can have parameters. This is a non-standard SQL\nextension. Cursor parameters can appear in any part of the DECLARE CURSOR\nselect_statement where a stored procedure variable is allowed (select list,\nWHERE, HAVING, LIMIT etc).\n\nIN\n--\n\nMariaDB starting with 10.8.0\n----------------------------\nFrom MariaDB 10.8.0 preview release, the IN qualifier is supported in the\ncursor_format_parameter part of the syntax.\n\nSee Cursor Overview for an example.\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 (315,24,'OPEN','Syntax\n------\n\n<= MariaDB 10.2\n\nOPEN cursor_name\n\nFrom MariaDB 10.3\n\nOPEN cursor_name [expression[,...]];\n\nDescription\n-----------\n\nThis statement opens a cursor which was previously declared with DECLARE\nCURSOR.\n\nThe query associated to the DECLARE CURSOR is executed when OPEN is executed.\nIt is important to remember this if the query produces an error, or calls\nfunctions which have side effects.\n\nThis is necessary in order to FETCH rows from a cursor.\n\nSee Cursor Overview for an example.\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,24,'FETCH','Syntax\n------\n\nFETCH cursor_name INTO var_name [, var_name] ...\n\nDescription\n-----------\n\nThis statement fetches the next row (if a row exists) using the specified open\ncursor, and advances the cursor pointer.\n\nvar_name can be a local variable, but not a user-defined variable.\n\nIf no more rows are available, a No Data condition occurs with SQLSTATE value\n02000. To detect this condition, you can set up a handler for it (or for a NOT\nFOUND condition).\n\nSee Cursor Overview for an example.\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 (317,24,'CLOSE','Syntax\n------\n\nCLOSE cursor_name\n\nDescription\n-----------\n\nThis statement closes a previously opened cursor. The cursor must have been\npreviously opened or else an error occurs.\n\nIf not closed explicitly, a cursor is closed at the end of the compound\nstatement in which it was declared.\n\nSee Cursor Overview for an example.\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 (318,25,'BUFFER','A synonym for ST_BUFFER.\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 (319,25,'CONVEXHULL','A synonym for ST_CONVEXHULL.\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 (320,25,'GEOMETRYCOLLECTION','Syntax\n------\n\nGeometryCollection(g1,g2,...)\n\nDescription\n-----------\n\nConstructs a WKB GeometryCollection. If any argument is not a well-formed WKB\nrepresentation of a geometry, the return value is NULL.\n\nExamples\n--------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\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 (321,25,'LINESTRING','Syntax\n------\n\nLineString(pt1,pt2,...)\n\nDescription\n-----------\n\nConstructs a WKB LineString value from a number of WKB Point arguments. If any\nargument is not a WKB Point, the return value is NULL. If the number of Point\narguments is less than two, the return value is NULL.\n\nExamples\n--------\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 10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\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 (322,25,'MULTILINESTRING','Syntax\n------\n\nMultiLineString(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiLineString value using WKB LineString arguments. If any\nargument is not a WKB LineString, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16\n48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), \n Point(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21, 7))))));\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 (323,25,'MULTIPOINT','Syntax\n------\n\nMultiPoint(pt1,pt2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPoint value using WKB Point arguments. If any argument\nis not a WKB Point, the return value is NULL.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9,\n4 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 20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\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 (324,25,'MULTIPOLYGON','Syntax\n------\n\nMultiPolygon(poly1,poly2,...)\n\nDescription\n-----------\n\nConstructs a WKB MultiPolygon value from a set of WKB Polygon arguments. If\nany argument is not a WKB Polygon, the return value is NULL.\n\nExample\n-------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66\n23,73 9,48 6,52 18)),\n ((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(\n Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));\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 (325,25,'POINT','Syntax\n------\n\nPoint(x,y)\n\nDescription\n-----------\n\nConstructs a WKB Point using the given coordinates.\n\nExamples\n--------\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\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 (326,25,'PointOnSurface','A synonym for ST_PointOnSurface.\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 (327,25,'POLYGON','Syntax\n------\n\nPolygon(ls1,ls2,...)\n\nDescription\n-----------\n\nConstructs a WKB Polygon value from a number of WKB LineString arguments. If\nany argument does not represent the WKB of a LinearRing (that is, not a closed\nand simple LineString) the return value is NULL.\n\nNote that according to the OpenGIS standard, a POLYGON should have exactly one\nExteriorRing and all other rings should lie within that ExteriorRing and thus\nbe the InteriorRings. Practically, however, some systems, including MariaDB\'s,\npermit polygons to have several \'ExteriorRings\'. In the case of there being\nmultiple, non-overlapping exterior rings ST_NUMINTERIORRINGS() will return 1.\n\nExamples\n--------\n\nSET @g = ST_GEOMFROMTEXT(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,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 10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30,\n30), Point(0, 0))))));\n\nNon-overlapping \'polygon\':\n\nSELECT ST_NumInteriorRings(ST_PolyFromText(\'POLYGON((0 0,10 0,10 10,0 10,0 0),\n (-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))\')) AS NumInteriorRings;\n+------------------+\n| NumInteriorRings |\n+------------------+\n| 1 |\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 (328,25,'ST_BUFFER','Syntax\n------\n\nST_BUFFER(g1,r)\nBUFFER(g1,r)\n\nDescription\n-----------\n\nReturns a geometry that represents all points whose distance from geometry g1\nis less than or equal to distance, or radius, r.\n\nUses for this function could include creating for example a new geometry\nrepresenting a buffer zone around an island.\n\nBUFFER() is a synonym.\n\nExamples\n--------\n\nDetermining whether a point is within a buffer zone:\n\nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((10 10, 10 20, 20 20, 20 10, 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\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 (329,25,'ST_CONVEXHULL','MariaDB starting with 10.1.2\n----------------------------\nST_ConvexHull() was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_ConvexHull(g)\nConvexHull(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a geometry that is the minimum convex geometry\nenclosing all geometries within the set. Returns NULL if the geometry value is\nNULL or an empty value.\n\nST_ConvexHull() and ConvexHull() are synonyms.\n\nExamples\n--------\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 3, 8 4, 6 6, 6 9,\n4 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\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 (330,25,'ST_INTERSECTION','Syntax\n------\n\nST_INTERSECTION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the intersection, or shared portion, of geometry g1\nand geometry g2.\n\nExamples\n--------\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\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 (331,25,'ST_POINTONSURFACE','MariaDB starting with 10.1.2\n----------------------------\nST_POINTONSURFACE() was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_PointOnSurface(g)\nPointOnSurface(g)\n\nDescription\n-----------\n\nGiven a geometry, returns a POINT guaranteed to intersect a surface. However,\nsee MDEV-7514.\n\nST_PointOnSurface() and PointOnSurface() are synonyms.\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 (332,25,'ST_SYMDIFFERENCE','Syntax\n------\n\nST_SYMDIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that represents the portions of geometry g1 and geometry g2\nthat don\'t intersect.\n\nExamples\n--------\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\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 (333,25,'ST_UNION','Syntax\n------\n\nST_UNION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the union of the geometry g1 and geometry g2.\n\nExamples\n--------\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\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 (334,26,'SHOW GRANTS','Syntax\n------\n\nSHOW GRANTS [FOR user|role]\n\nDescription\n-----------\n\nThe SHOW GRANTS statement lists privileges granted to a particular user or\nrole.\n\nUsers\n-----\n\nThe statement lists the GRANT statement or statements that must be issued to\nduplicate the privileges that are granted to a MariaDB user account. The\naccount is named using the same format as for the GRANT statement; for\nexample, \'jeffrey\'@\'localhost\'. If you specify only the user name part of the\naccount name, a host name part of \'%\' is used. For additional information\nabout specifying account names, see GRANT.\n\nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to connect to\nthe server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in\nDEFINER context (such as within a stored procedure that is defined with SQL\nSECURITY DEFINER), the grants displayed are those of the definer and not the\ninvoker.\n\nNote that the DELETE HISTORY privilege, introduced in MariaDB 10.3.4, was\ndisplayed as DELETE VERSIONING ROWS when running SHOW GRANTS until MariaDB\n10.3.15 (MDEV-17655).\n\nRoles\n-----\n\nSHOW GRANTS can also be used to view the privileges granted to a role.\n\nExample\n-------\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\nFOR PUBLIC\n----------\n\nMariaDB starting with 10.11\n---------------------------\nGRANT ... TO PUBLIC was introduced in MariaDB 10.11 to grant privileges to all\nusers. SHOW GRANTS FOR PUBLIC shows all these grants.\n\nSHOW GRANTS FOR public;\n+------------------------------------------------+\n| Grants for PUBLIC |\n+------------------------------------------------+\n| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |\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 (335,26,'SHOW CREATE USER','Syntax\n------\n\nSHOW CREATE USER user_name\n\nDescription\n-----------\n\nShows the CREATE USER statement that created the given user. The statement\nrequires the SELECT privilege for the mysql database, except for the current\nuser.\n\nExamples\n--------\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 ***************************\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 120 DAY;\n\nSHOW CREATE USER \'monty\'@\'localhost\';\n+------------------------------------------------------------------+\n| CREATE USER for monty@localhost |\n+------------------------------------------------------------------+\n| CREATE USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY |\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 (336,26,'SHOW COLUMNS','Syntax\n------\n\nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW COLUMNS displays information about the columns in a given table. It also\nworks for views. The LIKE clause, if present on its own, indicates which\ncolumn names to match. The WHERE and LIKE clauses can be given to select rows\nusing more general conditions, as discussed in Extended SHOW.\n\nIf the data types differ from what you expect them to be based on a CREATE\nTABLE statement, note that MariaDB sometimes changes data types when you\ncreate or alter a table. The conditions under which this occurs are described\nin the Silent Column Changes article.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. In other words, these two statements are equivalent:\n\nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for non-binary string columns, or NULL for\nother columns. This value is displayed only if you use the FULL keyword.\n\nThe Null field contains YES if NULL values can be stored in the column, NO if\nnot.\n\nThe Key field indicates whether the column is indexed:\n\n* If Key is empty, the column either is not indexed or is indexed only as a\n secondary column in a multiple-column, non-unique index.\n* If Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\n* If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n* If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a non-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 of a table, Key\ndisplays the one with the highest priority, in the order PRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values and\nthere is no PRIMARY KEY in the table. A UNIQUE index may display as MUL if\nseveral columns form a composite UNIQUE index; although the combination of the\ncolumns is unique, each column can still hold multiple occurrences of a given\nvalue.\n\nThe Default field indicates the default value that is assigned to the column.\n\nThe Extra field contains any additional information that is available about a\ngiven column.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| AUTO_INCREMENT | The column was created with the AUTO_INCREMENT |\n| | keyword. |\n+------------------------+---------------------------------------------------+\n| PERSISTENT | The column was created with the PERSISTENT |\n| | keyword. (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| VIRTUAL | The column was created with the VIRTUAL keyword. |\n| | (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| on update | The column is a TIMESTAMP column that is |\n| CURRENT_TIMESTAMP | automatically updated on INSERT and UPDATE. |\n+------------------------+---------------------------------------------------+\n\nPrivileges indicates the privileges you have for the column. This value is\ndisplayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed only if\nyou use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. Also DESCRIBE and EXPLAIN can be\nused as shortcuts.\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 COLUMNS. The\ninformation_schema.COLUMNS table provides similar, but more complete,\ninformation.\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also\nprovide information about tables.\n\nExamples\n--------\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\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 (337,26,'SHOW CREATE TABLE','Syntax\n------\n\nSHOW CREATE TABLE tbl_name\n\nDescription\n-----------\n\nShows the CREATE TABLE statement that created the given table. The statement\nrequires the SELECT privilege for the table. This statement also works with\nviews and SEQUENCE.\n\nSHOW CREATE TABLE quotes table and column names according to the value of the\nsql_quote_show_create server system variable.\n\nCertain SQL_MODE values can result in parts of the original CREATE statement\nnot being included in the output. MariaDB-specific table options, column\noptions, and index options are not included in the output of this statement if\nthe NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are\nused. All MariaDB-specific table attributes are also not shown when a\nnon-MariaDB/MySQL emulation mode is used, which includes ANSI, DB2,\nPOSTGRESQL, MSSQL, MAXDB or ORACLE.\n\nInvalid table options, column options and index options are normally commented\nout (note, that it is possible to create a table with invalid options, by\naltering a table of a different engine, where these options were valid). To\nhave them uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember\nthat replaying a CREATE TABLE statement with uncommented invalid options will\nfail with an error, unless the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n\nNote that SHOW CREATE TABLE is not meant to provide metadata about a table. It\nprovides information about how the table was declared, but the real table\nstructure could differ a bit. For example, if an index has been declared as\nHASH, the CREATE TABLE statement returned by SHOW CREATE TABLE will declare\nthat index as HASH; however, it is possible that the index is in fact a BTREE,\nbecause the storage engine does not support HASH.\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 permits TEXT and BLOB data types to be assigned a DEFAULT\nvalue. As a result, from MariaDB 10.2.1, SHOW CREATE TABLE will append a\nDEFAULT NULL to nullable TEXT or BLOB fields if no specific default is\nprovided.\n\nMariaDB starting with 10.2.2\n----------------------------\nFrom MariaDB 10.2.2, numbers are no longer quoted in the DEFAULT clause in\nSHOW CREATE statement. Previously, MariaDB quoted numbers.\n\nIndex Order\n-----------\n\nIndexes are sorted and displayed in the following order, which may differ from\nthe order of the CREATE TABLE statement.\n\n* PRIMARY KEY\n* UNIQUE keys where all column are NOT NULL\n* UNIQUE keys that don\'t contain partial segments\n* Other UNIQUE keys\n* LONG UNIQUE keys\n* Normal keys\n* Fulltext keys\n\nSee sql/sql_table.cc for details.\n\nExamples\n--------\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\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 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 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 Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSQL_MODE impacting the output:\n\nSELECT @@sql_mode;\n+------------------------------------------------------------------------------\n------------+\n| @@sql_mode \n |\n+------------------------------------------------------------------------------\n------------+\n|\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SU\nSTITUTION |\n+------------------------------------------------------------------------------\n------------+\n\nCREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=latin1\n;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSET SQL_MODE=ORACLE;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE \"t1\" (\n \"id\" int(11) NOT NULL,\n \"msg\" varchar(100) DEFAULT NULL,\n PRIMARY KEY (\"id\")\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 (338,26,'SHOW INDEX','Syntax\n------\n\nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n\nDescription\n-----------\n\nSHOW INDEX returns table index information. The format resembles that of the\nSQLStatistics call in ODBC.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. These two statements are 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 mariadb-show/mysqlshow command:\n\nmysqlshow -k db_name tbl_name\n\nThe information_schema.STATISTICS table stores similar information.\n\nThe following fields are returned by SHOW INDEX.\n\n+------------------------+---------------------------------------------------+\n| Field | Description |\n+------------------------+---------------------------------------------------+\n| Table | Table name |\n+------------------------+---------------------------------------------------+\n| Non_unique | 1 if the index permits duplicate values, 0 if |\n| | values must be unique. |\n+------------------------+---------------------------------------------------+\n| Key_name | Index name. The primary key is always named |\n| | PRIMARY. |\n+------------------------+---------------------------------------------------+\n| Seq_in_index | The column\'s sequence in the index, beginning |\n| | with 1. |\n+------------------------+---------------------------------------------------+\n| Column_name | Column name. |\n+------------------------+---------------------------------------------------+\n| Collation | Either A, if the column is sorted in ascending |\n| | order in the index, or NULL if it\'s not sorted. |\n+------------------------+---------------------------------------------------+\n| Cardinality | Estimated number of unique values in the index. |\n| | The cardinality statistics are calculated at |\n| | various times, and can help the optimizer make |\n| | improved decisions. |\n+------------------------+---------------------------------------------------+\n| Sub_part | NULL if the entire column is included in the |\n| | index, or the number of included characters if |\n| | not. |\n+------------------------+---------------------------------------------------+\n| Packed | NULL if the index is not packed, otherwise how |\n| | the index is packed. |\n+------------------------+---------------------------------------------------+\n| Null | NULL if NULL values are permitted in the column, |\n| | an empty string if NULLs are not permitted. |\n+------------------------+---------------------------------------------------+\n| Index_type | The index type, which can be BTREE, FULLTEXT, |\n| | HASH or RTREE. See Storage Engine Index Types. |\n+------------------------+---------------------------------------------------+\n| Comment | Other information, such as whether the index is |\n| | disabled. |\n+------------------------+---------------------------------------------------+\n| Index_comment | Contents of the COMMENT attribute when the index |\n| | was created. |\n+------------------------+---------------------------------------------------+\n| Ignored | Whether or not an index will be ignored by the |\n| | optimizer. See Ignored Indexes. From MariaDB |\n| | 10.6.0. |\n+------------------------+---------------------------------------------------+\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example\\G\n*************************** 1. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: PRIMARY\n Seq_in_index: 1\n Column_name: id\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 2. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: employee_code\n Seq_in_index: 1\n Column_name: employee_code\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 3. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 1\n Column_name: first_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 4. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 2\n Column_name: last_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\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 (339,26,'SHOW EXPLAIN','Syntax\n------\n\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id>;\nEXPLAIN [FORMAT=JSON] FOR CONNECTION <connection_id>;\n\nDescription\n-----------\n\nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that is, a description\nof a query plan) of a query running in a certain connection.\n\nSHOW EXPLAIN FOR <connection_id>;\n\nwill produce an EXPLAIN output for the query that connection number\nconnection_id is running. The connection id can be obtained with SHOW\nPROCESSLIST.\n\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len | ref |\nrows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL |\n1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nThe output is always accompanied with a warning which shows the query the\ntarget connection is running (this shows what the EXPLAIN is for):\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n\nEXPLAIN FOR CONNECTION\n----------------------\n\nMariaDB starting with 10.9\n--------------------------\nThe EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.\n\nFORMAT=JSON\n-----------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW EXPLAIN [FORMAT=JSON] FOR <connection_id> extends SHOW EXPLAIN to return\nmore detailed JSON output.\n\nPossible Errors\n---------------\n\nThe output can be only produced if the target connection is currently running\na query, which has a ready query plan. If this is not the case, the output\nwill be:\n\nSHOW EXPLAIN FOR 2;\nERROR 1932 (HY000): Target is not running an EXPLAINable command\n\nYou will get this error when:\n\n* the target connection is not running a command for which one can run EXPLAIN\n* the target connection is running a command for which one can run EXPLAIN, but\nthere is no query plan yet (for example, tables are open and locks are\n acquired before the query plan is produced)\n\nDifferences Between SHOW EXPLAIN and EXPLAIN Outputs\n----------------------------------------------------\n\nBackground\n----------\n\nIn MySQL, EXPLAIN execution takes a slightly different route from the way the\nreal query (typically the SELECT) is optimized. This is unfortunate, and has\ncaused a number of bugs in EXPLAIN. (For example, see MDEV-326, MDEV-410, and\nlp:1013343. lp:992942 is not directly about EXPLAIN, but it also would not\nhave existed if MySQL didn\'t try to delete parts of a query plan in the middle\nof the query)\n\nSHOW EXPLAIN examines a running SELECT, and hence its output may be slightly\ndifferent from what EXPLAIN SELECT would produce. We did our best to make sure\nthat either the difference is negligible, or SHOW EXPLAIN\'s output is closer\nto reality than EXPLAIN\'s output.\n\nList of Recorded Differences\n----------------------------\n\n* SHOW EXPLAIN may have Extra=\'no matching row in const table\', where EXPLAIN\nwould produce Extra=\'Impossible WHERE ...\'\n* For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY\nwhere regular EXPLAIN used to print select_type==SIMPLE, or vice versa.\n\nRequired Permissions\n--------------------\n\nRunning SHOW EXPLAIN requires the same permissions as running SHOW PROCESSLIST\nwould.\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 (340,26,'BACKUP STAGE','MariaDB starting with 10.4.1\n----------------------------\nThe BACKUP STAGE commands were introduced in MariaDB 10.4.1.\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool.\n\nSyntax\n------\n\nBACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END ]\n\nIn the following text, a transactional table means InnoDB or \"InnoDB-like\nengine with redo log that can lock redo purges and can be copied without locks\nby an outside process\".\n\nGoals with BACKUP STAGE Commands\n--------------------------------\n\n* To be able to do a majority of the backup with the minimum possible server\nlocks. Especially for transactional tables (InnoDB, MyRocks etc) there is only\nneed for a very short block of new commits while copying statistics and log\ntables.\n* DDL are only needed to be blocked for a very short duration of the backup\nwhile mariabackup is copying the tables affected by DDL during the initial\npart of the backup.\n* Most non transactional tables (those that are not in use) will be copied\nduring BACKUP STAGE START. The exceptions are system statistic and log tables\nthat are not blocked during the backup until BLOCK_COMMIT.\n* Should work efficiently with backup tools that use disk snapshots.\n* Should work as efficiently as possible for all table types that store data\non the local disks.\n* As little copying as possible under higher level stages/locks. For example,\n.frm (dictionary) and .trn (trigger) files should be copying while copying the\ntable data.\n\nBACKUP STAGE Commands\n---------------------\n\nBACKUP STAGE START\n------------------\n\nThe START stage is designed for the following tasks:\n\n* Blocks purge of redo files for storage engines that needs this (Aria)\n* Start logging of DDL commands into \'datadir\'/ddl.log. This may take a short\ntime as the command has to wait until there are no active DDL commands.\n\nBACKUP STAGE FLUSH\n------------------\n\nThe FLUSH stage is designed for the following tasks:\n\n* FLUSH all changes for inactive non-transactional tables, except for\nstatistics and log tables.\n* Close all tables that are not in use, to ensure they are marked as closed\nfor the backup.\n* BLOCK all new write locks for all non transactional tables (except\nstatistics and log tables). The command will not wait for tables that are in\nuse by read-only transactions.\n\nDDLs don\'t have to be blocked at this stage as they can\'t cause the table to\nbe in an inconsistent state. This is true also for non-transactional tables.\n\nBACKUP STAGE BLOCK_DDL\n----------------------\n\nThe BLOCK_DDL stage is designed for the following tasks:\n\n* Wait for all statements using write locked non-transactional tables to end.\n* Blocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE.\n* Blocks also start off a new ALTER TABLE and the final rename phase of ALTER\nTABLE. Running ALTER TABLES are not blocked.\n\nBACKUP STAGE BLOCK_COMMIT\n-------------------------\n\nThe BLOCK_COMMIT stage is designed for the following tasks:\n\n* Lock the binary log and commit/rollback to ensure that no changes are\ncommitted to any tables. If there are active commits or data to be copied to\nthe binary log this will be allowed to finish. Active transactions will not\naffect BLOCK_COMMIT.\n* This doesn\'t lock temporary tables that are not used by replication. However\nthese will be blocked when it\'s time to write to the binary log.\n* Lock system log tables and statistics tables, flush them and mark them\nclosed.\n\nWhen the BLOCK_COMMIT\'s stages return, this is the \'backup time\'. Everything\ncommitted will be in the backup and everything not committed will roll back.\n\nTransactional engines will continue to do changes to the redo log during the\nBLOCK COMMIT stage, but this is not important as all of these will roll back\nlater as the changes will not be committed.\n\nBACKUP STAGE END\n----------------\n\nThe END stage is designed for the following tasks:\n\n* End DDL logging\n* Free resources\n\nUsing BACKUP STAGE Commands with Backup Tools\n---------------------------------------------\n\nUsing BACKUP STAGE Commands with Mariabackup\n--------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. How Mariabackup uses these commands depends on\nwhether you are using the version that is bundled with MariaDB Community\nServer or the version that is bundled with MariaDB Enterprise Server. See\nMariabackup and BACKUP STAGE Commands for some examples on how Mariabackup\nuses these commands.\n\nIf you would like to use a version of Mariabackup that uses the BACKUP STAGE\ncommands in an efficient way, then one option is to use MariaDB Enterprise\nBackup that is bundled with MariaDB Enterprise Server.\n\nUsing BACKUP STAGE Commands with Storage Snapshots\n--------------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. These commands could even be used by tools\nthat perform backups by taking a snapshot of a file system, SAN, or some other\nkind of storage device. See Storage Snapshots and BACKUP STAGE Commands for\nsome examples on how to use each BACKUP STAGE command in an efficient way.\n\nPrivileges\n----------\n\nBACKUP STAGE requires the RELOAD privilege.\n\nNotes\n-----\n\n* Only one connection can run BACKUP STAGE START. If a second connection\ntries, it will wait until the first one has executed BACKUP STAGE END.\n* If the user skips a BACKUP STAGE, then all intermediate backup stages will\nautomatically be run. This will allow us to add new stages within the BACKUP\nSTAGE hierarchy in the future with even more precise locks without causing\nproblems for tools using an earlier version of the BACKUP STAGE implementation.\n* One can use the max_statement_time or lock_wait_timeout system variables to\nensure that a BACKUP STAGE command doesn\'t block the server too long.\n* DDL logging will only be available in MariaDB Enterprise Server 10.2 and\nlater.\n* A disconnect will automatically release backup stages.\n* There is no easy way to see which is the current stage.\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 (341,26,'BACKUP LOCK','MariaDB starting with 10.4.2\n----------------------------\nThe BACKUP LOCK command was introduced in MariaDB 10.4.2.\n\nBACKUP LOCK blocks a table from DDL statements. This is mainly intended to be\nused by tools like mariabackup that need to ensure there are no DDLs on a\ntable while the table files are opened. For example, for an Aria table that\nstores data in 3 files with extensions .frm, .MAI and .MAD. Normal read/write\noperations can continue as normal.\n\nSyntax\n------\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----------------------\n\nBACKUP LOCK [database.]table_name;\n - Open all files related to a table (for example, t.frm, t.MAI and t.MYD)\nBACKUP UNLOCK;\n- Copy data\n- Close files\n\nThis ensures that all files are from the same generation, that is created at\nthe same time by the MariaDB server. This works, because the open files will\npoint to the original table files which will not be affected if there is any\nALTER TABLE while copying the files.\n\nPrivileges\n----------\n\nBACKUP LOCK requires the RELOAD privilege.\n\nNotes\n-----\n\n* The idea is that the BACKUP LOCK should be held for as short a time as\npossible by the backup tool. The time to take an uncontested lock is very\nshort! One can easily do 50,000 locks/unlocks per second on low end hardware.\n* One should use different connections for BACKUP STAGE commands and BACKUP\nLOCK.\n\nImplementation\n--------------\n\n* Internally, BACKUP LOCK is implemented by taking an MDLSHARED_HIGH_PRIO MDL\nlock on the table object, which protects the table from any DDL operations.\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 (342,26,'FLUSH','Syntax\n------\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] [table_flush_option]\n\nwhere table_list is a list of tables separated by , (comma).\n\nDescription\n-----------\n\nThe FLUSH statement clears or reloads various internal caches used by MariaDB.\nTo execute FLUSH, you must have the RELOAD privilege. See GRANT.\n\nThe RESET statement is similar to FLUSH. See RESET.\n\nYou cannot issue a FLUSH statement from within a stored function or a trigger.\nDoing so within a stored procedure is permitted, as long as it is not called\nby a stored function or trigger. See Stored Routine Limitations, Stored\nFunction Limitations and Trigger Limitations.\n\nIf a listed table is a view, an error like the following will be produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nBy default, FLUSH statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nThe different flush options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| CHANGED_PAGE_BITMAPS | XtraDB only. Internal command used for backup |\n| | purposes. See the Information Schema |\n| | CHANGED_PAGE_BITMAPS Table. |\n+---------------------------+------------------------------------------------+\n| CLIENT_STATISTICS | Reset client statistics (see SHOW |\n| | CLIENT_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| DES_KEY_FILE | Reloads the DES key file (Specified with the |\n| | --des-key-file startup option). |\n+---------------------------+------------------------------------------------+\n| HOSTS | Flush the hostname cache (used for converting |\n| | ip to host names and for unblocking blocked |\n| | hosts. See max_connect_errors) |\n+---------------------------+------------------------------------------------+\n| INDEX_STATISTICS | Reset index statistics (see SHOW |\n| | INDEX_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| [ERROR | ENGINE | | Close and reopen the specified log type, or |\n| GENERAL | SLOW | BINARY | all log types if none are specified. FLUSH |\n| | RELAY] LOGS | RELAY LOGS [connection-name] can be used to |\n| | flush the relay logs for a specific |\n| | connection. Only one connection can be |\n| | specified per FLUSH command. See Multi-source |\n| | replication. FLUSH ENGINE LOGS will delete |\n| | all unneeded Aria redo logs. Since MariaDB |\n| | 10.1.30 and MariaDB 10.2.11, FLUSH BINARY |\n| | LOGS DELETE_DOMAIN_ID=(list-of-domains) can |\n| | be used to discard obsolete GTID domains from |\n| | the server\'s binary log state. In order for |\n| | this to be successful, no event group from |\n| | the listed GTID domains can be present in |\n| | existing binary log files. If some still |\n| | exist, then they must be purged prior to |\n| | executing this command. If the command |\n| | completes successfully, then it also rotates |\n| | the binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deprecated option, use RESET MASTER instead. |\n+---------------------------+------------------------------------------------+\n| PRIVILEGES | Reload all privileges from the privilege |\n| | tables in the mysql database. If the server |\n| | is started with --skip-grant-table option, |\n| | this will activate the privilege tables again. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Defragment the query cache to better utilize |\n| | its memory. If you want to reset the query |\n| | cache, you can do it with RESET QUERY CACHE. |\n+---------------------------+------------------------------------------------+\n| QUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deprecated option, use RESET REPLICA or RESET |\n| | SLAVE instead. |\n+---------------------------+------------------------------------------------+\n| SSL | Used to dynamically reinitialize the server\'s |\n| | TLS context by reloading the files defined by |\n| | several TLS system variables. See FLUSH SSL |\n| | for more information. This command was first |\n| | added in MariaDB 10.4.1. |\n+---------------------------+------------------------------------------------+\n| STATUS | Resets all server status variables that can |\n| | be reset to 0. Not all global status |\n| | variables support this, so not all global |\n| | values are reset. See FLUSH STATUS for more |\n| | information. |\n+---------------------------+------------------------------------------------+\n| TABLE | Close tables given as options or all open |\n| | tables if no table list was used. From |\n| | MariaDB 10.4.1, using without any table list |\n| | will only close tables not in use, and tables |\n| | not locked by the FLUSH TABLES connection. If |\n| | there are no locked tables, FLUSH TABLES will |\n| | be instant and will not cause any waits, as |\n| | it no longer waits for tables in use. When a |\n| | table list is provided, from MariaDB 10.4.1, |\n| | the server will wait for the end of any |\n| | transactions that are using the tables. |\n| | Previously, FLUSH TABLES only waited for the |\n| | statements to complete. |\n+---------------------------+------------------------------------------------+\n| TABLES | Same as FLUSH TABLE. |\n+---------------------------+------------------------------------------------+\n| TABLES ... FOR EXPORT | For InnoDB tables, flushes table changes to |\n| | disk to permit binary table copies while the |\n| | server is running. See FLUSH TABLES ... FOR |\n| | EXPORT for more. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | Closes all open tables. New tables are only |\n| | allowed to be opened with read locks until an |\n| | UNLOCK TABLES is given. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | As TABLES WITH READ LOCK but also disable all |\n| AND DISABLE CHECKPOINT | checkpoint writes by transactional table |\n| | engines. This is useful when doing a disk |\n| | snapshot of all tables. |\n+---------------------------+------------------------------------------------+\n| TABLE_STATISTICS | Reset table statistics (see SHOW |\n| | TABLE_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_RESOURCES | Resets all per hour user resources. This |\n| | enables clients that have exhausted their |\n| | resources to connect again. |\n+---------------------------+------------------------------------------------+\n| USER_STATISTICS | Reset user statistics (see SHOW |\n| | USER_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_VARIABLES | Reset user variables (see User-defined |\n| | variables). |\n+---------------------------+------------------------------------------------+\n\nYou can also use the mysqladmin client to flush things. Use mysqladmin --help\nto examine what flush commands it supports.\n\nFLUSH RELAY LOGS\n----------------\n\nFLUSH RELAY LOGS \'connection_name\';\n\nCompatibility with MySQL\n------------------------\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after the FLUSH command.\n\nFor example, one can now use:\n\nFLUSH RELAY LOGS FOR CHANNEL \'connection_name\';\n\nFLUSH STATUS\n------------\n\nServer status variables can be reset by executing the following:\n\nFLUSH STATUS;\n\nGlobal Status Variables that Support FLUSH STATUS\n-------------------------------------------------\n\nNot all global status variables support being reset by FLUSH STATUS.\nCurrently, the following status variables are reset by FLUSH STATUS:\n\n* Aborted_clients\n* Aborted_connects\n* Binlog_cache_disk_use\n* Binlog_cache_use\n* Binlog_stmt_cache_disk_use\n* Binlog_stmt_cache_use\n* Connection_errors_accept\n* Connection_errors_internal\n* Connection_errors_max_connections\n* Connection_errors_peer_address\n* Connection_errors_select\n* Connection_errors_tcpwrap\n* Created_tmp_files\n* Delayed_errors\n* Delayed_writes\n* Feature_check_constraint\n* Feature_delay_key_write\n* Max_used_connections\n* Opened_plugin_libraries\n* Performance_schema_accounts_lost\n* Performance_schema_cond_instances_lost\n* Performance_schema_digest_lost\n* Performance_schema_file_handles_lost\n* Performance_schema_file_instances_lost\n* Performance_schema_hosts_lost\n* Performance_schema_locker_lost\n* Performance_schema_mutex_instances_lost\n* Performance_schema_rwlock_instances_lost\n* Performance_schema_session_connect_attrs_lost\n* Performance_schema_socket_instances_lost\n* Performance_schema_stage_classes_lost\n* Performance_schema_statement_classes_lost\n* Performance_schema_table_handles_lost\n* Performance_schema_table_instances_lost\n* Performance_schema_thread_instances_lost\n* Performance_schema_users_lost\n* Qcache_hits\n* Qcache_inserts\n* Qcache_lowmem_prunes\n* Qcache_not_cached\n* Rpl_semi_sync_master_no_times\n* Rpl_semi_sync_master_no_tx\n* Rpl_semi_sync_master_timefunc_failures\n* Rpl_semi_sync_master_wait_pos_backtraverse\n* Rpl_semi_sync_master_yes_tx\n* Rpl_transactions_multi_engine\n* Server_audit_writes_failed\n* Slave_retried_transactions\n* Slow_launch_threads\n* Ssl_accept_renegotiates\n* Ssl_accepts\n* Ssl_callback_cache_hits\n* Ssl_client_connects\n* Ssl_connect_renegotiates\n* Ssl_ctx_verify_depth\n* Ssl_ctx_verify_mode\n* Ssl_finished_accepts\n* Ssl_finished_connects\n* Ssl_session_cache_hits\n* Ssl_session_cache_misses\n* Ssl_session_cache_overflows\n* Ssl_session_cache_size\n* Ssl_session_cache_timeouts\n* Ssl_sessions_reused\n* Ssl_used_session_cache_entries\n* Subquery_cache_hit\n* Subquery_cache_miss\n* Table_locks_immediate\n* Table_locks_waited\n* Tc_log_max_pages_used\n* Tc_log_page_waits\n* Transactions_gtid_foreign_engine\n* Transactions_multi_engine\n\nThe different usage of FLUSH TABLES\n-----------------------------------\n\nThe purpose of FLUSH TABLES\n---------------------------\n\nThe purpose of FLUSH TABLES is to clean up the open table cache and table\ndefinition cache from not in use tables. This frees up memory and file\ndescriptors. Normally this is not needed as the caches works on a FIFO bases,\nbut can be useful if the server seams to use up to much memory for some reason.\n\nThe purpose of FLUSH TABLES WITH READ LOCK \n-------------------------------------------\n\nFLUSH TABLES WITH READ LOCK is useful if you want to take a backup of some\ntables. When FLUSH TABLES WITH READ LOCK returns, all write access to tables\nare blocked and all tables are marked as \'properly closed\' on disk. The tables\ncan still be used for read operations.\n\nThe purpose of FLUSH TABLES table_list\n--------------------------------------\n\nFLUSH TABLES table_list is useful if you want to copy a table object/files to\nor from the server. This command puts a lock that stops new users of the table\nand will wait until everyone has stopped using the table. The table is then\nremoved from the table definition and table cache.\n\nNote that it\'s up to the user to ensure that no one is accessing the table\nbetween FLUSH TABLES and the table is copied to or from the server. This can\nbe secured by using LOCK TABLES.\n\nIf there are any tables locked by the connection that is using FLUSH TABLES','','https://mariadb.com/kb/en/flush/');
+update help_topic set description = CONCAT(description, '\nall the locked tables will be closed as part of the flush and reopened and\nrelocked before FLUSH TABLES returns. This allows one to copy the table after\nFLUSH TABLES returns without having any writes on the table. For now this\nworks works with most tables, except InnoDB as InnoDB may do background purges\non the table even while it\'s write locked.\n\nThe purpose of FLUSH TABLES table_list WITH READ LOCK\n-----------------------------------------------------\n\nFLUSH TABLES table_list WITH READ LOCK should work as FLUSH TABLES WITH READ\nLOCK, but only those tables that are listed will be properly closed. However\nin practice this works exactly like FLUSH TABLES WITH READ LOCK as the FLUSH\ncommand has anyway to wait for all WRITE operations to end because we are\ndepending on a global read lock for this code. In the future we should\nconsider fixing this to instead use meta data locks.\n\nImplementation of FLUSH TABLES commands in MariaDB 10.4.8 and above\n-------------------------------------------------------------------\n\nImplementation of FLUSH TABLES\n------------------------------\n\n* Free memory and file descriptors not in use\n\nImplementation of FLUSH TABLES WITH READ LOCK\n---------------------------------------------\n\n* Lock all tables read only for simple old style backup.\n* All background writes are suspended and tables are marked as closed.\n* No statement requiring table changes are allowed for any user until UNLOCK\nTABLES.\n\nInstead of using FLUSH TABLE WITH READ LOCK one should in most cases instead\nuse BACKUP STAGE BLOCK_COMMIT.\n\nImplementation of FLUSH TABLES table_list\n-----------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list.\n* Lock given tables as read only.\n* Wait until all translations has ended that uses any of the given tables.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n\nImplementation of FLUSH TABLES table_list FOR EXPORT\n----------------------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list\n* Lock given tables as read.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n* Check that all tables supports FOR EXPORT\n* No changes to these tables allowed until UNLOCK TABLES\n\nThis is basically the same behavior as in old MariaDB version if one first\nlock the tables, then do FLUSH TABLES. The tables will be copyable until\nUNLOCK TABLES.\n\nFLUSH SSL\n---------\n\nMariaDB starting with 10.4\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 to dynamically\nreinitialize the server\'s TLS context. This is most useful if you need to\nreplace a certificate that is about to expire without restarting the server.\n\nThis operation is performed by reloading the files defined by the following\nTLS system variables:\n\n* ssl_cert\n* ssl_key\n* ssl_ca\n* ssl_capath\n* ssl_crl\n* ssl_crlpath\n\nThese TLS system variables are not dynamic, so their values can not be changed\nwithout restarting the server.\n\nIf you want to dynamically reinitialize the server\'s TLS context, then you\nneed to change the certificate and key files at the relevant paths defined by\nthese TLS system variables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n\nReducing Memory Usage\n---------------------\n\nTo flush some of the global caches that take up memory, you could execute the\nfollowing command:\n\nFLUSH LOCAL HOSTS,\n QUERY CACHE,\n TABLE_STATISTICS,\n INDEX_STATISTICS,\n USER_STATISTICS;\n\nURL: https://mariadb.com/kb/en/flush/') WHERE help_topic_id = 342;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,26,'FLUSH QUERY CACHE','Description\n-----------\n\nYou can defragment the query cache to better utilize its memory with the FLUSH\nQUERY CACHE statement. The statement does not remove any queries from the\ncache.\n\nThe RESET QUERY CACHE statement removes all query results from the query\ncache. The FLUSH TABLES statement also does this.\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','Syntax\n------\n\nFLUSH TABLES table_name [, table_name] FOR EXPORT\n\nDescription\n-----------\n\nFLUSH TABLES ... FOR EXPORT flushes changes to the specified tables to disk so\nthat binary copies can be made while the server is still running. This works\nfor Archive, Aria, CSV, InnoDB, 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 EXPORT, a 1031 error\n(SQLSTATE \'HY000\') is produced.\n\nIf FLUSH TABLES ... FOR EXPORT is in effect in the session, the following\nstatements will produce an error if attempted:\n\n* FLUSH TABLES WITH READ LOCK\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* Any statement trying to update any table\n\nIf any of the following statements is in effect in the session, attempting\nFLUSH TABLES ... FOR EXPORT will produce an error.\n\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* LOCK TABLES ... READ\n* LOCK TABLES ... WRITE\n\nFLUSH FOR EXPORT is not written to the binary log.\n\nThis statement requires the RELOAD and the LOCK TABLES privileges.\n\nIf one of the specified tables cannot be locked, none of the tables will be\nlocked.\n\nIf a table does not exist, an error like the following will be 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 produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nExample\n-------\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\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,'SHOW RELAYLOG EVENTS','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n [ FOR CHANNEL \'channel_name\']\n\nDescription\n-----------\n\nOn replicas, this command shows the events in the relay log. If \'log_name\' is\nnot specified, the first relay log is shown.\n\nSyntax for the LIMIT clause is the same as for SELECT ... LIMIT.\n\nUsing the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS\ncommand returns the complete contents of the relay log, which can be quite\nlarge.\n\nThis command does not return events related to setting user and system\nvariables. If you need those, use mariadb-binlog/mysqlbinlog.\n\nOn the primary, this command does nothing.\n\nRequires the REPLICA MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION\nSLAVE ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege\n(<= MariaDB 10.5.1).\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the SHOW RELAYLOG statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW RELAYLOG.\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 (346,26,'SHOW SLAVE STATUS','Syntax\n------\n\nSHOW SLAVE [\"connection_name\"] STATUS [FOR CHANNEL \"connection_name\"]\nSHOW REPLICA [\"connection_name\"] STATUS -- From MariaDB 10.5.1\n\nor\n\nSHOW ALL SLAVES STATUS\nSHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1\n\nDescription\n-----------\n\nThis statement is to be run on a replica and provides status information on\nessential parameters of the replica threads.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege, or, from\nMariaDB 10.5.9, the REPLICA MONITOR privilege.\n\nMulti-Source\n------------\n\nThe ALL and \"connection_name\" options allow you to connect to many primaries\nat the same time.\n\nALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all\nconnections to the primary nodes.\n\nThe rows will be sorted according to Connection_name.\n\nIf you specify a connection_name, you only get the information about that\nconnection. If connection_name is not used, then the name set by\ndefault_master_connection is used. If the connection name doesn\'t exist you\nwill get an error: There is no master connection for \'xxx\'.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW SLAVE.\n\nColumn Descriptions\n-------------------\n\n+---------------+---------------------------------------+-------------------+\n| Name | Description | Added |\n+---------------+---------------------------------------+-------------------+\n| Connection_na | Name of the primary connection. | |\n| e | Returned with SHOW ALL SLAVES STATUS | |\n| | (or SHOW ALL REPLICAS STATUS from | |\n| | MariaDB 10.5.1) only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Sta | State of SQL thread. Returned with | |\n| e | SHOW ALL SLAVES STATUS (or SHOW ALL | |\n| | REPLICAS STATUS from MariaDB 10.5.1) | |\n| | only. See Slave SQL Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Stat | State of I/O thread. See Slave I/O | |\n| | Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Master_host | Master host that the replica is | |\n| | connected to. | |\n+---------------+---------------------------------------+-------------------+\n| Master_user | Account user name being used to | |\n| | connect to the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Master_port | The port being used to connect to | |\n| | the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Connect_Retry | Time in seconds between retries to | |\n| | connect. The default is 60. The | |\n| | CHANGE MASTER TO statement can set | |\n| | this. The master-retry-count option | |\n| | determines the maximum number of | |\n| | reconnection attempts. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Log_Fi | Name of the primary binary log file | |\n| e | that the I/O thread is currently | |\n| | reading from. | |\n+---------------+---------------------------------------+-------------------+\n| Read_Master_L | Position up to which the I/O thread | |\n| g_Pos | has read in the current primary | |\n| | binary log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Fil | Name of the relay log file that the | |\n| | SQL thread is currently processing. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Pos | Position up to which the SQL thread | |\n| | has finished processing in the | |\n| | current relay log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Master_ | Name of the primary binary log file | |\n| og_File | that contains the most recent event | |\n| | executed by the SQL thread. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Runn | Whether the replica I/O thread is | |\n| ng | running and connected (Yes), running | |\n| | but not connected to a primary | |\n| | (Connecting) or not running (No). | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | Whether or not the SQL thread is | |\n| ing | running. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Databases specified for replicating | |\n| B | with the replicate_do_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Databases specified for ignoring | |\n| re_DB | with the replicate_ignore_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Tables specified for replicating | |\n| able | with the replicate_do_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Tables specified for ignoring with | |\n| re_Table | the replicate_ignore_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for replicating | |\n| _Do_Table | with the replicate_wild_do_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for ignoring with | |\n| _Ignore_Table | the replicate_wild_ignore_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Last_Errno | Alias for Last_SQL_Errno (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Last Error | Alias for Last_SQL_Error (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Skip_Counter | Number of events that a replica | |\n| | skips from the master, as recorded | |\n| | in the sql_slave_skip_counter system | |\n| | variable. | |\n+---------------+---------------------------------------+-------------------+\n| Exec_Master_L | Position up to which the SQL thread | |\n| g_Pos | has processed in the current master | |\n| | binary log file. Can be used to | |\n| | start a new replica from a current | |\n| | replica with the CHANGE MASTER TO | |\n| | ... MASTER_LOG_POS option. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Spa | Total size of all relay log files | |\n| e | combined. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Conditi | | |\n| n | | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Fil | The MASTER_LOG_FILE value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Pos | The MASTER_LOG_POS value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Al | Whether an SSL connection is | |\n| owed | permitted (Yes), not permitted (No) | |\n| | or permitted but without the replica | |\n| | having SSL support enabled (Ignored) | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CA option of the | |\n| File | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CAPATH option of the | |\n| Path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ce | The MASTER_SSL_CERT option of the | |\n| t | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ci | The MASTER_SSL_CIPHER option of the | |\n| her | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ke | The MASTER_SSL_KEY option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Seconds_Behin | Difference between the timestamp | |\n| _Master | logged on the master for the event | |\n| | that the replica is currently | |\n| | processing, and the current | |\n| | timestamp on the replica. Zero if | |\n| | the replica is not currently | |\n| | processing an event. With parallel | |\n| | replication, seconds_behind_master | |\n| | is updated only after transactions | |\n| | commit. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ve | The MASTER_SSL_VERIFY_SERVER_CERT | |\n| ify_Server_Ce | option of the CHANGE MASTER TO | |\n| t | statement. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Errno | Error code of the most recent error | |\n| | that caused the I/O thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Error | Error message of the most recent | |\n| | error that caused the I/O thread to | |\n| | stop (also recorded in the replica\'s | |\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Errn | Error code of the most recent error | |\n| | that caused the SQL thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Erro | Error message of the most recent | |\n| | error that caused the SQL thread to | |\n| | stop (also recorded in the replica\'s | |','','https://mariadb.com/kb/en/show-replica-status/');
+update help_topic set description = CONCAT(description, '\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | List of server_ids that are | |\n| re_Server_Ids | currently being ignored for | |\n| | replication purposes, or an empty | |\n| | string for none, as specified in the | |\n| | IGNORE_SERVER_IDS option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Server | The master\'s server_id value. | |\n| Id | | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRL option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRLPATH option of the | |\n| path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Using_Gtid | Whether or not global transaction | |\n| | ID\'s are being used for replication | |\n| | (can be No, Slave_Pos, or | |\n| | Current_Pos). | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_IO_Pos | Current global transaction ID value. | |\n+---------------+---------------------------------------+-------------------+\n| Retried_trans | Number of retried transactions for | |\n| ctions | this connection. Returned with SHOW | |\n| | ALL SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Max_relay_log | Max relay log size for this | |\n| size | connection. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Executed_log_ | How many log entries the replica has | |\n| ntries | executed. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_receive | How many heartbeats we have got from | |\n| _heartbeats | the master. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_heartbe | How often to request a heartbeat | |\n| t_period | packet from the master (in seconds). | |\n| | Returned with SHOW ALL SLAVES STATUS | |\n| | only. | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_Slave_Po | GTID of the last event group | |\n| | replicated on a replica server, for | |\n| | each replication domain, as stored | |\n| | in the gtid_slave_pos system | |\n| | variable. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Delay | Value specified by MASTER_DELAY in | MariaDB 10.2.3 |\n| | CHANGE MASTER (or 0 if none). | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Remaining | When the replica is delaying the | MariaDB 10.2.3 |\n| Delay | execution of an event due to | |\n| | MASTER_DELAY, this is the number of | |\n| | seconds of delay remaining before | |\n| | the event will be applied. | |\n| | Otherwise, the value is NULL. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | The state of the SQL driver threads, | MariaDB 10.2.3 |\n| ing_State | same as in SHOW PROCESSLIST. When | |\n| | the replica is delaying the | |\n| | execution of an event due to | |\n| | MASTER_DELAY, this field displays: | |\n| | \"Waiting until MASTER_DELAY seconds | |\n| | after master executed event\". | |\n+---------------+---------------------------------------+-------------------+\n| Slave_DDL_Gro | This status variable counts the | MariaDB 10.3.7 |\n| ps | occurrence of DDL statements. This | |\n| | is a replica-side counter for | |\n| | optimistic parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Non_Tra | This status variable counts the | MariaDB 10.3.7 |\n| sactional_Gro | occurrence of non-transactional | |\n| ps | event groups. This is a | |\n| | replica-side counter for optimistic | |\n| | parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Transac | This status variable counts the | MariaDB 10.3.7 |\n| ional_Groups | occurrence of transactional event | |\n| | groups. This is a replica-side | |\n| | counter for optimistic parallel | |\n| | replication. | |\n+---------------+---------------------------------------+-------------------+\n\nSHOW REPLICA STATUS\n-------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA STATUS is an alias for SHOW SLAVE STATUS from MariaDB 10.5.1.\n\nExamples\n--------\n\nIf you issue this statement using the mysql client, you can use a \\G statement\nterminator rather than a semicolon to obtain a more readable vertical layout.\n\nSHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\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\nSHOW ALL SLAVES STATUS\\G\n*************************** 1. row ***************************\n Connection_name:\n Slave_SQL_State: Slave has read all relay log; waiting for the\nslave 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 status 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\nURL: https://mariadb.com/kb/en/show-replica-status/') WHERE help_topic_id = 346;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'SHOW MASTER STATUS','Syntax\n------\n\nSHOW MASTER STATUS\nSHOW BINLOG STATUS -- From MariaDB 10.5.2\n\nDescription\n-----------\n\nProvides status information about the binary log files of the primary.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the BINLOG MONITOR privilege.\n\nTo see information about the current GTIDs in the binary log, use the\ngtid_binlog_pos variable.\n\nSHOW MASTER STATUS was renamed to SHOW BINLOG STATUS in MariaDB 10.5.2, but\nthe old name remains an alias for compatibility purposes.\n\nExample\n-------\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\nURL: https://mariadb.com/kb/en/show-binlog-status/','','https://mariadb.com/kb/en/show-binlog-status/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'SHOW SLAVE HOSTS','Syntax\n------\n\nSHOW SLAVE HOSTS\nSHOW REPLICA HOSTS -- from MariaDB 10.5.1\n\nDescription\n-----------\n\nThis command is run on the primary and displays a list of replicas that are\ncurrently registered with it. Only replicas started with the\n--report-host=host_name option are visible in this list.\n\nThe list is displayed on any server (not just the primary server). 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+------------+-----------+------+-----------+\n\n* Server_id: The unique server ID of the replica server, as configured in the\nserver\'s option file, or on the command line with --server-id=value.\n* Host: The host name of the replica server, as configured in the server\'s\noption file, or on the command line with --report-host=host_name. Note that\nthis can differ from the machine name as configured in the operating system.\n* Port: The port the replica server is listening on.\n* Master_id: The unique server ID of the primary server that the replica\nserver is replicating from.\n\nSome MariaDB and MySQL versions report another variable, rpl_recovery_rank.\nThis variable was never used, and was eventually removed in MariaDB 10.1.2 .\n\nRequires the REPLICATION MASTER ADMIN privilege (>= MariaDB 10.5.2) or the\nREPLICATION SLAVE privilege (<= MariaDB 10.5.1).\n\nSHOW REPLICA HOSTS\n------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/show-replica-hosts/','','https://mariadb.com/kb/en/show-replica-hosts/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW PLUGINS','Syntax\n------\n\nSHOW PLUGINS;\n\nDescription\n-----------\n\nSHOW PLUGINS displays information about installed plugins. The Library column\nindicates the plugin library - if it is NULL, the plugin is built-in and\ncannot be uninstalled.\n\nThe PLUGINS table in the information_schema database contains more detailed\ninformation.\n\nFor specific information about storage engines (a particular type of plugin),\nsee the information_schema.ENGINES table and the SHOW ENGINES statement.\n\nExamples\n--------\n\nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| Name | Status | Type | Library |\nLicense |\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| binlog | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| Aria | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL |\nGPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so |\nGPL |\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 (350,26,'SHOW PLUGINS SONAME','Syntax\n------\n\nSHOW PLUGINS SONAME { library | LIKE \'pattern\' | WHERE expr };\n\nDescription\n-----------\n\nSHOW PLUGINS SONAME displays information about compiled-in and all server\nplugins in the plugin_dir directory, including plugins that haven\'t been\ninstalled.\n\nExamples\n--------\n\nSHOW PLUGINS SONAME \'ha_example.so\';\n+----------+---------------+----------------+---------------+---------+\n| Name | Status | Type | Library | License |\n+----------+---------------+----------------+---------------+---------+\n| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so | GPL |\n| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |\n+----------+---------------+----------------+---------------+---------+\n\nThere is also a corresponding information_schema table, called ALL_PLUGINS,\nwhich contains more complete information.\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 (351,26,'SET','Syntax\n------\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 syntax:\n\nuser_var_name:= expr\n\nDescription\n-----------\n\nThe SET statement assigns values to different types of variables that affect\nthe operation of the server or your client. Older versions of MySQL employed\nSET OPTION, but this syntax was deprecated in favor of SET without OPTION, and\nwas removed in MariaDB 10.0.\n\nChanging a system variable by using the SET statement does not make the change\npermanently. To do so, the change must be made in a configuration file.\n\nFor setting variables on a per-query basis, see SET STATEMENT.\n\nSee SHOW VARIABLES for documentation on viewing server system variables.\n\nSee Server System Variables for a list of all the system variables.\n\nGLOBAL / SESSION\n----------------\n\nWhen setting a system variable, the scope can be specified as either GLOBAL or\nSESSION.\n\nA global variable change affects all new sessions. It does not affect any\ncurrently open sessions, including the one that made the change.\n\nA session variable change affects the current session only.\n\nIf the variable has a session value, not specifying either GLOBAL or SESSION\nwill be the same as specifying SESSION. If the variable only has a global\nvalue, not specifying GLOBAL or SESSION will apply to the change to the global\nvalue.\n\nDEFAULT\n-------\n\nSetting a global variable to DEFAULT will restore it to the server default,\nand setting a session variable to DEFAULT will restore it to the current\nglobal value.\n\nExamples\n--------\n\n* innodb_sync_spin_loops is a global variable.\n* skip_parallel_replication is a session variable.\n* max_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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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;Query OK, 0 rows affected (0.000 sec)\n\nSET skip_parallel_replication=ON;Query OK, 0 rows affected (0.000 sec)\n\nSET innodb_sync_spin_loops=60;\nERROR 1229 (HY000): Variable \'innodb_sync_spin_loops\' is a GLOBAL 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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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;\nERROR 1228 (HY000): Variable \'skip_parallel_replication\' is 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 IN (\'max_error_count\', \'skip_parallel_replication\',\n\'innodb_sync_spin_loops\');\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 unless the variable is\nglobal only.\n\nSHOW VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nSHOW VARIABLES LIKE \'skip_parallel_replication\';\n+---------------------------+-------+\n| Variable_name | Value |\n+---------------------------+-------+\n| skip_parallel_replication | ON |\n+---------------------------+-------+\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\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| @a |\n+------+\n| 1 |\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 (352,26,'SET CHARACTER SET','Syntax\n------\n\nSET {CHARACTER SET | CHARSET}\n {charset_name | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client and character_set_results session system\nvariables to the specified character set and collation_connection to the value\nof collation_database, which implicitly sets character_set_connection to the\nvalue of character_set_database.\n\nThis maps all strings sent between the current client and the server with the\ngiven mapping.\n\nExample\n-------\n\nSHOW VARIABLES LIKE \'character_set\\_%\';\n+--------------------------+--------+\n| Variable_name | Value |\n+--------------------------+--------+\n| character_set_client | utf8 |\n| character_set_connection | utf8 |\n| character_set_database | latin1 |\n| character_set_filesystem | binary |\n| character_set_results | utf8 |\n| character_set_server | latin1 |\n| character_set_system | utf8 |\n+--------------------------+--------+\n\nSHOW VARIABLES LIKE \'collation%\';\n+----------------------+-------------------+\n| Variable_name | Value |\n+----------------------+-------------------+\n| collation_connection | utf8_general_ci |\n| collation_database | latin1_swedish_ci |\n| collation_server | latin1_swedish_ci |\n+----------------------+-------------------+\n\nSET CHARACTER SET utf8mb4;\n\nSHOW VARIABLES LIKE \'character_set\\_%\';\n+--------------------------+---------+\n| Variable_name | Value |\n+--------------------------+---------+\n| character_set_client | utf8mb4 |\n| character_set_connection | latin1 |\n| character_set_database | latin1 |\n| character_set_filesystem | binary |\n| character_set_results | utf8mb4 |\n| character_set_server | latin1 |\n| character_set_system | utf8 |\n+--------------------------+---------+\n\nSHOW VARIABLES LIKE \'collation%\';\n+----------------------+-------------------+\n| Variable_name | Value |\n+----------------------+-------------------+\n| collation_connection | latin1_swedish_ci |\n| collation_database | latin1_swedish_ci |\n| collation_server | latin1_swedish_ci |\n+----------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/set-character-set/','','https://mariadb.com/kb/en/set-character-set/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SET NAMES','Syntax\n------\n\nSET NAMES {\'charset_name\'\n [COLLATE \'collation_name\'] | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client, character_set_connection, character_set_results\nand, implicitly, the collation_connection session system variables to the\nspecified character set and collation.\n\nThis determines which character set the client will use to send statements to\nthe server, and the server will use for sending results back to the client.\n\nucs2, utf16, and utf32 are not valid character sets for SET NAMES, as they\ncannot be used as client character sets.\n\nThe collation clause is optional. If not defined (or if DEFAULT is specified),\nthe default collation for the character set will be used.\n\nQuotes are optional for the character set or collation clauses.\n\nExamples\n--------\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-----------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-----------------+\n| CHARACTER_SET_RESULTS | utf8 |\n| CHARACTER_SET_CONNECTION | utf8 |\n| CHARACTER_SET_CLIENT | utf8 |\n| COLLATION_CONNECTION | utf8_general_ci |\n+--------------------------+-----------------+\n\nSET NAMES big5;\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-----------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-----------------+\n| CHARACTER_SET_RESULTS | big5 |\n| CHARACTER_SET_CONNECTION | big5 |\n| CHARACTER_SET_CLIENT | big5 |\n| COLLATION_CONNECTION | big5_chinese_ci |\n+--------------------------+-----------------+\n\nSET NAMES \'latin1\' COLLATE \'latin1_bin\';\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+---------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+---------------+\n| CHARACTER_SET_RESULTS | latin1 |\n| CHARACTER_SET_CONNECTION | latin1 |\n| CHARACTER_SET_CLIENT | latin1 |\n| COLLATION_CONNECTION | latin1_bin |\n+--------------------------+---------------+\n\nSET NAMES DEFAULT;\n\nSELECT VARIABLE_NAME, SESSION_VALUE \n FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE\n VARIABLE_NAME LIKE \'character_set_c%\' OR\n VARIABLE_NAME LIKE \'character_set_re%\' OR\n VARIABLE_NAME LIKE \'collation_c%\';\n+--------------------------+-------------------+\n| VARIABLE_NAME | SESSION_VALUE |\n+--------------------------+-------------------+\n| CHARACTER_SET_RESULTS | latin1 |\n| CHARACTER_SET_CONNECTION | latin1 |\n| CHARACTER_SET_CLIENT | latin1 |\n| COLLATION_CONNECTION | latin1_swedish_ci |\n+--------------------------+-------------------+\n\nURL: https://mariadb.com/kb/en/set-names/','','https://mariadb.com/kb/en/set-names/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,26,'SET SQL_LOG_BIN','Syntax\n------\n\nSET [SESSION] sql_log_bin = {0|1}\n\nDescription\n-----------\n\nSets the sql_log_bin system variable, which disables or enables binary logging\nfor the current connection, if the client has the SUPER privilege. The\nstatement is refused with an error if the client does not have that privilege.\n\nBefore MariaDB 5.5 and before MySQL 5.6 one could also set sql_log_bin as a\nglobal variable. This was disabled as this was too dangerous as it could\ndamage replication.\n\nURL: https://mariadb.com/kb/en/set-sql_log_bin/','','https://mariadb.com/kb/en/set-sql_log_bin/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,26,'SET STATEMENT','MariaDB starting with 10.1.2\n----------------------------\nPer-query variables were introduced in MariaDB 10.1.2\n\nSET STATEMENT can be used to set the value of a system variable for the\nduration of the statement. It is also possible to set multiple variables.\n\nSyntax\n------\n\nSET STATEMENT var1=value1 [, var2=value2, ...] \n FOR <statement>\n\nwhere varN is a system variable (list of allowed variables is provided below),\nand valueN is a constant literal.\n\nDescription\n-----------\n\nSET STATEMENT var1=value1 FOR stmt\n\nis roughly equivalent to\n\nSET @save_value=@@var1;\nSET SESSION var1=value1;\nstmt;\nSET SESSION var1=@save_value;\n\nThe server parses the whole statement before executing it, so any variables\nset in this fashion that affect the parser may not have the expected effect.\nExamples include the charset variables, sql_mode=ansi_quotes, etc.\n\nExamples\n--------\n\nOne can limit statement execution time max_statement_time:\n\nSET STATEMENT max_statement_time=1000 FOR SELECT ... ;\n\nOne can switch on/off individual optimizations:\n\nSET STATEMENT optimizer_switch=\'materialization=off\' FOR SELECT ....;\n\nIt is possible to enable MRR/BKA for a query:\n\nSET STATEMENT join_cache_level=6, optimizer_switch=\'mrr=on\' FOR SELECT ...\n\nNote that it makes no sense to try to set a session variable inside a SET\nSTATEMENT:\n\n#USELESS STATEMENT\nSET STATEMENT sort_buffer_size = 100000 for SET SESSION sort_buffer_size =\n200000;\n\nFor the above, after setting sort_buffer_size to 200000 it will be reset to\nits original state (the state before the SET STATEMENT started) after the\nstatement execution.\n\nLimitations\n-----------\n\nThere are a number of variables that cannot be set on per-query basis. These\ninclude:\n\n* autocommit\n* character_set_client\n* character_set_connection\n* character_set_filesystem\n* collation_connection\n* default_master_connection\n* debug_sync\n* interactive_timeout\n* gtid_domain_id\n* last_insert_id\n* log_slow_filter\n* log_slow_rate_limit\n* log_slow_verbosity\n* long_query_time\n* min_examined_row_limit\n* profiling\n* profiling_history_size\n* query_cache_type\n* rand_seed1\n* rand_seed2\n* skip_replication\n* slow_query_log\n* sql_log_off\n* tx_isolation\n* wait_timeout\n\nSource\n------\n\n* The feature was originally implemented as a Google Summer of Code 2009\nproject by Joseph Lukas. \n* Percona Server 5.6 included it as Per-query variable statement\n* MariaDB ported the patch and fixed many bugs. The task in MariaDB Jira is\nMDEV-5231.\n\nURL: https://mariadb.com/kb/en/set-statement/','','https://mariadb.com/kb/en/set-statement/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,26,'SET Variable','Syntax\n------\n\nSET var_name = expr [, var_name = expr] ...\n\nDescription\n-----------\n\nThe SET statement in stored programs is an extended version of the general SET\nstatement. Referenced variables may be ones declared inside a stored program,\nglobal system variables, or user-defined variables.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x, b=y, ...\nwhere different variable types (locally declared variables, global and session\nserver variables, user-defined variables) can be mixed. This also allows\ncombinations of local variables and some options that make sense only for\nsystem variables; in that case, the options are recognized but ignored.\n\nSET can be used with both local variables and user-defined variables.\n\nWhen setting several variables using the columns returned by a query, SELECT\nINTO should be preferred.\n\nTo set many variables to the same value, the LAST_VALUE( ) function can be\nused.\n\nBelow is an example of how a user-defined variable may be set:\n\nSET @x = 1;\n\nURL: https://mariadb.com/kb/en/set-variable/','','https://mariadb.com/kb/en/set-variable/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (357,26,'About SHOW','SHOW has many forms that provide information about databases, tables, columns,\nor status information about the server. These include:\n\n* SHOW AUTHORS\n* SHOW CHARACTER SET [like_or_where]\n* SHOW COLLATION [like_or_where]\n* SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\n* SHOW CONTRIBUTORS\n* SHOW CREATE DATABASE db_name\n* SHOW CREATE EVENT event_name\n* SHOW CREATE PACKAGE package_name\n* SHOW CREATE PACKAGE BODY package_name\n* SHOW CREATE PROCEDURE proc_name\n* SHOW CREATE TABLE tbl_name\n* SHOW CREATE TRIGGER trigger_name\n* SHOW CREATE VIEW view_name\n* SHOW DATABASES [like_or_where]\n* SHOW ENGINE engine_name {STATUS | MUTEX}\n* SHOW [STORAGE] ENGINES\n* SHOW ERRORS [LIMIT [offset,] row_count]\n* SHOW [FULL] EVENTS\n* SHOW FUNCTION CODE func_name\n* SHOW FUNCTION STATUS [like_or_where]\n* SHOW GRANTS FOR user\n* SHOW INDEX FROM tbl_name [FROM db_name]\n* SHOW INNODB STATUS\n* SHOW OPEN TABLES [FROM db_name] [like_or_where]\n* SHOW PLUGINS\n* SHOW PROCEDURE CODE proc_name\n* SHOW PROCEDURE STATUS [like_or_where]\n* SHOW PRIVILEGES\n* SHOW [FULL] PROCESSLIST\n* SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\n* SHOW PROFILES\n* SHOW [GLOBAL | SESSION] STATUS [like_or_where]\n* SHOW TABLE STATUS [FROM db_name] [like_or_where]\n* SHOW TABLES [FROM db_name] [like_or_where]\n* SHOW TRIGGERS [FROM db_name] [like_or_where]\n* SHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\n* SHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\' part,\n\'pattern\' is a string that can contain the SQL \"%\" and \"_\" wildcard\ncharacters. The pattern is useful for restricting statement output to matching\nvalues.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See Extended Show.\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 (358,26,'Extended Show','The following SHOW statements can be extended by using a WHERE clause and a\nLIKE clause to refine the results:\n\n* SHOW CHARACTER SET\n* SHOW COLLATION\n* SHOW COLUMNS\n* SHOW DATABASES\n* SHOW FUNCTION STATUS\n* SHOW INDEX\n* SHOW OPEN TABLES\n* SHOW PACKAGE STATUS\n* SHOW PACKAGE BODY STATUS\n* SHOW INDEX\n* SHOW PROCEDURE STATUS\n* SHOW STATUS\n* SHOW TABLE STATUS\n* SHOW TABLES\n* SHOW TRIGGERS\n* SHOW VARIABLES\n\nAs with a regular SELECT, the WHERE clause can be used for the specific\ncolumns returned, and the LIKE clause with the regular wildcards.\n\nExamples\n--------\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\nVariables whose name starts with aria and with a valued of greater than 8192:\n\nSHOW VARIABLES WHERE Variable_name LIKE \'aria%\' AND Value >8192;\n+------------------------------+---------------------+\n| Variable_name | Value |\n+------------------------------+---------------------+\n| aria_checkpoint_log_activity | 1048576 |\n| aria_log_file_size | 1073741824 |\n| aria_max_sort_file_size | 9223372036853727232 |\n| aria_pagecache_buffer_size | 134217728 |\n| aria_sort_buffer_size | 134217728 |\n+------------------------------+---------------------+\n\nShortcut, just returning variables whose name begins with aria.\n\nSHOW VARIABLES LIKE \'aria%\';\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\nURL: https://mariadb.com/kb/en/extended-show/','','https://mariadb.com/kb/en/extended-show/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (359,26,'SHOW AUTHORS','Syntax\n------\n\nSHOW AUTHORS\n\nDescription\n-----------\n\nThe SHOW AUTHORS statement displays information about the people who work on\nMariaDB. For each author, it displays Name, Location, and Comment values. All\ncolumns are encoded as latin1.\n\nThese include:\n\n* First the active people in MariaDB are listed.\n* Then the active people in MySQL.\n* Last the people that have contributed to MariaDB/MySQL in the past.\n\nThe order is somewhat related to importance of the contribution given to the\nMariaDB project, but this is not 100% accurate. There is still room for\nimprovement and debate...\n\nExample\n-------\n\nSHOW AUTHORS\\G\n*************************** 1. row ***************************\n Name: Michael (Monty) Widenius\nLocation: Tusby, Finland\n Comment: Lead developer and main author\n*************************** 2. row ***************************\n Name: Sergei Golubchik\nLocation: Kerpen, Germany\n Comment: Architect, Full-text search, precision math, plugin framework,\nmerges etc\n*************************** 3. row ***************************\n Name: Igor Babaev\nLocation: Bellevue, USA\n Comment: Optimizer, keycache, core work\n*************************** 4. row ***************************\n Name: Sergey Petrunia\nLocation: St. Petersburg, Russia\n Comment: Optimizer\n*************************** 5. row ***************************\n Name: Oleksandr Byelkin\nLocation: Lugansk, Ukraine\n Comment: Query Cache (4.0), Subqueries (4.1), Views (5.0)\n*************************** 6. row ***************************\n Name: Timour Katchaounov\nLocation: Sofia , Bulgaria\n Comment: Optimizer\n*************************** 7. row ***************************\n Name: Kristian Nielsen\nLocation: Copenhagen, Denmark\n Comment: Replication, Async client prototocol, General buildbot stuff\n*************************** 8. row ***************************\n Name: Alexander (Bar) Barkov\nLocation: Izhevsk, Russia\n Comment: Unicode and character sets\n*************************** 9. row ***************************\n Name: Alexey Botchkov (Holyfoot)\nLocation: Izhevsk, Russia\n Comment: GIS extensions, embedded server, precision math\n*************************** 10. row ***************************\n Name: Daniel Bartholomew\nLocation: Raleigh, USA\n Comment: MariaDB documentation, Buildbot, releases\n*************************** 11. row ***************************\n Name: Colin Charles\nLocation: Selangor, Malesia\n Comment: MariaDB documentation, talks at a LOT of conferences\n*************************** 12. row ***************************\n Name: Sergey Vojtovich\nLocation: Izhevsk, Russia\n Comment: initial implementation of plugin architecture, maintained native\nstorage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of table cache\n*************************** 13. row ***************************\n Name: Vladislav Vaintroub\nLocation: Mannheim, Germany\n Comment: MariaDB Java connector, new thread pool, Windows optimizations\n*************************** 14. row ***************************\n Name: Elena Stepanova\nLocation: Sankt Petersburg, Russia\n Comment: QA, test cases\n*************************** 15. row ***************************\n Name: Georg Richter\nLocation: Heidelberg, Germany\n Comment: New LGPL C connector, PHP connector\n*************************** 16. row ***************************\n Name: Jan Lindström\nLocation: Ylämylly, Finland\n Comment: Working on InnoDB\n*************************** 17. row ***************************\n Name: Lixun Peng\nLocation: Hangzhou, China\n Comment: Multi Source replication\n*************************** 18. row ***************************\n Name: Olivier Bertrand\nLocation: Paris, France\n Comment: CONNECT storage engine\n*************************** 19. row ***************************\n Name: Kentoku Shiba\nLocation: Tokyo, Japan\n Comment: Spider storage engine, metadata_lock_info Information schema\n*************************** 20. row ***************************\n Name: Percona\nLocation: CA, USA\n Comment: XtraDB, microslow patches, extensions to slow log\n*************************** 21. row ***************************\n Name: Vicentiu Ciorbaru\nLocation: Bucharest, Romania\n Comment: Roles\n*************************** 22. row ***************************\n Name: Sudheera Palihakkara\nLocation: \n Comment: PCRE Regular Expressions\n*************************** 23. row ***************************\n Name: Pavel Ivanov\nLocation: USA\n Comment: Some patches and bug fixes\n*************************** 24. row ***************************\n Name: Konstantin Osipov\nLocation: Moscow, Russia\n Comment: Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)\n*************************** 25. row ***************************\n Name: Ian Gilfillan\nLocation: South Africa\n Comment: MariaDB documentation\n*************************** 26. row ***************************\n Name: Federico Razolli\nLocation: Italy\n Comment: MariaDB documentation Italian translation\n*************************** 27. row ***************************\n Name: Guilhem Bichot\nLocation: Bordeaux, France\n Comment: Replication (since 4.0)\n*************************** 28. row ***************************\n Name: Andrei Elkin\nLocation: Espoo, Finland\n Comment: Replication\n*************************** 29. row ***************************\n Name: Dmitri Lenev\nLocation: Moscow, Russia\n Comment: Time zones support (4.1), Triggers (5.0)\n*************************** 30. row ***************************\n Name: Marc Alff\nLocation: Denver, CO, USA\n Comment: Signal, Resignal, Performance schema\n*************************** 31. row ***************************\n Name: Mikael Ronström\nLocation: Stockholm, Sweden\n Comment: NDB Cluster, Partitioning, online alter table\n*************************** 32. row ***************************\n Name: Ingo Strüwing\nLocation: Berlin, Germany\n Comment: Bug fixing in MyISAM, Merge tables etc\n*************************** 33. row ***************************\n Name: Marko Mäkelä\nLocation: Helsinki, Finland\n Comment: InnoDB core developer\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 (360,26,'SHOW BINARY LOGS','Syntax\n------\n\nSHOW BINARY LOGS\nSHOW MASTER LOGS\n\nDescription\n-----------\n\nLists the binary log files on the server. This statement is used as part of\nthe procedure described in PURGE BINARY LOGS, that shows how to determine\nwhich logs can be purged.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the BINLOG MONITOR privilege.\n\nExamples\n--------\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\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 (361,26,'SHOW BINLOG EVENTS','Syntax\n------\n\nSHOW BINLOG EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n\nDescription\n-----------\n\nShows the events in the binary log. If you do not specify \'log_name\', the\nfirst binary log is displayed.\n\nRequires the BINLOG MONITOR privilege (>= MariaDB 10.5.2) or the REPLICATION\nSLAVE privilege (<= MariaDB 10.5.1).\n\nExample\n-------\n\nSHOW BINLOG EVENTS IN \'mysql_sandbox10019-bin.000002\';\n+-------------------------------+-----+-------------------+-----------+--------\n----+------------------------------------------------+\n| Log_name | Pos | Event_type | Server_id |\nEnd_log_pos | Info |\n+-------------------------------+-----+-------------------+-----------+--------\n----+------------------------------------------------+\n| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | \n 248 | Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |\n| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | \n 273 | [] |\n| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint | 1 | \n 325 | mysql_sandbox10019-bin.000002 |\n| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | \n 363 | GTID 0-1-1 |\n| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | \n 446 | CREATE DATABASE blog |\n| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | \n 484 | GTID 0-1-2 |\n| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | \n 571 | use `blog`; CREATE TABLE bb (id INT) |\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 (362,26,'SHOW CHARACTER SET','Syntax\n------\n\nSHOW CHARACTER SET\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW CHARACTER SET statement shows all available character sets. The LIKE\nclause, if present on its own, indicates which character set names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema CHARACTER_SETS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncharacter set at the server, database, table and column levels.\n\nExamples\n--------\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 | 1 |\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| 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\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 (363,26,'SHOW CLIENT_STATISTICS','Syntax\n------\n\nSHOW CLIENT_STATISTICS\n\nDescription\n-----------\n\nThe SHOW CLIENT_STATISTICS statement is part of the User Statistics feature.\nIt was removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.CLIENT_STATISTICS table holds statistics about client\nconnections.\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.CLIENT_STATISTICS articles for more\ninformation.\n\nExample\n-------\n\nSHOW CLIENT_STATISTICS\\G\n*************************** 1. row ***************************\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\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 (364,26,'SHOW CONTRIBUTORS','Syntax\n------\n\nSHOW CONTRIBUTORS\n\nDescription\n-----------\n\nThe SHOW CONTRIBUTORS statement displays information about the companies and\npeople who financially contribute to MariaDB. For each contributor, it\ndisplays Name, Location, and Comment values. All columns are encoded as latin1.\n\nIt displays all members and sponsors of the MariaDB Foundation as well as\nother financial contributors.\n\nExample\n-------\n\nSHOW CONTRIBUTORS;\n+---------------------+-------------------------------+------------------------\n------------------------------------+\n| Name | Location | Comment \n |\n+---------------------+-------------------------------+------------------------\n------------------------------------+\n| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| Tencent Cloud | https://cloud.tencent.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| Microsoft | https://microsoft.com/ | Platinum Sponsor of\nthe MariaDB Foundation |\n| MariaDB Corporation | https://mariadb.com | Founding member,\nPlatinum Sponsor of the MariaDB Foundation |\n| ServiceNow | https://servicenow.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| Intel | https://www.intel.com | Platinum Sponsor of\nthe MariaDB Foundation |\n| SIT | https://sit.org | Platinum Sponsor of\nthe MariaDB Foundation |\n| Visma | https://visma.com | Gold Sponsor of the\nMariaDB Foundation |\n| DBS | https://dbs.com | Gold Sponsor of the\nMariaDB Foundation |\n| IBM | https://www.ibm.com | Gold Sponsor of the\nMariaDB Foundation |\n| Automattic | https://automattic.com | Silver Sponsor of the\nMariaDB Foundation |\n| Percona | https://www.percona.com/ | Sponsor of the MariaDB\nFoundation |\n| Galera Cluster | https://galeracluster.com | Sponsor of the MariaDB\nFoundation |\n| Google | USA | Sponsoring encryption,\nparallel replication and GTID |\n| Facebook | USA | Sponsoring\nnon-blocking API, LIMIT ROWS EXAMINED etc |\n| Ronald Bradford | Brisbane, Australia | EFF contribution for\nUC2006 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\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 (365,26,'SHOW CREATE DATABASE','Syntax\n------\n\nSHOW CREATE {DATABASE | SCHEMA} db_name\n\nDescription\n-----------\n\nShows the CREATE DATABASE statement that creates the given database. SHOW\nCREATE SCHEMA is a synonym for SHOW CREATE DATABASE. SHOW CREATE DATABASE\nquotes database names according to the value of the sql_quote_show_create\nserver system variable.\n\nExamples\n--------\n\nSHOW CREATE DATABASE test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |\n+----------+-----------------------------------------------------------------+\n\nSHOW CREATE SCHEMA test;\n+----------+-----------------------------------------------------------------+\n| Database | Create Database |\n+----------+-----------------------------------------------------------------+\n| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET 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 latin1 */ |\n+----------+---------------------------------------------------------------+\n\nWith a comment, from MariaDB 10.5:\n\nSHOW CREATE DATABASE p;\n+----------+-------------------------------------------------------------------\n------------------+\n| Database | Create Database \n |\n+----------+-------------------------------------------------------------------\n------------------+\n| p | CREATE DATABASE `p` /*!40100 DEFAULT CHARACTER SET latin1 */\nCOMMENT \'presentations\' |\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 (366,26,'SHOW CREATE EVENT','Syntax\n------\n\nSHOW CREATE EVENT event_name\n\nDescription\n-----------\n\nThis statement displays the CREATE EVENT statement needed to re-create a given\nevent, as well as the SQL_MODE that was used when the trigger has been created\nand the character set used by the connection. To find out which events are\npresent, 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 more complete,\ninformation.\n\nExamples\n--------\n\nSHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\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 (367,26,'SHOW CREATE FUNCTION','Syntax\n------\n\nSHOW CREATE FUNCTION func_name\n\nDescription\n-----------\n\nThis statement is similar to SHOW CREATE PROCEDURE but for stored 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-------\n\nSHOW CREATE FUNCTION VatCents\\G\n*************************** 1. row ***************************\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\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 (368,26,'SHOW CREATE PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package specification.\n\nExamples\n--------\n\nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row ***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE\n\"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\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 (369,26,'SHOW CREATE PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package body (i.e. the\nimplementation).\n\nExamples\n--------\n\nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row ***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE BODY\n\"employee_tools\" AS\n\nstdRaiseAmount DECIMAL(10,2):=500;\n\nPROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n\nPROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename, esalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n\nFUNCTION 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=\' || nSalary);\n RETURN nSalary;\n END;\n\nPROCEDURE 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=\' || amount);\n END;\n\nPROCEDURE 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() || \' \' || current_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\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 (370,26,'SHOW CREATE PROCEDURE','Syntax\n------\n\nSHOW CREATE PROCEDURE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns the exact string that can be\nused to re-create the named stored procedure, as well as the SQL_MODE that was\nused when the trigger has been created and the character set used by the\nconnection.. A similar statement, SHOW CREATE FUNCTION, displays information\nabout stored functions.\n\nBoth statements require that you are the owner of the routine or have the\nSELECT privilege on the mysql.proc table. When neither is true, the statements\ndisplay NULL for the Create Procedure or Create Function field.\n\nWarning Users with SELECT privileges on mysql.proc or USAGE privileges on *.*\ncan view the text of routines, even when they do not have privileges for the\nfunction or procedure itself.\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--------\n\nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION\nstatements.\n\nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nSHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nWhen the user issuing the statement does not have privileges on the routine,\nattempting to CALL the procedure raises Error 1370.\n\nCALL test.prc1();\nError 1370 (42000): execute command denieed to user \'test_user\'@\'localhost\'\nfor routine \'test\'.\'prc1\'\n\nIf the user neither has privilege to the routine nor the SELECT privilege on\nmysql.proc table, it raises Error 1305, informing them that the procedure does\nnot exist.\n\nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\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 (371,26,'SHOW CREATE SEQUENCE','MariaDB starting with 10.3.1\n----------------------------\nSequences were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSHOW CREATE SEQUENCE sequence_name;\n\nDescription\n-----------\n\nShows the CREATE SEQUENCE statement that created the given sequence. The\nstatement requires the SELECT privilege for the table.\n\nExample\n-------\n\nCREATE SEQUENCE s1 START WITH 50;\nSHOW CREATE SEQUENCE s1\\G;\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue\n9223372036854775806 \n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nNotes\n-----\n\nIf you want to see the underlying table structure used for the SEQUENCE you\ncan use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the\ncurrent recorded state of the SEQUENCE:\n\nSHOW CREATE TABLE s1\\G\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\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 when sequences is\ncreated \n or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, \n 1 if the sequence should begin a new cycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have been done\'\n) ENGINE=InnoDB SEQUENCE=1\n\nSELECT * FROM s1\\G\n*************************** 1. row ***************************\nnext_not_cached_value: 50\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 50\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\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 (372,26,'SHOW CREATE TRIGGER','Syntax\n------\n\nSHOW CREATE TRIGGER trigger_name\n\nDescription\n-----------\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger, as well as the SQL_MODE that was used when the trigger has been\ncreated and the 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--------\n\nSHOW CREATE TRIGGER example\\G\n*************************** 1. row ***************************\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\n\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example\nBEFORE\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\nMariaDB starting with 10.2.3\n----------------------------\nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3 as part of\nintroducing multiple trigger events per action.\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 (373,26,'SHOW CREATE VIEW','Syntax\n------\n\nSHOW CREATE VIEW view_name\n\nDescription\n-----------\n\nThis statement shows a CREATE VIEW statement that creates the given view, as\nwell as the character set used by the connection when the view was created.\nThis statement also works with views.\n\nSHOW CREATE VIEW quotes table, column and stored function names according to\nthe value of the sql_quote_show_create server system variable.\n\nExamples\n--------\n\nSHOW CREATE VIEW example\\G\n*************************** 1. row ***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS `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 View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL\nSECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n\nGrants\n------\n\nTo be able to see a view, you need to have the SHOW VIEW and the SELECT\nprivilege on the view:\n\nGRANT SHOW VIEW,SELECT ON test_database.test_view TO \'test\'@\'localhost\';\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 (374,26,'SHOW DATABASES','Syntax\n------\n\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW DATABASES lists the databases on the MariaDB server host. SHOW SCHEMAS is\na synonym for SHOW DATABASES. The LIKE clause, if present on its own,\nindicates which database names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as discussed in Extended\nSHOW.\n\nYou see only those databases for which you have some kind of privilege, unless\nyou have the global SHOW DATABASES privilege. You can also get this list using\nthe mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you cannot use\nthis statement at all unless you have the SHOW DATABASES privilege.\n\nThe list of results returned by SHOW DATABASES is based on directories in the\ndata directory, which is how MariaDB implements databases. It\'s possible that\noutput includes directories that do not correspond to actual databases.\n\nThe Information Schema SCHEMATA table also contains database information.\n\nExamples\n--------\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\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 (375,26,'SHOW ENGINE','Syntax\n------\n\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nDescription\n-----------\n\nSHOW ENGINE displays operational information about a storage engine. The\nfollowing statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\nSHOW ENGINE ROCKSDB STATUS\n\nIf the Sphinx Storage Engine is installed, the following is also supported:\n\nSHOW ENGINE SPHINX STATUS\n\nSee SHOW ENGINE SPHINX STATUS.\n\nOlder (and now removed) synonyms were SHOW INNODB STATUS for SHOW ENGINE\nINNODB STATUS and SHOW MUTEX STATUS for SHOW ENGINE INNODB MUTEX.\n\nSHOW ENGINE INNODB STATUS\n-------------------------\n\nSHOW ENGINE INNODB STATUS displays extensive information from the standard\nInnoDB Monitor about the state of the InnoDB storage engine. See SHOW ENGINE\nINNODB STATUS for more.\n\nSHOW ENGINE INNODB MUTEX\n------------------------\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n\nThe statement displays the following output fields:\n\n* Type: Always InnoDB.\n* Name: The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number is dependent on the\nMariaDB version.\n* Status: This field displays the following values if UNIV_DEBUG was defined\nat compilation time (for example, in include/univ.h in the InnoDB part of the\nsource tree). Only the os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the output is based is\ninsufficient to distinguish regular mutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer). Consequently, the\n output may appear to contain multiple rows for the same mutex.\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. (spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits. This occurs when\n the spinlock did not work (the mutex was not locked during the spinlock and\n it was necessary to yield to the operating system and wait).\nos_yields indicates the number of times a the thread trying to lock a mutex\n gave up its timeslice and yielded to the operating system (on the\n presumption that allowing other threads to run will free the mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in operating system\n waits, if the timed_mutexes system variable is 1 (ON). If timed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0. timed_mutexes is off by\n default.\n\nInformation from this statement can be used to diagnose system problems. For\nexample, large values of spin_waits and spin_rounds may indicate scalability\nproblems.\n\nThe information_schema.INNODB_MUTEXES table provides similar information.\n\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n-------------------------------------\n\nThis statement shows how much memory is used for performance_schema tables and\ninternal buffers.\n\nThe output contains the following fields:\n\n* Type: Always performance_schema.\n* Name: The name of a table, the name of an internal buffer, or the\nperformance_schema word, followed by a dot and an attribute. Internal buffers\nnames are enclosed by parenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \n* Status: The value for the attribute.\n\nThe following attributes are shown, in this order, for all tables:\n\n* row_size: The memory used for an individual record. This value will never\nchange.\n* row_count: The number of rows in the table or buffer. For some tables, this\nvalue depends on a server system variable.\n* memory: For tables and performance_schema, this is the result of row_size *\nrow_count.\n\nFor internal buffers, the attributes are:\n\n* count\n* size\n\nSHOW ENGINE ROCKSDB STATUS\n--------------------------\n\nSee also MyRocks Performance Troubleshooting\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 (376,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that\ndisplays the InnoDB Monitor output, which is extensive InnoDB information\nwhich can be useful in diagnosing problems.\n\nThe following sections are displayed\n\n* Status: Shows the timestamp, monitor name and the number of seconds, or the\nelapsed time between the current time and the time the InnoDB Monitor output\nwas last displayed. The per-second averages are based upon this time.\n* BACKGROUND THREAD: srv_master_thread lines show work performed by the main\nbackground thread.\n* SEMAPHORES: Threads waiting for a semaphore and stats on how the number of\ntimes threads have needed a spin or a wait on a mutex or rw-lock semaphore. If\nthis number of threads is large, there may be I/O or contention issues.\nReducing the size of the innodb_thread_concurrency system variable may help if\ncontention is related to thread scheduling. Spin rounds per wait shows the\nnumber of spinlock rounds per OS wait for a mutex. \n* LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key\nconstraint error, it displays the failed statement and information about the\nconstraint and the related tables.\n* LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it\ndisplays the transactions involved in the deadlock and the statements being\nexecuted, held and required locked and the transaction rolled back to.\n* TRANSACTIONS: The output of this section can help identify lock contention,\nas well as reasons for the deadlocks.\n* FILE I/O: InnoDB thread information as well as pending I/O operations and\nI/O performance statistics.\n* INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for\nthe change buffer) and adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive hash index\nperformance.\n* LOG: InnoDB log information, including current log sequence number, how far\nthe log has been flushed to disk, the position at which InnoDB last took a\ncheckpoint, pending writes and write performance statistics.\n* BUFFER POOL AND MEMORY: Information on buffer pool pages read and written,\nwhich allows you to see the number of data file I/O operations performed by\nyour queries. See InnoDB Buffer Pool for more. Similar information is also\navailable from the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\n* ROW OPERATIONS:Information about the main thread, including the number and\nperformance rate for each type of row operation.\n\nIf the innodb_status_output_locks system variable is set to 1, extended lock\ninformation will be displayed.\n\nExample output:\n\n=====================================\n2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 4 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle\nsrv_master_thread log flush and writes: 83682\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 15\nOS WAIT ARRAY INFO: signal count 8\nRW-shared spins 0, rounds 20, OS waits 7\nRW-excl spins 0, rounds 0, OS waits 0\nRW-sx spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx\n------------\nTRANSACTIONS\n------------\nTrx id counter 236\nPurge done for trx\'s n:o < 236 undo n:o < 0 state: running\nHistory list length 22\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 421747401994584, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n---TRANSACTION 421747401990328, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests (insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log thread)\nI/O thread 2 state: waiting for completed aio requests (read thread)\nI/O thread 3 state: waiting for completed aio requests (read thread)\nI/O thread 4 state: waiting for completed aio requests (read thread)\nI/O thread 5 state: waiting for completed aio requests (read thread)\nI/O thread 6 state: waiting for completed aio requests (write thread)\nI/O thread 7 state: waiting for completed aio requests (write thread)\nI/O thread 8 state: waiting for completed aio requests (write thread)\nI/O thread 9 state: waiting for completed aio requests (write thread)\nPending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,\n ibuf aio reads:, log i/o\'s:, sync i/o\'s:\nPending flushes (fsync) log: 0; buffer pool: 0\n286 OS file reads, 171 OS file writes, 22 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\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 445926\nLog flushed up to 445926\nPages flushed up to 445926\nLast checkpoint at 445917\n0 pending log flushes, 0 pending chkp writes\n18 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal large memory allocated 167772160\nDictionary memory allocated 50768\nBuffer pool size 8012\nFree buffers 7611\nDatabase pages 401\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 264, created 137, written 156\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, Random read ahead\n0.00/s\nLRU len: 401, 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\nProcess ID=4267, Main thread ID=140272021272320, state: sleeping\nNumber of rows inserted 1, updated 0, deleted 0, read 1\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 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\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 (377,26,'SHOW ENGINES','Syntax\n------\n\nSHOW [STORAGE] ENGINES\n\nDescription\n-----------\n\nSHOW ENGINES displays status information about the server\'s storage engines.\nThis is particularly useful for checking whether a storage engine is\nsupported, or to see what the default engine is. SHOW TABLE TYPES is a\ndeprecated synonym.\n\nThe information_schema.ENGINES table provides the same information.\n\nSince storage engines are plugins, different information about them is also\nshown in the information_schema.PLUGINS table and by the SHOW PLUGINS\nstatement.\n\nNote that both MySQL\'s InnoDB and Percona\'s XtraDB replacement are labeled as\nInnoDB. However, if XtraDB is in use, it will be specified in the COMMENT\nfield. See XtraDB and InnoDB. The same applies to FederatedX.\n\nThe output consists of the following columns:\n\n* Engine indicates the engine\'s name.\n* Support indicates whether the engine is installed, and whether it is the\ndefault engine for the current session.\n* Comment is a brief description.\n* Transactions, XA and Savepoints indicate whether transactions, XA\ntransactions and transaction savepoints are supported by the engine.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n*************************** 1. row ***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and foreign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row ***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row ***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row ***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it disappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row ***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row ***************************\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 Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row ***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row ***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row ***************************\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\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 (378,26,'SHOW ERRORS','Syntax\n------\n\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) ERRORS\n\nDescription\n-----------\n\nThis statement is similar to SHOW WARNINGS, except that instead of displaying\nerrors, warnings, and notes, it displays only errors.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nThe SHOW COUNT(*) ERRORS statement displays the number of errors. You can also\nretrieve this number from the error_count variable.\n\nSHOW COUNT(*) ERRORS;\nSELECT @@error_count;\n\nThe value of error_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nFor a list of MariaDB error codes, see MariaDB Error Codes.\n\nExamples\n--------\n\nSELECT f();\nERROR 1305 (42000): FUNCTION f does not exist\n\nSHOW COUNT(*) ERRORS;\n+-----------------------+\n| @@session.error_count |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nSHOW ERRORS;\n+-------+------+---------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------+\n| Error | 1305 | FUNCTION f does not exist |\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 (379,26,'SHOW EVENTS','Syntax\n------\n\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nShows information about Event Manager events (created with CREATE EVENT).\nRequires the EVENT privilege. Without any arguments, SHOW EVENTS lists all of\nthe events in the current 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 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 look at the\ninformation_schema.EVENTS table.\n\nTo see events for a specific schema, use the FROM clause. For example, to see\nevents for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The WHERE\nclause can be given to select rows using more general conditions, as discussed\nin Extended Show.\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 (380,26,'SHOW FUNCTION STATUS','Syntax\n------\n\nSHOW FUNCTION STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is similar to SHOW PROCEDURE STATUS but for stored functions.\n\nThe LIKE clause, if present on its own, indicates which function names to\nmatch.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe information_schema.ROUTINES table contains more detailed information.\n\nExamples\n--------\n\nShowing all stored functions:\n\nSHOW FUNCTION STATUS\\G\n*************************** 1. row ***************************\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 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\' \\G\n*************************** 1. row ***************************\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\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 (381,26,'SHOW LOCALES','SHOW LOCALES was introduced as part of the Information Schema plugin extension.\n\nSHOW LOCALES is used to return locales information as part of the Locales\nplugin. While the information_schema.LOCALES table has 8 columns, the SHOW\nLOCALES statement will only display 4 of them:\n\nExample\n-------\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\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 OPEN TABLES','Syntax\n------\n\nSHOW OPEN TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open in the\ntable cache. See http://dev.mysql.com/doc/refman/5.1/en/table-cache.html.\n\nThe FROM and LIKE clauses may be used.\n\nThe FROM clause, if present, restricts the tables shown to those present in\nthe db_name database.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Database | Database name. |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| In_use | Number of table instances being used. |\n+---------------------------+------------------------------------------------+\n| Name_locked | 1 if the table is name-locked, e.g. if it is |\n| | being dropped or renamed, otherwise 0. |\n+---------------------------+------------------------------------------------+\n\nBefore MariaDB 5.5, each use of, for example, LOCK TABLE ... WRITE would\nincrement In_use for that table. With the implementation of the metadata\nlocking improvements in MariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL\nlock, and concurrent connections will wait on this MDL lock, so any subsequent\nLOCK TABLE... WRITE will not increment In_use.\n\nExample\n-------\n\nSHOW OPEN TABLES;\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\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 (383,26,'SHOW PACKAGE BODY STATUS','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW PACKAGE BODY STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE BODY STATUS statement returns characteristics of stored\npackage bodies (implementations), such as the database, name, type, creator,\ncreation and modification dates, and character set information. A similar\nstatement, SHOW PACKAGE STATUS, displays information about stored package\nspecifications.\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE\nand LIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PACKAGE BODY STATUS LIKE \'pkg1\'\\G\n*************************** 1. row ***************************\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\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 (384,26,'SHOW PACKAGE STATUS','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW PACKAGE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe SHOW PACKAGE STATUS statement returns characteristics of stored package\nspecifications, such as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar statement, SHOW\nPACKAGE BODY STATUS, displays information about stored package bodies (i.e.\nimplementations).\n\nThe LIKE clause, if present, indicates which package names to match. The WHERE\nand LIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PACKAGE STATUS LIKE \'pkg1\'\\G\n*************************** 1. row ***************************\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\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 (385,26,'SHOW PRIVILEGES','Syntax\n------\n\nSHOW PRIVILEGES\n\nDescription\n-----------\n\nSHOW PRIVILEGES shows the list of system privileges that the MariaDB server\nsupports. The exact list of privileges depends on the version of your server.\n\nNote that before MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.2 , the\nDelete history privilege displays as Delete versioning rows (MDEV-20382).\n\nExample\n-------\n\nFrom MariaDB 10.5.9\n\nSHOW PRIVILEGES;\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Privilege | Context | Comment \n |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Alter | Tables | To alter\nthe table |\n| Alter routine | Functions,Procedures | To alter\nor drop stored functions/procedures |\n| Create | Databases,Tables,Indexes | To create\nnew databases and tables |\n| Create routine | Databases | To use\nCREATE FUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use\nCREATE TEMPORARY TABLE |\n| Create view | Tables | To create\nnew views |\n| Create user | Server Admin | To create\nnew users |\n| Delete | Tables | To delete\nexisting rows |\n| Delete history | Tables | To delete\nversioning table historical rows |\n| Drop | Databases,Tables | To drop\ndatabases, tables, and views |\n| Event | Server Admin | To\ncreate, alter, drop and execute events |\n| Execute | Functions,Procedures | To\nexecute stored routines |\n| File | File access on server | To read\nand write files on the server |\n| Grant option | Databases,Tables,Functions,Procedures | To give\nto other users those privileges you possess |\n| Index | Tables | To create\nor drop indexes |\n| Insert | Tables | To insert\ndata into tables |\n| Lock tables | Databases | To use\nLOCK TABLES (together with SELECT privilege) |\n| Process | Server Admin | To view\nthe plain text of currently executing queries |\n| Proxy | Server Admin | To make\nproxy user possible |\n| References | Databases,Tables | To have\nreferences on tables |\n| Reload | Server Admin | To reload\nor refresh tables, logs and privileges |\n| Binlog admin | Server | To purge\nbinary logs |\n| Binlog monitor | Server | To use\nSHOW BINLOG STATUS and SHOW BINARY LOG |\n| Binlog replay | Server | To use\nBINLOG (generated by mariadb-binlog) |\n| Replication master admin | Server | To\nmonitor connected slaves |\n| Replication slave admin | Server | To\nstart/stop slave and apply binlog events |\n| Slave monitor | Server | To use\nSHOW SLAVE STATUS and SHOW RELAYLOG EVENTS |\n| Replication slave | Server Admin | To read\nbinary log events from the master |\n| Select | Tables | To\nretrieve rows from table |\n| Show databases | Server Admin | To see\nall databases with SHOW DATABASES |\n| Show view | Tables | To see\nviews with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut\ndown the server |\n| Super | Server Admin | To use\nKILL thread, SET GLOBAL, CHANGE MASTER, etc. |\n| Trigger | Tables | To use\ntriggers |\n| Create tablespace | Server Admin | To\ncreate/alter/drop tablespaces |\n| Update | Tables | To update\nexisting rows |\n| Set user | Server | To create\nviews and stored routines with a different definer |\n| Federated admin | Server | To\nexecute the CREATE SERVER, ALTER SERVER, DROP SERVER statements |\n| Connection admin | Server | To bypass\nconnection limits and kill other users\' connections |\n| Read_only admin | Server | To\nperform write operations even if @@read_only=ON |\n| Usage | Server Admin | No\nprivileges - allow connect only |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n41 rows in set (0.000 sec)\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 (386,26,'SHOW PROCEDURE CODE','Syntax\n------\n\nSHOW PROCEDURE CODE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension that is available only for servers that\nhave been built with debugging support. It displays a representation of the\ninternal implementation of the named stored procedure. A similar statement,\nSHOW FUNCTION CODE, displays information about stored functions.\n\nBoth statements require that you be the owner of the routine or have SELECT\naccess to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result set. Each\nrow in the result set corresponds to one \"instruction\" in the routine. The\nfirst column is Pos, which is an ordinal number beginning with 0. The second\ncolumn is Instruction, which contains an SQL statement (usually changed from\nthe original source), or a directive which has meaning only to the\nstored-routine handler.\n\nExamples\n--------\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\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 (387,26,'SHOW PROCEDURE STATUS','Syntax\n------\n\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns characteristics of a stored\nprocedure, such as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar statement, SHOW\nFUNCTION STATUS, displays information about stored functions.\n\nThe LIKE clause, if present, indicates which procedure or function names to\nmatch. The WHERE and LIKE clauses can be given to select rows using more\ngeneral conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row ***************************\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\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 (388,26,'SHOW PROCESSLIST','Syntax\n------\n\nSHOW [FULL] PROCESSLIST\n\nDescription\n-----------\n\nSHOW PROCESSLIST shows you which threads are running. You can also get this\ninformation from the information_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. If you have the PROCESS privilege, you can see all\nthreads. Otherwise, you can see only your own threads (that is, threads\nassociated with the MariaDB account that you are using). If you do not use the\nFULL keyword, only the first 100 characters of each statement are shown in the\nInfo field.\n\nThe columns shown in SHOW PROCESSLIST are:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| ID | The client\'s process ID. |\n+---------------------+------------------------------------------------------+\n| USER | The username associated with the process. |\n+---------------------+------------------------------------------------------+\n| HOST | The host the client is connected to. |\n+---------------------+------------------------------------------------------+\n| DB | The default database of the process (NULL if no |\n| | default). |\n+---------------------+------------------------------------------------------+\n| COMMAND | The command type. See Thread Command Values. |\n+---------------------+------------------------------------------------------+\n| TIME | The amount of time, in seconds, the process has |\n| | been in its current state. For a replica SQL thread |\n| | before MariaDB 10.1, this is the time in seconds |\n| | between the last replicated event\'s timestamp and |\n| | the replica machine\'s real time. |\n+---------------------+------------------------------------------------------+\n| STATE | See Thread States. |\n+---------------------+------------------------------------------------------+\n| INFO | The statement being executed. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The total progress of the process (0-100%) (see |\n| | Progress Reporting). |\n+---------------------+------------------------------------------------------+\n\nSee TIME_MS column in information_schema.PROCESSLIST for differences in the\nTIME column between MariaDB and MySQL.\n\nThe information_schema.PROCESSLIST table contains the following additional\ncolumns:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| TIME_MS | The amount of time, in milliseconds, the process |\n| | has been in its current state. |\n+---------------------+------------------------------------------------------+\n| STAGE | The stage the process is currently in. |\n+---------------------+------------------------------------------------------+\n| MAX_STAGE | The maximum number of stages. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The progress of the process within the current |\n| | stage (0-100%). |\n+---------------------+------------------------------------------------------+\n| MEMORY_USED | The amount of memory used by the process. |\n+---------------------+------------------------------------------------------+\n| EXAMINED_ROWS | The number of rows the process has examined. |\n+---------------------+------------------------------------------------------+\n| QUERY_ID | Query ID. |\n+---------------------+------------------------------------------------------+\n\nNote that the PROGRESS field from the information schema, and the PROGRESS\nfield from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows\nthe total progress, while the information schema shows the progress for the\ncurrent stage only.\n\nThreads can be killed using their thread_id or their query_id, with the KILL\nstatement.\n\nSince queries on this table are locking, if the performance_schema is enabled,\nyou may want to query the THREADS table instead.\n\nExamples\n--------\n\nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| Id | User | Host | db | Command | Time | State \n | Info | Progress |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty\nqueue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock \n | SHOW PROCESSLIST | 0.000 |\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 (389,26,'SHOW PROFILE','Syntax\n------\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-----------\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling information\nthat indicates resource usage for statements executed during the course of the\ncurrent session.\n\nProfiling is controlled by the profiling session variable, which has a default\nvalue of 0 (OFF). Profiling is enabled by setting profiling to 1 or ON:\n\nSET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nmaster. The size of the list is controlled by the profiling_history_size\nsession variable, which has a default value of 15. The maximum value is 100.\nSetting the value to 0 has the practical effect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILES and SHOW PROFILE, so you will\nfind neither of those statements in the profile list. Malformed statements are\nprofiled. For example, SHOW PROFILING is an illegal statement, and a syntax\nerror occurs if you try to execute it, but it will show up in the profiling\nlist.\n\nSHOW PROFILE displays detailed information about a single statement. Without\nthe FOR QUERY n clause, the output pertains to the most recently executed\nstatement. If FOR QUERY n is included, SHOW PROFILE displays information for\nstatement n. The values of n correspond to the Query_ID values displayed by\nSHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to row_count rows.\nIf LIMIT is given, OFFSET offset may be added to begin the output offset rows\ninto the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The Status\nvalues are like the State values displayed by SHOW PROCESSLIST, although there\nmight be some minor differences in interpretation for the two statements for\nsome 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 additional types of\ninformation:\n\n* ALL displays all information\n* BLOCK IO displays counts for block input and output operations\n* CONTEXT SWITCHES displays counts for voluntary and involuntary context\nswitches\n* CPU displays user and system CPU usage times\n* IPC displays counts for messages sent and received\n* MEMORY is not currently implemented\n* PAGE FAULTS displays counts for major and minor page faults\n* SOURCE displays the names of functions from the source code, together with\nthe name and line number of the file in which the function occurs\n* SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nThe information_schema.PROFILING table contains similar information.\n\nExamples\n--------\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\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 (390,26,'SHOW PROFILES','Syntax\n------\n\nSHOW PROFILES\n\nDescription\n-----------\n\nThe SHOW PROFILES statement displays profiling information that indicates\nresource usage for statements executed during the course of the current\nsession. It is used together with SHOW PROFILE.\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 (391,26,'SHOW QUERY_RESPONSE_TIME','It is possible to use SHOW QUERY_RESPONSE_TIME as an alternative for\nretrieving information from the QUERY_RESPONSE_TIME plugin.\n\nThis was introduced as part of the Information Schema plugin extension.\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 (392,26,'SHOW STATUS','Syntax\n------\n\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW STATUS provides server status information. This information also can be\nobtained using the mysqladmin extended-status command, or by querying the\nInformation Schema GLOBAL_STATUS and SESSION_STATUS tables. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for all\nconnections to MariaDB. With SESSION, it displays the status values for the\ncurrent connection. If no modifier is present, the default is SESSION. LOCAL\nis a synonym for SESSION. If you see a lot of 0 values, the reason is probably\nthat you have used SHOW STATUS with a new connection instead of SHOW GLOBAL\nSTATUS.\n\nSome status variables have only a global value. For these, you get the same\nvalue for both GLOBAL and SESSION.\n\nSee Server Status Variables for a full list, scope and description of the\nvariables that can be viewed with SHOW STATUS.\n\nThe LIKE clause, if present on its own, indicates which variable name to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nFull output from MariaDB 10.1.17:\n\nSHOW GLOBAL STATUS;\n+--------------------------------------------------------------+---------------\n------------------------+\n| Variable_name | Value \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n| Aborted_clients | 0 \n |\n| Aborted_connects | 0 \n |\n| Access_denied_errors | 0 \n |\n| Acl_column_grants | 0 \n |\n| Acl_database_grants | 2 \n |\n| Acl_function_grants | 0 \n |\n| Acl_procedure_grants | 0 \n |\n| Acl_proxy_users | 2 \n |\n| Acl_role_grants | 0 \n |\n| Acl_roles | 0 \n |\n| Acl_table_grants | 0 \n |\n| Acl_users | 6 \n |\n| Aria_pagecache_blocks_not_flushed | 0 \n |\n| Aria_pagecache_blocks_unused | 15706 \n |\n| Aria_pagecache_blocks_used | 0 \n |\n| Aria_pagecache_read_requests | 0 \n |\n| Aria_pagecache_reads | 0 \n |\n| Aria_pagecache_write_requests | 0 \n |\n| Aria_pagecache_writes | 0 \n |\n| Aria_transaction_log_syncs | 0 \n |\n| Binlog_commits | 0 \n |\n| Binlog_group_commits | 0 \n |\n| Binlog_group_commit_trigger_count | 0 \n |\n| Binlog_group_commit_trigger_lock_wait | 0 \n |\n| Binlog_group_commit_trigger_timeout | 0 \n |\n| Binlog_snapshot_file | \n |\n| Binlog_snapshot_position | 0 \n |\n| Binlog_bytes_written | 0 \n |\n| Binlog_cache_disk_use | 0 \n |\n| Binlog_cache_use | 0 \n |\n| Binlog_stmt_cache_disk_use | 0 \n |\n| Binlog_stmt_cache_use | 0 \n |\n| Busy_time | 0.000000 \n |\n| Bytes_received | 432 \n |\n| Bytes_sent | 15183 \n |\n| Com_admin_commands | 1 \n |\n| Com_alter_db | 0 \n |\n| Com_alter_db_upgrade | 0 \n |\n| Com_alter_event | 0 \n |\n| Com_alter_function | 0 \n |\n| Com_alter_procedure | 0 \n |\n| Com_alter_server | 0 \n |\n| Com_alter_table | 0 \n |\n| Com_alter_tablespace | 0 \n |\n| Com_analyze | 0 \n |\n| Com_assign_to_keycache | 0 \n |\n| Com_begin | 0 \n |\n| Com_binlog | 0 \n |\n| Com_call_procedure | 0 \n |\n| Com_change_db | 0 \n |\n| Com_change_master | 0 \n |\n| Com_check | 0 \n |\n| Com_checksum | 0 \n |\n| Com_commit | 0 \n |\n| Com_compound_sql | 0 \n |\n| Com_create_db | 0 \n |\n| Com_create_event | 0 \n |\n| Com_create_function | 0 \n |\n| Com_create_index | 0 \n |\n| Com_create_procedure | 0 \n |\n| Com_create_role | 0 \n |\n| Com_create_server | 0 \n |\n| Com_create_table | 0 \n |\n| Com_create_temporary_table | 0 \n |\n| Com_create_trigger | 0 \n |\n| Com_create_udf | 0 \n |\n| Com_create_user | 0 \n |\n| Com_create_view | 0 \n |\n| Com_dealloc_sql | 0 \n |\n| Com_delete | 0 \n |\n| Com_delete_multi | 0 \n |\n| Com_do | 0 \n |\n| Com_drop_db | 0 \n |\n| Com_drop_event | 0 \n |\n| Com_drop_function | 0 \n |\n| Com_drop_index | 0 \n |\n| Com_drop_procedure | 0 \n |\n| Com_drop_role | 0 \n |\n| Com_drop_server | 0 \n |\n| Com_drop_table | 0 \n |\n| Com_drop_temporary_table | 0 \n |\n| Com_drop_trigger | 0 \n |\n| Com_drop_user | 0 \n |\n| Com_drop_view | 0 \n |\n| Com_empty_query | 0 \n |\n| Com_execute_sql | 0 \n |\n| Com_flush | 0 \n |\n| Com_get_diagnostics | 0 \n |\n| Com_grant | 0 \n |\n| Com_grant_role | 0 \n |\n| Com_ha_close | 0 \n |\n| Com_ha_open | 0 \n |\n| Com_ha_read | 0 \n |\n| Com_help | 0 \n |\n| Com_insert | 0 \n |\n| Com_insert_select | 0 \n |\n| Com_install_plugin | 0 \n |\n| Com_kill | 0 \n |\n| Com_load | 0 \n |\n| Com_lock_tables | 0 \n |\n| Com_optimize | 0 \n |\n| Com_preload_keys | 0 \n |\n| Com_prepare_sql | 0 \n |\n| Com_purge | 0 \n |\n| Com_purge_before_date | 0 \n |\n| Com_release_savepoint | 0 \n |\n| Com_rename_table | 0 \n |\n| Com_rename_user | 0 \n |\n| Com_repair | 0 \n |\n| Com_replace | 0 \n |\n| Com_replace_select | 0 \n |\n| Com_reset | 0 \n |\n| Com_resignal | 0 \n |\n| Com_revoke | 0 \n |\n| Com_revoke_all | 0 \n |\n| Com_revoke_role | 0 \n |\n| Com_rollback | 0 \n |\n| Com_rollback_to_savepoint | 0 \n |\n| Com_savepoint | 0 \n |\n| Com_select | 1 \n |\n| Com_set_option | 0 \n |\n| Com_show_authors | 0 \n |\n| Com_show_binlog_events | 0 \n |\n| Com_show_binlogs | 0 \n |\n| Com_show_charsets | 0 \n |\n| Com_show_collations | 0 \n |\n| Com_show_contributors | 0 \n |\n| Com_show_create_db | 0 \n |\n| Com_show_create_event | 0 \n |\n| Com_show_create_func | 0 \n |\n| Com_show_create_proc | 0 \n |\n| Com_show_create_table | 0 \n |\n| Com_show_create_trigger | 0 \n |\n| Com_show_databases | 0 \n |\n| Com_show_engine_logs | 0 \n |','','https://mariadb.com/kb/en/show-status/');
+update help_topic set description = CONCAT(description, '\n| Com_show_engine_mutex | 0 \n |\n| Com_show_engine_status | 0 \n |\n| Com_show_errors | 0 \n |\n| Com_show_events | 0 \n |\n| Com_show_explain | 0 \n |\n| Com_show_fields | 0 \n |\n| Com_show_function_status | 0 \n |\n| Com_show_generic | 0 \n |\n| Com_show_grants | 0 \n |\n| Com_show_keys | 0 \n |\n| Com_show_master_status | 0 \n |\n| Com_show_open_tables | 0 \n |\n| Com_show_plugins | 0 \n |\n| Com_show_privileges | 0 \n |\n| Com_show_procedure_status | 0 \n |\n| Com_show_processlist | 0 \n |\n| Com_show_profile | 0 \n |\n| Com_show_profiles | 0 \n |\n| Com_show_relaylog_events | 0 \n |\n| Com_show_slave_hosts | 0 \n |\n| Com_show_slave_status | 0 \n |\n| Com_show_status | 2 \n |\n| Com_show_storage_engines | 0 \n |\n| Com_show_table_status | 0 \n |\n| Com_show_tables | 0 \n |\n| Com_show_triggers | 0 \n |\n| Com_show_variables | 0 \n |\n| Com_show_warnings | 0 \n |\n| Com_shutdown | 0 \n |\n| Com_signal | 0 \n |\n| Com_start_all_slaves | 0 \n |\n| Com_start_slave | 0 \n |\n| Com_stmt_close | 0 \n |\n| Com_stmt_execute | 0 \n |\n| Com_stmt_fetch | 0 \n |\n| Com_stmt_prepare | 0 \n |\n| Com_stmt_reprepare | 0 \n |\n| Com_stmt_reset | 0 \n |\n| Com_stmt_send_long_data | 0 \n |\n| Com_stop_all_slaves | 0 \n |\n| Com_stop_slave | 0 \n |\n| Com_truncate | 0 \n |\n| Com_uninstall_plugin | 0 \n |\n| Com_unlock_tables | 0 \n |\n| Com_update | 0 \n |\n| Com_update_multi | 0 \n |\n| Com_xa_commit | 0 \n |\n| Com_xa_end | 0 \n |\n| Com_xa_prepare | 0 \n |\n| Com_xa_recover | 0 \n |\n| Com_xa_rollback | 0 \n |\n| Com_xa_start | 0 \n |\n| Compression | OFF \n |\n| Connection_errors_accept | 0 \n |\n| Connection_errors_internal | 0 \n |\n| Connection_errors_max_connections | 0 \n |\n| Connection_errors_peer_address | 0 \n |\n| Connection_errors_select | 0 \n |\n| Connection_errors_tcpwrap | 0 \n |\n| Connections | 4 \n |\n| Cpu_time | 0.000000 \n |\n| Created_tmp_disk_tables | 0 \n |\n| Created_tmp_files | 6 \n |\n| Created_tmp_tables | 2 \n |\n| Delayed_errors | 0 \n |\n| Delayed_insert_threads | 0 \n |\n| Delayed_writes | 0 \n |\n| Delete_scan | 0 \n |\n| Empty_queries | 0 \n |\n| Executed_events | 0 \n |\n| Executed_triggers | 0 \n |\n| Feature_delay_key_write | 0 \n |\n| Feature_dynamic_columns | 0 \n |\n| Feature_fulltext | 0 \n |\n| Feature_gis | 0 \n |\n| Feature_locale | 0 \n |\n| Feature_subquery | 0 \n |\n| Feature_timezone | 0 \n |\n| Feature_trigger | 0 \n |\n| Feature_xml | 0 \n |\n| Flush_commands | 1 \n |\n| Handler_commit | 1 \n |\n| Handler_delete | 0 \n |\n| Handler_discover | 0 \n |\n| Handler_external_lock | 0 \n |\n| Handler_icp_attempts | 0 \n |\n| Handler_icp_match | 0 \n |\n| Handler_mrr_init | 0 \n |\n| Handler_mrr_key_refills | 0 \n |\n| Handler_mrr_rowid_refills | 0 \n |\n| Handler_prepare | 0 \n |\n| Handler_read_first | 3 \n |\n| Handler_read_key | 0 \n |\n| Handler_read_last | 0 \n |\n| Handler_read_next | 0 \n |\n| Handler_read_prev | 0 \n |\n| Handler_read_retry | 0 \n |\n| Handler_read_rnd | 0 \n |\n| Handler_read_rnd_deleted | 0 \n |\n| Handler_read_rnd_next | 537 \n |\n| Handler_rollback | 0 \n |\n| Handler_savepoint | 0 \n |\n| Handler_savepoint_rollback | 0 \n |\n| Handler_tmp_update | 0 \n |\n| Handler_tmp_write | 516 \n |\n| Handler_update | 0 \n |\n| Handler_write | 0 \n |\n| Innodb_available_undo_logs | 128 \n |\n| Innodb_background_log_sync | 222 \n |\n| Innodb_buffer_pool_bytes_data | 2523136 \n |\n| Innodb_buffer_pool_bytes_dirty | 0 \n |\n| Innodb_buffer_pool_dump_status | Dumping\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_load_status | Loading\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_pages_data | 154 \n |\n| Innodb_buffer_pool_pages_dirty | 0 \n |\n| Innodb_buffer_pool_pages_flushed | 1 \n |\n| Innodb_buffer_pool_pages_free | 8037 \n |\n| Innodb_buffer_pool_pages_lru_flushed | 0 \n |\n| Innodb_buffer_pool_pages_made_not_young | 0 \n |\n| Innodb_buffer_pool_pages_made_young | 0 \n |\n| Innodb_buffer_pool_pages_misc | 0 \n |\n| Innodb_buffer_pool_pages_old | 0 \n |\n| Innodb_buffer_pool_pages_total | 8191 \n |\n| Innodb_buffer_pool_read_ahead | 0 \n |\n| Innodb_buffer_pool_read_ahead_evicted | 0 \n |\n| Innodb_buffer_pool_read_ahead_rnd | 0 \n |\n| Innodb_buffer_pool_read_requests | 558 \n |\n| Innodb_buffer_pool_reads | 155 \n |\n| Innodb_buffer_pool_wait_free | 0 \n |\n| Innodb_buffer_pool_write_requests | 1 \n |\n| Innodb_checkpoint_age | 0 \n |\n| Innodb_checkpoint_max_age | 80826164 \n |\n| Innodb_data_fsyncs | 5 \n |\n| Innodb_data_pending_fsyncs | 0 \n |\n| Innodb_data_pending_reads | 0 \n |\n| Innodb_data_pending_writes | 0 \n |\n| Innodb_data_read | 2609664 \n |\n| Innodb_data_reads | 172 \n |\n| Innodb_data_writes | 5 \n |\n| Innodb_data_written | 34304 \n |\n| Innodb_dblwr_pages_written | 1 \n |\n| Innodb_dblwr_writes | 1 \n |\n| Innodb_deadlocks | 0 \n |\n| Innodb_have_atomic_builtins | ON \n |\n| Innodb_history_list_length | 0 \n |\n| Innodb_ibuf_discarded_delete_marks | 0 \n |\n| Innodb_ibuf_discarded_deletes | 0 \n |\n| Innodb_ibuf_discarded_inserts | 0 \n |\n| Innodb_ibuf_free_list | 0 \n |\n| Innodb_ibuf_merged_delete_marks | 0 \n |\n| Innodb_ibuf_merged_deletes | 0 \n |\n| Innodb_ibuf_merged_inserts | 0 \n |\n| Innodb_ibuf_merges | 0 \n |') WHERE help_topic_id = 392;
+update help_topic set description = CONCAT(description, '\n| Innodb_ibuf_segment_size | 2 \n |\n| Innodb_ibuf_size | 1 \n |\n| Innodb_log_waits | 0 \n |\n| Innodb_log_write_requests | 0 \n |\n| Innodb_log_writes | 1 \n |\n| Innodb_lsn_current | 1616829 \n |\n| Innodb_lsn_flushed | 1616829 \n |\n| Innodb_lsn_last_checkpoint | 1616829 \n |\n| Innodb_master_thread_active_loops | 0 \n |\n| Innodb_master_thread_idle_loops | 222 \n |\n| Innodb_max_trx_id | 2308 \n |\n| Innodb_mem_adaptive_hash | 2217568 \n |\n| Innodb_mem_dictionary | 630703 \n |\n| Innodb_mem_total | 140771328 \n |\n| Innodb_mutex_os_waits | 1 \n |\n| Innodb_mutex_spin_rounds | 30 \n |\n| Innodb_mutex_spin_waits | 1 \n |\n| Innodb_oldest_view_low_limit_trx_id | 0 \n |\n| Innodb_os_log_fsyncs | 3 \n |\n| Innodb_os_log_pending_fsyncs | 0 \n |\n| Innodb_os_log_pending_writes | 0 \n |\n| Innodb_os_log_written | 512 \n |\n| Innodb_page_size | 16384 \n |\n| Innodb_pages_created | 0 \n |\n| Innodb_pages_read | 154 \n |\n| Innodb_pages_written | 1 \n |\n| Innodb_purge_trx_id | 0 \n |\n| Innodb_purge_undo_no | 0 \n |\n| Innodb_read_views_memory | 88 \n |\n| Innodb_row_lock_current_waits | 0 \n |\n| Innodb_row_lock_time | 0 \n |\n| Innodb_row_lock_time_avg | 0 \n |\n| Innodb_row_lock_time_max | 0 \n |\n| Innodb_row_lock_waits | 0 \n |\n| Innodb_rows_deleted | 0 \n |\n| Innodb_rows_inserted | 0 \n |\n| Innodb_rows_read | 0 \n |\n| Innodb_rows_updated | 0 \n |\n| Innodb_system_rows_deleted | 0 \n |\n| Innodb_system_rows_inserted | 0 \n |\n| Innodb_system_rows_read | 0 \n |\n| Innodb_system_rows_updated | 0 \n |\n| Innodb_s_lock_os_waits | 2 \n |\n| Innodb_s_lock_spin_rounds | 60 \n |\n| Innodb_s_lock_spin_waits | 2 \n |\n| Innodb_truncated_status_writes | 0 \n |\n| Innodb_x_lock_os_waits | 0 \n |\n| Innodb_x_lock_spin_rounds | 0 \n |\n| Innodb_x_lock_spin_waits | 0 \n |\n| Innodb_page_compression_saved | 0 \n |\n| Innodb_page_compression_trim_sect512 | 0 \n |\n| Innodb_page_compression_trim_sect1024 | 0 \n |\n| Innodb_page_compression_trim_sect2048 | 0 \n |\n| Innodb_page_compression_trim_sect4096 | 0 \n |\n| Innodb_page_compression_trim_sect8192 | 0 \n |\n| Innodb_page_compression_trim_sect16384 | 0 \n |\n| Innodb_page_compression_trim_sect32768 | 0 \n |\n| Innodb_num_index_pages_written | 0 \n |\n| Innodb_num_non_index_pages_written | 5 \n |\n| Innodb_num_pages_page_compressed | 0 \n |\n| Innodb_num_page_compressed_trim_op | 0 \n |\n| Innodb_num_page_compressed_trim_op_saved | 0 \n |\n| Innodb_num_pages_page_decompressed | 0 \n |\n| Innodb_num_pages_page_compression_error | 0 \n |\n| Innodb_num_pages_encrypted | 0 \n |\n| Innodb_num_pages_decrypted | 0 \n |\n| Innodb_have_lz4 | OFF \n |\n| Innodb_have_lzo | OFF \n |\n| Innodb_have_lzma | OFF \n |\n| Innodb_have_bzip2 | OFF \n |\n| Innodb_have_snappy | OFF \n |\n| Innodb_defragment_compression_failures | 0 \n |\n| Innodb_defragment_failures | 0 \n |\n| Innodb_defragment_count | 0 \n |\n| Innodb_onlineddl_rowlog_rows | 0 \n |\n| Innodb_onlineddl_rowlog_pct_used | 0 \n |\n| Innodb_onlineddl_pct_progress | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_cache | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 \n |\n| Innodb_encryption_rotation_pages_modified | 0 \n |\n| Innodb_encryption_rotation_pages_flushed | 0 \n |\n| Innodb_encryption_rotation_estimated_iops | 0 \n |\n| Innodb_scrub_background_page_reorganizations | 0 \n |\n| Innodb_scrub_background_page_splits | 0 \n |\n| Innodb_scrub_background_page_split_failures_underflow | 0 \n |\n| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 \n |\n| Innodb_scrub_background_page_split_failures_missing_index | 0 \n |\n| Innodb_scrub_background_page_split_failures_unknown | 0 \n |\n| Key_blocks_not_flushed | 0 \n |\n| Key_blocks_unused | 107163 \n |\n| Key_blocks_used | 0 \n |\n| Key_blocks_warm | 0 \n |\n| Key_read_requests | 0 \n |\n| Key_reads | 0 \n |\n| Key_write_requests | 0 \n |\n| Key_writes | 0 \n |\n| Last_query_cost | 0.000000 \n |\n| Master_gtid_wait_count | 0 \n |\n| Master_gtid_wait_time | 0 \n |\n| Master_gtid_wait_timeouts | 0 \n |\n| Max_statement_time_exceeded | 0 \n |\n| Max_used_connections | 1 \n |\n| Memory_used | 273614696 \n |\n| Not_flushed_delayed_rows | 0 \n |\n| Open_files | 25 \n |\n| Open_streams | 0 \n |\n| Open_table_definitions | 18 \n |\n| Open_tables | 11 \n |\n| Opened_files | 77 \n |\n| Opened_plugin_libraries | 0 \n |\n| Opened_table_definitions | 18 \n |\n| Opened_tables | 18 \n |\n| Opened_views | 0 \n |\n| Performance_schema_accounts_lost | 0 \n |\n| Performance_schema_cond_classes_lost | 0 \n |\n| Performance_schema_cond_instances_lost | 0 \n |\n| Performance_schema_digest_lost | 0 \n |\n| Performance_schema_file_classes_lost | 0 \n |\n| Performance_schema_file_handles_lost | 0 \n |\n| Performance_schema_file_instances_lost | 0 \n |\n| Performance_schema_hosts_lost | 0 \n |\n| Performance_schema_locker_lost | 0 \n |\n| Performance_schema_mutex_classes_lost | 0 \n |\n| Performance_schema_mutex_instances_lost | 0 \n |\n| Performance_schema_rwlock_classes_lost | 0 \n |\n| Performance_schema_rwlock_instances_lost | 0 \n |\n| Performance_schema_session_connect_attrs_lost | 0 \n |\n| Performance_schema_socket_classes_lost | 0 \n |\n| Performance_schema_socket_instances_lost | 0 \n |\n| Performance_schema_stage_classes_lost | 0 \n |\n| Performance_schema_statement_classes_lost | 0 \n |\n| Performance_schema_table_handles_lost | 0 \n |\n| Performance_schema_table_instances_lost | 0 \n |\n| Performance_schema_thread_classes_lost | 0 \n |\n| Performance_schema_thread_instances_lost | 0 \n |\n| Performance_schema_users_lost | 0 \n |\n| Prepared_stmt_count | 0 \n |\n| Qcache_free_blocks | 1 \n |\n| Qcache_free_memory | 1031336 \n |\n| Qcache_hits | 0 \n |\n| Qcache_inserts | 0 \n |\n| Qcache_lowmem_prunes | 0 \n |\n| Qcache_not_cached | 0 \n |\n| Qcache_queries_in_cache | 0 \n |\n| Qcache_total_blocks | 1 \n |\n| Queries | 4 \n |\n| Questions | 4 \n |\n| Rows_read | 10 \n |\n| Rows_sent | 517 \n |\n| Rows_tmp_read | 516 \n |\n| Rpl_status | AUTH_MASTER \n |') WHERE help_topic_id = 392;
+update help_topic set description = CONCAT(description, '\n| Select_full_join | 0 \n |\n| Select_full_range_join | 0 \n |\n| Select_range | 0 \n |\n| Select_range_check | 0 \n |\n| Select_scan | 2 \n |\n| Slave_connections | 0 \n |\n| Slave_heartbeat_period | 0.000 \n |\n| Slave_open_temp_tables | 0 \n |\n| Slave_received_heartbeats | 0 \n |\n| Slave_retried_transactions | 0 \n |\n| Slave_running | OFF \n |\n| Slave_skipped_errors | 0 \n |\n| Slaves_connected | 0 \n |\n| Slaves_running | 0 \n |\n| Slow_launch_threads | 0 \n |\n| Slow_queries | 0 \n |\n| Sort_merge_passes | 0 \n |\n| Sort_priority_queue_sorts | 0 \n |\n| Sort_range | 0 \n |\n| Sort_rows | 0 \n |\n| Sort_scan | 0 \n |\n| Ssl_accept_renegotiates | 0 \n |\n| Ssl_accepts | 0 \n |\n| Ssl_callback_cache_hits | 0 \n |\n| Ssl_cipher | \n |\n| Ssl_cipher_list | \n |\n| Ssl_client_connects | 0 \n |\n| Ssl_connect_renegotiates | 0 \n |\n| Ssl_ctx_verify_depth | 0 \n |\n| Ssl_ctx_verify_mode | 0 \n |\n| Ssl_default_timeout | 0 \n |\n| Ssl_finished_accepts | 0 \n |\n| Ssl_finished_connects | 0 \n |\n| Ssl_server_not_after | \n |\n| Ssl_server_not_before | \n |\n| Ssl_session_cache_hits | 0 \n |\n| Ssl_session_cache_misses | 0 \n |\n| Ssl_session_cache_mode | NONE \n |\n| Ssl_session_cache_overflows | 0 \n |\n| Ssl_session_cache_size | 0 \n |\n| Ssl_session_cache_timeouts | 0 \n |\n| Ssl_sessions_reused | 0 \n |\n| Ssl_used_session_cache_entries | 0 \n |\n| Ssl_verify_depth | 0 \n |\n| Ssl_verify_mode | 0 \n |\n| Ssl_version | \n |\n| Subquery_cache_hit | 0 \n |\n| Subquery_cache_miss | 0 \n |\n| Syncs | 2 \n |\n| Table_locks_immediate | 21 \n |\n| Table_locks_waited | 0 \n |\n| Tc_log_max_pages_used | 0 \n |\n| Tc_log_page_size | 4096 \n |\n| Tc_log_page_waits | 0 \n |\n| Threadpool_idle_threads | 0 \n |\n| Threadpool_threads | 0 \n |\n| Threads_cached | 0 \n |\n| Threads_connected | 1 \n |\n| Threads_created | 2 \n |\n| Threads_running | 1 \n |\n| Update_scan | 0 \n |\n| Uptime | 223 \n |\n| Uptime_since_flush_status | 223 \n |\n| wsrep_cluster_conf_id |\n18446744073709551615 |\n| wsrep_cluster_size | 0 \n |\n| wsrep_cluster_state_uuid | \n |\n| wsrep_cluster_status | Disconnected \n |\n| wsrep_connected | OFF \n |\n| wsrep_local_bf_aborts | 0 \n |\n| wsrep_local_index |\n18446744073709551615 |\n| wsrep_provider_name | \n |\n| wsrep_provider_vendor | \n |\n| wsrep_provider_version | \n |\n| wsrep_ready | OFF \n |\n| wsrep_thread_count | 0 \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n516 rows in set (0.00 sec)\n\nExample of filtered output:\n\nSHOW STATUS LIKE \'Key%\';\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\nURL: https://mariadb.com/kb/en/show-status/') WHERE help_topic_id = 392;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW TABLE STATUS','Syntax\n------\n\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive\ninformation about each non-TEMPORARY table.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| Engine | Table storage engine. |\n+---------------------------+------------------------------------------------+\n| Version | Version number from the table\'s .frm file. |\n+---------------------------+------------------------------------------------+\n| Row_format | Row format (see InnoDB, Aria and MyISAM row |\n| | formats). |\n+---------------------------+------------------------------------------------+\n| Rows | Number of rows in the table. Some engines, |\n| | such as XtraDB and InnoDB may store an |\n| | estimate. |\n+---------------------------+------------------------------------------------+\n| Avg_row_length | Average row length in the table. |\n+---------------------------+------------------------------------------------+\n| Data_length | For InnoDB/XtraDB, the index size, in pages, |\n| | multiplied by the page size. For Aria and |\n| | MyISAM, length of the data file, in bytes. |\n| | For MEMORY, the approximate allocated memory. |\n+---------------------------+------------------------------------------------+\n| Max_data_length | Maximum length of the data file, ie the total |\n| | number of bytes that could be stored in the |\n| | table. Not used in XtraDB and InnoDB. |\n+---------------------------+------------------------------------------------+\n| Index_length | Length of the index file. |\n+---------------------------+------------------------------------------------+\n| Data_free | Bytes allocated but unused. For InnoDB tables |\n| | in a shared tablespace, the free space of the |\n| | shared tablespace with small safety margin. |\n| | An estimate in the case of partitioned tables |\n| | - see the PARTITIONS table. |\n+---------------------------+------------------------------------------------+\n| Auto_increment | Next AUTO_INCREMENT value. |\n+---------------------------+------------------------------------------------+\n| Create_time | Time the table was created. Some engines just |\n| | return the ctime information from the file |\n| | system layer here, in that case the value is |\n| | not necessarily the table creation time but |\n| | rather the time the file system metadata for |\n| | it had last changed. |\n+---------------------------+------------------------------------------------+\n| Update_time | Time the table was last updated. On Windows, |\n| | the timestamp is not updated on update, so |\n| | MyISAM values will be inaccurate. In InnoDB, |\n| | if shared tablespaces are used, will be NULL, |\n| | while buffering can also delay the update, so |\n| | the value will differ from the actual time of |\n| | the last UPDATE, INSERT or DELETE. |\n+---------------------------+------------------------------------------------+\n| Check_time | Time the table was last checked. Not kept by |\n| | all storage engines, in which case will be |\n| | NULL. |\n+---------------------------+------------------------------------------------+\n| Collation | Character set and collation. |\n+---------------------------+------------------------------------------------+\n| Checksum | Live checksum value, if any. |\n+---------------------------+------------------------------------------------+\n| Create_options | Extra CREATE TABLE options. |\n+---------------------------+------------------------------------------------+\n| Comment | Table comment provided when MariaDB created |\n| | the table. |\n+---------------------------+------------------------------------------------+\n| Max_index_length | Maximum index length (supported by MyISAM and |\n| | Aria tables). Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n| Temporary | Placeholder to signal that a table is a |\n| | temporary table. Currently always \"N\", except |\n| | \"Y\" for generated information_schema tables |\n| | and NULL for views. Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n\nSimilar information can be found in the information_schema.TABLES table as\nwell as by using mysqlshow:\n\nmysqlshow --status db_name\n\nViews\n-----\n\nFor views, all columns in SHOW TABLE STATUS are NULL except \'Name\' and\n\'Comment\'\n\nExample\n-------\n\nshow table status\\G\n*************************** 1. row ***************************\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\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 (394,26,'SHOW TABLES','Syntax\n------\n\nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLES lists the non-TEMPORARY tables, sequences and views in a given\ndatabase.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the WHERE and LIKE\nclauses will be Tables_in_test\n\nThe FULL modifier is supported such that SHOW FULL TABLES displays a second\noutput column. Values for the second column, Table_type, are BASE TABLE for a\ntable, VIEW for a view 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 not show up in the\noutput from SHOW TABLES or mysqlshow db_name.\n\nThe information_schema.TABLES table, as well as the SHOW TABLE STATUS\nstatement, provide extended information about tables.\n\nExamples\n--------\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\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 (395,26,'SHOW TABLE_STATISTICS','Syntax\n------\n\nSHOW TABLE_STATISTICS\n\nDescription\n-----------\n\nThe SHOW TABLE_STATISTICS statementis part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics on table usage\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.TABLE_STATISTICS articles for more\ninformation.\n\nExample\n-------\n\nSHOW TABLE_STATISTICS\\G\n*************************** 1. row ***************************\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 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 Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row ***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\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 (396,26,'SHOW TRIGGERS','Syntax\n------\n\nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a database\n(the default database unless a FROM clause is given). This statement requires\nthe TRIGGER privilege (prior to MySQL 5.1.22, it required the SUPER privilege).\n\nThe LIKE clause, if present on its own, indicates which table names to match\nand causes the statement to display triggers for those tables. The WHERE and\nLIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nSimilar information is stored in the information_schema.TRIGGERS table.\n\nMariaDB starting with 10.2.3\n----------------------------\nIf there are multiple triggers for the same action, then the triggers are\nshown in action order.\n\nExamples\n--------\n\nFor the trigger defined at Trigger Overview:\n\nSHOW triggers Like \'animals\' \\G\n*************************** 1. row ***************************\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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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 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 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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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\n* character_set_client is the session value of the character_set_client system\nvariable when the trigger was created. \n* collation_connection is the session value of the collation_connection system\nvariable when the trigger was\n created. \n* Database 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 NULL in the\nCreated column.\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 (397,26,'SHOW USER_STATISTICS','Syntax\n------\n\nSHOW USER_STATISTICS\n\nDescription\n-----------\n\nThe SHOW USER_STATISTICS statement is part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.USER_STATISTICS table holds statistics about user activity.\nYou can use this table to find out such things as which user is causing the\nmost load and which users are being abusive. You can also use this table to\nmeasure how close to capacity the server may be.\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.USER_STATISTICS table for more\ninformation.\n\nExample\n-------\n\nSHOW USER_STATISTICS\\G\n*************************** 1. row ***************************\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\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 (398,26,'SHOW VARIABLES','Syntax\n------\n\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW VARIABLES shows the values of MariaDB system variables. This information\nalso can be obtained using the mysqladmin variables command. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are used for\nnew connections to MariaDB. With SESSION, it displays the values that are in\neffect for the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement\ndisplays only rows for those variables with names that match the pattern. To\nobtain the row for a specific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'maria_group_commit\';\nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n\nTo get a list of variables whose name match a pattern, use the \"%\" wildcard\ncharacter in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%maria%\';\nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n\nWildcard characters can be used in any position within the pattern to be\nmatched. Strictly speaking, because \"_\" is a wildcard that matches any single\ncharacter, you should escape it as \"\\_\" to match it literally. In practice,\nthis is rarely necessary.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, 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 that can be set.\n\nYou can also see the server variables by querying the Information Schema\nGLOBAL_VARIABLES and SESSION_VARIABLES tables.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE \'aria%\';\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| 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| 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| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n\nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nBecause the following variable only has a global scope, the global value is\nreturned even when specifying SESSION (in this case by default):\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\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 (399,26,'SHOW WARNINGS','Syntax\n------\n\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n\nDescription\n-----------\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted from\nthe last statement that generated messages in the current session. It shows\nnothing if the last statement used a table and generated no messages. (That\nis, a statement that uses a table but generates no messages clears the message\nlist.) Statements that do not use tables and do not generate messages have no\neffect on the message list.\n\nA note is different to a warning in that it only appears if the sql_notes\nvariable is set to 1 (the default), and is not converted to an error if strict\nmode is enabled.\n\nA related statement, SHOW ERRORS, shows only the errors.\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of errors,\nwarnings, and notes. You can also retrieve this number from the warning_count\nvariable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nThe value of warning_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is\ninternally rewritten by MariaDB.\n\nIf the sql_notes server variable is set to 1, Notes are included in the output\nof SHOW WARNINGS; if it is set to 0, this statement will not show (or count)\nNotes.\n\nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to\nthe client. If you need to access those information in a stored program, you\ncan use the GET DIAGNOSTICS 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 warnings. The \\W\ncommand will show warnings after every statement, while \\w will disable this.\nStarting the client with the --show-warnings option will show warnings after\nevery statement.\n\nMariaDB 10.3.1 implements a stored routine error stack trace. SHOW WARNINGS\ncan also be used to show more information. See the example below.\n\nExamples\n--------\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-----------\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 exist\n\nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist |\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 error actually\nhappened:\n\n* Line 4 in test.p1 is the OPEN command which actually raised the error\n* Line 3 in test.p2 is the CALL statement, calling p1 from p2.\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 (400,26,'SHOW WSREP_MEMBERSHIP','SHOW WSREP_MEMBERSHIP is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_MEMBERSHIP\n\nDescription\n-----------\n\nThe SHOW WSREP_MEMBERSHIP statement returns Galera node cluster membership\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with the SUPER privilege\ncan access this information.\n\nExamples\n--------\n\nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |\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 (401,26,'SHOW WSREP_STATUS','SHOW WSREP_STATUS is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_STATUS\n\nDescription\n-----------\n\nThe SHOW WSREP_STATUS statement returns Galera node and cluster status\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_STATUS table. Only users with the SUPER privilege can\naccess this information.\n\nExamples\n--------\n\nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\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 (402,26,'BINLOG','Syntax\n------\n\nBINLOG \'str\'\n\nDescription\n-----------\n\nBINLOG is an internal-use statement. It is generated by the\nmariadb-binlog/mysqlbinlog program as the printable representation of certain\nevents in binary log files. The \'str\' value is a base 64-encoded string the\nthat server decodes to determine the data change indicated by the\ncorresponding event. This statement requires the SUPER privilege (<= MariaDB\n10.5.1) or theBINLOG REPLAY privilege (>= MariaDB 10.5.2).\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 (403,26,'PURGE BINARY LOGS','Syntax\n------\n\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nDescription\n-----------\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed in the\nlog index file prior to the specified log file name or date. BINARY and MASTER\nare synonyms. Deleted log files also are removed from the list recorded in the\nindex file, so that the given log file becomes the first in the list.\n\nThe datetime expression is in the format \'YYYY-MM-DD hh:mm:ss\'.\n\nIf a replica is active but has yet to read from a binary log file you attempt\nto delete, the statement will fail with an error. However, if the replica is\nnot connected and has yet to read from a log file you delete, the file will be\ndeleted, but the replica will be unable to continue replicating once it\nconnects again.\n\nThis statement has no effect if the server was not started with the --log-bin\noption to enable binary logging.\n\nTo list the binary log files on the server, use SHOW BINARY LOGS. To see which\nfiles they are reading, use SHOW SLAVE STATUS (or SHOW REPLICA STATUS from\nMariaDB 10.5.1). You can only delete the files that are older than the oldest\nfile that is used by the slaves.\n\nTo delete all binary log files, use RESET MASTER. To move to a new log file\n(for example if you want to remove the current log file), use FLUSH LOGS\nbefore you execute PURGE LOGS.\n\nIf the expire_logs_days server system variable is not set to 0, the server\nautomatically deletes binary log files after the given number of days. From\nMariaDB 10.6, the binlog_expire_logs_seconds variable allows more precise\ncontrol over binlog deletion, and takes precedence if both are non-zero.\n\nRequires the SUPER privilege or, from MariaDB 10.5.2, the BINLOG ADMIN\nprivilege, to run.\n\nExamples\n--------\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\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 (404,26,'CACHE INDEX','Syntax\n------\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-----------\n\nThe CACHE INDEX statement assigns table indexes to a specific key cache. It is\nused only for MyISAM tables.\n\nA default key cache exists and cannot be destroyed. To create more key caches,\nthe key_buffer_size server system variable.\n\nThe associations between tables indexes and key caches are lost on server\nrestart. To recreate them automatically, it is necessary to configure caches\nin a configuration file and include some CACHE INDEX (and optionally LOAD\nINDEX) statements in the init file.\n\nExamples\n--------\n\nThe following statement assigns indexes from the tables t1, t2, and t3 to the\nkey 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---------------------------\n\nNormally CACHE INDEX should not take a long time to execute. Internally it\'s\nimplemented the following way:\n\n* Find the right key cache (under LOCK_global_system_variables)\n* Open the table with a TL_READ_NO_INSERT lock.\n* Flush the original key cache for the given file (under key cache lock)\n* Flush the new key cache for the given file (safety)\n* Move the file to the new key cache (under file share lock)\n\nThe only possible long operations are getting the locks for the table and\nflushing the original key cache, if there were many key blocks for the file in\nit.\n\nWe plan to also add CACHE INDEX for Aria tables if there is a need for this.\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 (405,26,'HELP Command','Syntax\n------\n\nHELP search_string\n\nDescription\n-----------\n\nThe HELP command can be used in any MariaDB client, such as the mysql\ncommand-line client, to get basic syntax help and a short description for most\ncommands and functions.\n\nIf you provide an argument to the HELP command, the mysql client uses it as a\nsearch string to access server-side help. The proper operation of this command\nrequires that the help tables in the mysql database be initialized with help\ntopic information.\n\nIf there is no match for the search string, the search fails. Use HELP\ncontents to see a list of the help categories:\n\nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help <item>\', where <item> is one of the following\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 list of matching\ntopics:\n\nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type \'help <item>\',\nwhere <item> 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 help entry for that\ntopic.\n\nThe help is provided with the MariaDB server and makes use of four help tables\nfound in the mysql database: help_relation, help_topic, help_category and\nhelp_keyword. These tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which, until MariaDB 10.4.7, contain data\ngenerated from an old version of MySQL.\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 (406,26,'KILL [CONNECTION | QUERY]','Syntax\n------\n\nKILL [HARD | SOFT] { {CONNECTION|QUERY} thread_id | QUERY ID query_id | USER\nuser_name }\n\nDescription\n-----------\n\nEach connection to mysqld runs in a separate thread. You can see which threads\nare running with the SHOW PROCESSLIST statement and kill a thread with the\nKILL thread_id statement. KILL allows the optional CONNECTION or QUERY\nmodifier:\n\n* KILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the given thread or\nquery id.\n* KILL QUERY terminates the statement that the connection thread_id is\n currently executing, but leaves the connection itself intact.\n* KILL QUERY ID terminates the query by query_id, leaving the connection\nintact.\n\nIf a connection is terminated that has an active transaction, the transaction\nwill be rolled back. If only a query is killed, the current transaction will\nstay active. See also idle_transaction_timeout.\n\nIf you have the PROCESS privilege, you can see all threads. If you have the\nSUPER privilege, or, from MariaDB 10.5.2, the CONNECTION ADMIN privilege, you\ncan kill all threads and statements. Otherwise, you can see and kill only your\nown threads and statements.\n\nKilling queries that repair or create indexes on MyISAM and Aria tables may\nresult in corrupted tables. Use the SOFT option to avoid this!\n\nThe HARD option (default) kills a command as soon as possible. If you use\nSOFT, then critical operations that may leave a table in an inconsistent state\nwill not be interrupted. Such operations include REPAIR and INDEX creation for\nMyISAM and Aria tables (REPAIR TABLE, OPTIMIZE TABLE).\n\nKILL ... USER username will kill all connections/queries for a given user.\nUSER can be specified one of the following ways:\n\n* username (Kill without regard to hostname)\n* username@hostname\n* CURRENT_USER or CURRENT_USER()\n\nIf you specify a thread id and that thread does not exist, you get the\nfollowing error:\n\nERROR 1094 (HY000): Unknown thread id: <thread_id>\n\nIf you specify a query id that doesn\'t exist, you get the following error:\n\nERROR 1957 (HY000): Unknown query id: <query_id>\n\nHowever, if you specify a user name, no error is issued for non-connected (or\neven non-existing) users. To check if the connection/query has been killed,\nyou can use the ROW_COUNT() function.\n\nA client whose connection is killed receives the following error:\n\nERROR 1317 (70100): Query execution was interrupted\n\nTo obtain a list of existing sessions, use the SHOW PROCESSLIST statement or\nquery the Information Schema PROCESSLIST table.\n\nNote: You cannot use KILL with the Embedded MySQL Server library because the\nembedded server merely runs inside the threads of the host application. It\ndoes not create any connection threads of its own.\n\nNote: You can also use mysqladmin kill thread_id [,thread_id...] to kill\nconnections. To get a list of running queries, use mysqladmin processlist. See\nmysqladmin.\n\nPercona Toolkit contains a program, pt-kill that can be used to automatically\nkill connections that match certain criteria. For example, it can be used to\nterminate idle connections, or connections that have been busy for more than\n60 seconds.\n\nURL: https://mariadb.com/kb/en/kill/','','https://mariadb.com/kb/en/kill/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,26,'LOAD INDEX','Syntax\n------\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-----------\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key cache\nto which it has been assigned by an explicit CACHE INDEX statement, or into\nthe default key cache otherwise. LOAD INDEX INTO CACHE is used only for MyISAM\nor Aria tables.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of the\nindex to be preloaded.\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 (408,26,'RESET','Syntax\n------\n\nRESET reset_option [, reset_option] ...\n\nDescription\n-----------\n\nThe RESET statement is used to clear the state of various server operations.\nYou must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement.\n\nThe different RESET options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deletes all relay logs from the slave and |\n| [\"connection_name\"] [ALL] | reset the replication position in the master |\n| | binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deletes all old binary logs, makes the binary |\n| | index file (--log-bin-index) empty and |\n| | creates a new binary log file. This is |\n| | useful when you want to reset the master to |\n| | an initial state. If you want to just delete |\n| | old, not used binary logs, you should use the |\n| | PURGE BINARY LOGS command. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Removes all queries from the query cache. See |\n| | also FLUSH QUERY CACHE. |\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 (409,26,'SHUTDOWN','Syntax\n------\n\nSHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]\n\nDescription\n-----------\n\nThe SHUTDOWN command shuts the server down.\n\nWAIT FOR ALL SLAVES\n-------------------\n\nMariaDB starting with 10.4.4\n----------------------------\nThe WAIT FOR ALL SLAVES option was first added in MariaDB 10.4.4. WAIT FOR ALL\nREPLICAS has been a synonym since MariaDB 10.5.1.\n\nWhen a master server is shutdown and it goes through the normal shutdown\nprocess, the master kills client threads in random order. By default, the\nmaster also considers its binary log dump threads to be regular client\nthreads. As a consequence, the binary log dump threads can be killed while\nclient threads still exist, and this means that data can be written on the\nmaster during a normal shutdown that won\'t be replicated. This is true even if\nsemi-synchronous replication is being used.\n\nIn MariaDB 10.4 and later, this problem can be solved by shutting down the\nserver with the SHUTDOWN command and by providing the WAIT FOR ALL SLAVES\noption to the command. For example:\n\nSHUTDOWN WAIT FOR ALL SLAVES;\n\nWhen the WAIT FOR ALL SLAVES option is provided, the server only kills its\nbinary log dump threads after all client threads have been killed, and it only\ncompletes the shutdown after the last binary log has been sent to all\nconnected replicas.\n\nSee Replication Threads: Binary Log Dump Threads and the Shutdown Process for\nmore information.\n\nRequired Permissions\n--------------------\n\nOne must have a SHUTDOWN privilege (see GRANT) to use this command. It is the\nsame privilege one needs to use the mariadb-admin/mysqladmin shutdown command.\n\nShutdown for Upgrades\n---------------------\n\nIf you are doing a shutdown to migrate to another major version of MariaDB,\nplease ensure that the innodb_fast_shutdown variable is not 2 (fast crash\nshutdown). The default of this variable is 1.\n\nExample\n-------\n\nThe following example shows how to create an event which turns off the server\nat a certain time:\n\nCREATE EVENT `test`.`shutd`\n ON SCHEDULE\n EVERY 1 DAY\n STARTS \'2014-01-01 20:00:00\'\n COMMENT \'Shutdown Maria when the office is closed\'\nDO BEGIN\n SHUTDOWN;\nEND;\n\nOther Ways to Stop mysqld\n-------------------------\n\nYou can use the mariadb-admin/mysqladmin shutdown command to take down mysqld\ncleanly.\n\nYou can also use the system kill command on Unix with signal SIGTERM (15)\n\nkill -SIGTERM pid-of-mysqld-process\n\nYou can find the process number of the server process in the file that ends\nwith .pid in your data directory.\n\nThe above is identical to mysqladmin shutdown.\n\nOn windows you should use:\n\nNET STOP MySQL\n\nURL: https://mariadb.com/kb/en/shutdown/','','https://mariadb.com/kb/en/shutdown/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,26,'USE','Syntax\n------\n\nUSE db_name\n\nDescription\n-----------\n\nThe \'USE db_name\' statement tells MariaDB to use the db_name database as the\ndefault (current) database for subsequent statements. The database remains the\ndefault until the end of the session or another USE statement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is specifying its name at mysql\ncommand line client startup.\n\nURL: https://mariadb.com/kb/en/use/','','https://mariadb.com/kb/en/use/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,26,'SHOW FUNCTION CODE','Syntax\n------\n\nSHOW FUNCTION CODE func_name\n\nDescription\n-----------\n\nSHOW FUNCTION CODE shows a representation of the internal implementation of\nthe stored function.\n\nIt is similar to SHOW PROCEDURE CODE but for stored functions.\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 (412,26,'SHOW COLLATION','Syntax\n------\n\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe output from SHOW COLLATION includes all available collations. The LIKE\nclause, if present on its own, indicates which collation names to match. The\nWHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema COLLATIONS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncollation at the server, database, table and column levels.\n\nExamples\n--------\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 \'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\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 (413,27,'DELETE','Syntax\n------\n\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| LOW_PRIORITY | Wait until all SELECT\'s are done before |\n| | starting the statement. Used with storage |\n| | engines that uses table locking (MyISAM, Aria |\n| | etc). See HIGH_PRIORITY and LOW_PRIORITY |\n| | clauses for details. |\n+---------------------------+------------------------------------------------+\n| QUICK | Signal the storage engine that it should |\n| | expect that a lot of rows are deleted. The |\n| | storage engine engine can do things to speed |\n| | up the DELETE like ignoring merging of data |\n| | blocks until all rows are deleted from the |\n| | block (instead of when a block is half full). |\n| | This speeds up things at the expanse of lost |\n| | space in data blocks. At least MyISAM and |\n| | Aria support this feature. |\n+---------------------------+------------------------------------------------+\n| IGNORE | Don\'t stop the query even if a not-critical |\n| | error occurs (like data overflow). See How |\n| | IGNORE works for a full description. |\n+---------------------------+------------------------------------------------+\n\nFor the single-table syntax, the DELETE statement deletes rows from tbl_name\nand returns a count of the number of deleted rows. This count can be obtained\nby calling the ROW_COUNT() function. The WHERE clause, if given, specifies the\nconditions that identify which rows to delete. With no WHERE clause, all rows\nare deleted. If the ORDER BY clause is specified, the rows are deleted in the\norder that is specified. The LIMIT clause places a limit on the number of rows\nthat can be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the rows that\nsatisfy the conditions. In this case, ORDER BY and LIMIT> cannot be used. A\nDELETE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\ndeleted. It is specified as described in SELECT.\n\nCurrently, you cannot delete from a table and select from the same table in a\nsubquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You need only\nthe SELECT privilege for any columns that are only read, such as those named\nin the WHERE clause. See GRANT.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A faster\nway to do this, when you do not need to know the number of deleted rows, is to\nuse TRUNCATE TABLE. However, within a transaction or if you have a lock on the\ntable, TRUNCATE TABLE cannot be used whereas DELETE can. See TRUNCATE TABLE,\nand LOCK.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Deletion by Portion.\n\nRETURNING\n---------\n\nIt is possible to return a resultset of the deleted rows for a single table to\nthe client by using the syntax DELETE ... RETURNING select_expr [,\nselect_expr2 ...]]\n\nAny of SQL expression that can be calculated from a single row fields is\nallowed. Subqueries are allowed. The AS keyword is allowed, so it is possible\nto use aliases.\n\nThe use of aggregate functions is not allowed. RETURNING cannot be used in\nmulti-table DELETEs.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nSame Source and Target Table\n----------------------------\n\nUntil MariaDB 10.3.1, deleting from a table with the same source and target\nwas not possible. From MariaDB 10.3.1, this is now possible. For example:\n\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nMariaDB starting with 10.3.4\n----------------------------\n\nDELETE HISTORY\n--------------\n\nOne can use DELETE HISTORY to delete historical information from\nSystem-versioned tables.\n\nExamples\n--------\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| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+\n\nThe following statement joins two tables: one is only used to satisfy a WHERE\ncondition, but no row is deleted from it; rows from the other table are\ndeleted, instead.\n\nDELETE post FROM blog INNER JOIN post WHERE blog.id = post.blog_id;\n\nDeleting from the Same Source and Target\n----------------------------------------\n\nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nUntil MariaDB 10.3.1, this returned:\n\nERROR 1093 (HY000): Table \'t1\' is specified twice, both as a target for\n\'DELETE\' \n and as a separate source for\n\nFrom MariaDB 10.3.1:\n\nQuery OK, 0 rows affected (0.00 sec)\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 (414,27,'REPLACE','Syntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE works exactly like INSERT, except that if an old row in the table has\nthe same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row\nis deleted before the new row is inserted. If the table has more than one\nUNIQUE keys, it is possible 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 or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use REPLACE ... SELECT to copy rows between different databases.\n\nMariaDB starting with 10.5.0\n----------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.0\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=# ;\nENDIF\nINSERT INTO t1 VALUES (...);\nEND;\n\nThe above can be replaced with:\n\nREPLACE INTO t1 VALUES (...)\n\nREPLACE is a MariaDB/MySQL extension to the SQL standard. It either inserts,\nor deletes and inserts. For other MariaDB/MySQL extensions to standard SQL ---\nthat also handle duplicate values --- see IGNORE and INSERT ON DUPLICATE KEY\nUPDATE.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a REPLACE\nstatement makes no sense. It becomes equivalent to INSERT, because there is no\nindex to be used to determine whether a new row duplicates another.\n\nValues for all columns are taken from the values sSee Partition Pruning and\nSelection for details.pecified in the REPLACE statement. Any missing columns\nare set to their default values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row. If you use an\nassignment such as \'SET col = col + 1\', the reference to the column name on\nthe right hand side is treated as DEFAULT(col), so the assignment is\nequivalent to \'SET col = DEFAULT(col) + 1\'.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for the\ntable.\n\nThere are some gotchas you should be aware of, before using REPLACE:\n\n* If there is an AUTO_INCREMENT field, a new value will be generated.\n* If there are foreign keys, ON DELETE action will be activated by REPLACE.\n* Triggers on DELETE and INSERT will be activated by REPLACE.\n\nTo avoid some of these behaviors, you can use INSERT ... ON DUPLICATE KEY\nUPDATE.\n\nThis statement activates INSERT and DELETE triggers. See Trigger Overview for\ndetails.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nREPLACE RETURNING\n-----------------\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in REPLACE...SEL==\nDescription\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in\nREPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the REPLACE table. ECT...RETURNING if the table in the RETURNING\nclause is not the same as the REPLACE table.\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 (415,27,'UPDATE','Syntax\n------\n\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\nFor the single-table syntax, the UPDATE statement updates columns of existing\nrows in the named table with new values. The SET clause indicates which\ncolumns to modify and the values they should be given. Each value can be given\nas an expression, or the keyword DEFAULT to set a column explicitly to its\ndefault value. The WHERE clause, if given, specifies the conditions that\nidentify which rows to update. With no WHERE clause, all rows are updated. If\nthe ORDER BY clause is specified, the rows are updated in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that can be\nupdated.\n\nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE updates rows in\neach table named in table_references that satisfy the conditions. In this\ncase, ORDER BY and LIMIT cannot be used. This restriction was lifted in\nMariaDB 10.3.2 and both clauses can be used with multiple-table updates. An\nUPDATE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\nupdated.\n\ntable_references and where_condition are as specified as described in SELECT.\n\nFor single-table updates, assignments are evaluated in left-to-right order,\nwhile for multi-table updates, there is no guarantee of a particular order. If\nthe SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB 10.3.5) is set,\nUPDATE statements evaluate all assignments simultaneously.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE that\nare actually updated. You need only the SELECT privilege for any columns that\nare read but not modified. See GRANT.\n\nThe UPDATE statement supports the following modifiers:\n\n* If you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading from\n the table. This affects only storage engines that use only table-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and LOW_PRIORITY clauses\nfor details.\n* If you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for which\n duplicate-key conflicts occur are not updated. Rows for which columns are\n updated to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Updating by Portion.\n\nUPDATE Statements With the Same Source and Target\n-------------------------------------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nFrom MariaDB 10.3.2, UPDATE statements may have the same source and target.\n\nFor example, given the following table:\n\nDROP TABLE t1;\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 not 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 for 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| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n\nExample\n-------\n\nSingle-table syntax:\n\nUPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;\n\nMultiple-table syntax:\n\nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE\ntab1.id = tab2.id;\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 (416,27,'IGNORE','The IGNORE option tells the server to ignore some common errors.\n\nIGNORE can be used with the following statements:\n\n* DELETE\n* INSERT (see also INSERT IGNORE)\n* LOAD DATA INFILE\n* UPDATE\n* ALTER TABLE\n* CREATE TABLE ... SELECT\n* INSERT ... SELECT\n\nThe logic used:\n\n* Variables out of ranges are replaced with the maximum/minimum value.\n\n* SQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,\nNO_ZERO_DATE are ignored.\n\n* Inserting NULL in a NOT NULL field will insert 0 ( in a numerical\n field), 0000-00-00 ( in a date field) or an empty string ( in a character\n field).\n\n* Rows that cause a duplicate key error or break a foreign key constraint are\n not inserted, updated, or deleted.\n\nThe following errors are ignored:\n\n+---------------------+---------------------------------+--------------------+\n| Error number | Symbolic error name | Description |\n+---------------------+---------------------------------+--------------------+\n| 1022 | ER_DUP_KEY | Can\'t write; |\n| | | duplicate key in |\n| | | table \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1048 | ER_BAD_NULL_ERROR | Column \'%s\' |\n| | | cannot be null |\n+---------------------+---------------------------------+--------------------+\n| 1062 | ER_DUP_ENTRY | Duplicate entry |\n| | | \'%s\' for key %d |\n+---------------------+---------------------------------+--------------------+\n| 1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns |\n| | | more than 1 row |\n+---------------------+---------------------------------+--------------------+\n| 1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range |\n| | | value for column |\n| | | \'%s\' at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1265 | WARN_DATA_TRUNCATED | Data truncated |\n| | | for column \'%s\' |\n| | | at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1292 | ER_TRUNCATED_WRONG_VALUE | Truncated |\n| | | incorrect %s |\n| | | value: \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FI | Incorrect integer |\n| | LD | value |\n+---------------------+---------------------------------+--------------------+\n| 1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION |\n| | | failed \'%s.%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or |\n| | | update a parent |\n| | | row |\n+---------------------+---------------------------------+--------------------+\n| 1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or |\n| | | update a child |\n| | | row: a foreign |\n| | | key constraint |\n| | | fails (%s) |\n+---------------------+---------------------------------+--------------------+\n| 1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | | partition for |\n| | | value %s |\n+---------------------+---------------------------------+--------------------+\n| 1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry |\n| | | \'%s\' for key \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | SILENT | partition for |\n| | | some existing |\n| | | values |\n+---------------------+---------------------------------+--------------------+\n| 1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PAR | Found a row not |\n| | ITION_SET | matching the |\n| | | given partition |\n| | | set |\n+---------------------+---------------------------------+--------------------+\n\nIgnored errors normally generate a warning.\n\nA property of the IGNORE clause consists in causing transactional engines and\nnon-transactional engines (like XtraDB and Aria) to behave the same way. For\nexample, normally a multi-row insert which tries to violate a UNIQUE contraint\nis completely rolled back on XtraDB/InnoDB, but might be partially executed on\nAria. With the IGNORE clause, the statement will be partially executed in both\nengines.\n\nDuplicate key errors also generate warnings. The OLD_MODE server variable can\nbe used to prevent this.\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 (417,27,'SELECT','Syntax\n------\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], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset [ROWS EXAMINED\nrows_limit] } |\n [OFFSET start { ROW | ROWS }]\n [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }]\n]\n procedure|[PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name] [export_options] |\n INTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ]\n [FOR UPDATE lock_option | LOCK IN SHARE MODE lock_option]\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 ]\nlock_option:\n [WAIT n | NOWAIT | SKIP LOCKED]\n\nDescription\n-----------\n\nSELECT is used to retrieve rows selected from one or more tables, and can\ninclude UNION statements and subqueries.\n\n* Each select_expr expression indicates a column or data that you want to\nretrieve. You\nmust have at least one select expression. See Select Expressions below.\n\n* The FROM clause indicates the table or tables from which to retrieve rows.\nUse either a single table name or a JOIN expression. See JOIN\nfor details. If no table is involved, FROM DUAL can be specified.\n\n* Each table can also be specified as db_name.tabl_name. Each column can also\nbe specified as tbl_name.col_name or even db_name.tbl_name.col_name. This\nallows one to write queries which involve multiple databases. See Identifier\nQualifiers for syntax details.\n\n* The 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 there 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 (summary) functions.\nSee Functions and Operators and Functions and Modifiers for use with GROUP BY\n(aggregate).\n\n* Use the ORDER BY clause to order the results.\n\n* Use the LIMIT clause allows you to restrict the results to only\na certain number of rows, optionally with an offset.\n\n* Use the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in common.\n\nSELECT can also be used to retrieve rows computed without reference to any\ntable.\n\nSelect Expressions\n------------------\n\nA SELECT statement must contain one or more select expressions, separated by\ncommas. Each select expression can be one of the following:\n\n* The name of a column.\n* Any expression using functions and operators.\n* * to select all columns from all tables in the FROM clause.\n* tbl_name.* to select all columns from just the table tbl_name.\n\nWhen specifying a column, you can either use just the column name or qualify\nthe column name with the name of the table using tbl_name.col_name. The\nqualified form is useful if you are joining multiple tables in the FROM\nclause. If you do not qualify the column names when selecting from multiple\ntables, MariaDB will try to find the column in each table. It is an error if\nthat column name exists in multiple tables.\n\nYou can quote column names using backticks. If you are qualifying column names\nwith table names, quote each part separately as `tbl_name`.`col_name`.\n\nIf you use any grouping functions in any of the select expressions, all rows\nin your results will be implicitly grouped, as if you had used GROUP BY NULL.\n\nDISTINCT\n--------\n\nA query may produce some identical rows. By default, all rows are retrieved,\neven when their values are the same. To explicitly specify that you want to\nretrieve identical rows, use the ALL option. If you want duplicates to be\nremoved from the resultset, use the DISTINCT option. DISTINCTROW is a synonym\nfor DISTINCT. See also COUNT DISTINCT and SELECT UNIQUE in Oracle mode.\n\nINTO\n----\n\nThe INTO clause is used to specify that the query results should be written to\na file or variable.\n\n* SELECT INTO OUTFILE - formatting and writing the result to an external file.\n* SELECT INTO DUMPFILE - binary-safe writing of the unformatted results to an\nexternal file.\n* SELECT INTO Variable - selecting and setting variables.\n\nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n\nLIMIT\n-----\n\nRestricts the number of returned rows. See LIMIT and LIMIT ROWS EXAMINED for\ndetails.\n\nLOCK IN SHARE MODE/FOR UPDATE\n-----------------------------\n\nSee LOCK IN SHARE MODE and FOR UPDATE for details on the respective locking\nclauses.\n\nOFFSET ... FETCH\n----------------\n\nMariaDB starting with 10.6\n--------------------------\nSee SELECT ... OFFSET ... FETCH.\n\nORDER BY\n--------\n\nOrder a resultset. See ORDER BY for details.\n\nPARTITION\n---------\n\nSpecifies to the optimizer which partitions are relevant for the query. Other\npartitions will not be read. See Partition Pruning and Selection for details.\n\nPROCEDURE\n---------\n\nPasses the whole result set to a C Procedure. See PROCEDURE and PROCEDURE\nANALYSE (the only built-in procedure not requiring the server to be\nrecompiled).\n\nSKIP LOCKED\n-----------\n\nMariaDB starting with 10.6\n--------------------------\nThe SKIP LOCKED clause was introduced in MariaDB 10.6.0.\n\nThis causes those rows that couldn\'t be locked (LOCK IN SHARE MODE or FOR\nUPDATE) to be excluded from the result set. An explicit NOWAIT is implied\nhere. This is only implemented on InnoDB tables and ignored otherwise.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nWhen SQL_CALC_FOUND_ROWS is used, then MariaDB will calculate how many rows\nwould have been in the result, if there would be no LIMIT clause. The result\ncan be found by calling the function FOUND_ROWS() in your next sql statement.\n\nmax_statement_time clause\n-------------------------\n\nBy using max_statement_time in conjunction with SET STATEMENT, it is possible\nto limit the execution time of individual queries. For example:\n\nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nExamples\n--------\n\nSELECT f1,f2 FROM t1 WHERE (f3<=10) AND (f4=\'y\');\n\nSee Getting Data from MariaDB (Beginner tutorial), or the various\nsub-articles, for more examples.\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 (418,27,'JOIN Syntax','Description\n-----------\n\nMariaDB supports the following JOIN syntaxes for the table_references part of\nSELECT statements and multiple-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] [index_hint_list]\n | table_subquery [query_system_time_period_specification] [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 [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor\n\njoin_condition:\n ON conditional_expr\n | USING (column_list)\n\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 allows to write\nqueries which involve multiple databases. See Identifier Qualifiers for syntax\ndetails.\n\nThe syntax of table_factor is extended in comparison with the SQL Standard.\nThe latter accepts only table_reference, not a list of them inside a pair of\nparentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\n\nSELECT * FROM t1 LEFT JOIN (t2, t3, t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nis equivalent to:\n\nSELECT * FROM t1 LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4)\n ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)\n\nIn MariaDB, CROSS JOIN is a syntactic equivalent to INNER JOIN (they can\nreplace each other). In standard SQL, they are not equivalent. INNER JOIN is\nused with an ON clause, CROSS JOIN is used otherwise.\n\nIn general, parentheses can be ignored in join expressions containing only\ninner join operations. MariaDB also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n\nSee System-versioned tables for more information about FOR SYSTEM_TIME syntax.\n\nIndex hints can be specified to affect how the MariaDB optimizer makes use of\nindexes. For more information, see How to force query plans.\n\nExamples\n--------\n\nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n\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 (419,27,'Scalar Subqueries','A scalar subquery is a subquery that returns a single value. This is the\nsimplest form of a subquery, and can be used in most places a literal or\nsingle column value is valid.\n\nThe data type, length and character set and collation are all taken from the\nresult returned by the subquery. The result of a subquery can always be NULL,\nthat is, no result returned. Even if the original value is defined as NOT\nNULL, this is disregarded.\n\nA subquery cannot be used where only a literal is expected, for example LOAD\nDATA INFILE expects a literal string containing the file name, and LIMIT\nrequires a literal integer.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num TINYINT);\n\nINSERT INTO sq1 VALUES (1);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n+------+\n\nInserting a second row means the subquery is no longer a scalar, and this\nparticular query is not valid:\n\nINSERT INTO sq1 VALUES (2);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\nERROR 1242 (21000): Subquery returns more than 1 row\n\nNo rows in the subquery, so the scalar is NULL:\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq3 WHERE num=\'3\'));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n| NULL |\n+------+\n\nA more traditional scalar subquery, as part of a WHERE clause:\n\nSELECT * FROM sq1 WHERE num = (SELECT MAX(num)/10 FROM sq2); \n+------+\n| num |\n+------+\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-scalar-subqueries/','','https://mariadb.com/kb/en/subqueries-scalar-subqueries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'Row Subqueries','A row subquery is a subquery returning a single row, as opposed to a scalar\nsubquery, which returns a single column from a row, or a literal.\n\nExamples\n--------\n\nCREATE TABLE staff (name VARCHAR(10), age TINYINT);\n\nCREATE TABLE customer (name VARCHAR(10), age TINYINT);\n\nINSERT INTO staff VALUES (\'Bilhah\',37), (\'Valerius\',61), (\'Maia\',25);\n\nINSERT INTO customer VALUES (\'Thanasis\',48), (\'Valerius\',61), (\'Brion\',51);\n\nSELECT * FROM staff WHERE (name,age) = (SELECT name,age FROM customer WHERE\nname=\'Valerius\');\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nFinding all rows in one table also in another:\n\nSELECT name,age FROM staff WHERE (name,age) IN (SELECT name,age FROM customer);\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nURL: https://mariadb.com/kb/en/subqueries-row-subqueries/','','https://mariadb.com/kb/en/subqueries-row-subqueries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'Subqueries and ALL','Subqueries using the ALL keyword will return true if the comparison returns\ntrue for each row returned by the subquery, or the subquery returns no rows.\n\nSyntax\n------\n\nscalar_expression comparison_operator ALL <Table subquery>\n\n* scalar_expression may be any expression that evaluates to a single\nvalue\n* comparison_operator may be any one of: =, >, <, >=, <=, <> or !=\n\nALL returns:\n\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery or scalar_expression returns NULL.\n* FALSE if the comparison operator returns FALSE for at least one row returned\nby the Table subquery.\n* TRUE if the comparison operator returns TRUE for all rows returned by the\nTable subquery, or if Table subquery returns no rows.\n\nNOT IN is an alias for <> ALL.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSince 100 > all of 40,50 and 60, the evaluation is true and the row is returned\n\nAdding a second row to sq1, where the evaluation for that record is false:\n\nINSERT INTO sq1 VALUES(30);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nAdding a new row to sq2, causing all evaluations to be false:\n\nINSERT INTO sq2 VALUES(120);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nWhen the subquery returns no results, the evaluation is still true:\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2 WHERE num2 > 300);\n+------+\n| num |\n+------+\n| 100 |\n| 30 |\n+------+\n\nEvaluating against a NULL will cause the result to be unknown, or not true,\nand therefore return no rows:\n\nINSERT INTO sq2 VALUES (NULL);\n\nSELECT * FROM sq1 WHERE num > ALL (SELECT * FROM sq2);\n\nURL: https://mariadb.com/kb/en/subqueries-and-all/','','https://mariadb.com/kb/en/subqueries-and-all/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'Subqueries and ANY','Subqueries using the ANY keyword will return true if the comparison returns\ntrue for at least one row returned by the subquery.\n\nSyntax\n------\n\nThe required syntax for an ANY or SOME quantified comparison is:\n\nscalar_expression comparison_operator ANY <Table subquery>\n\nOr:\n\nscalar_expression comparison_operator SOME <Table subquery>\n\n* scalar_expression may be any expression that evaluates to a\nsingle value.\n* comparison_operator may be any one of =, >, <, >=, <=, <> or !=.\n\nANY returns:\n\n* TRUE if the comparison operator returns TRUE for at least one row returned\nby the Table subquery.\n* FALSE if the comparison operator returns FALSE for all rows returned by the\nTable subquery, or Table subquery has zero rows.\n* NULL if the comparison operator returns NULL for at least one row returned\nby the Table subquery and doesn\'t returns TRUE for any of them, or if\nscalar_expression returns NULL.\n\nSOME is a synmonym for ANY, and IN is a synonym for = ANY\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(120);\n\nSELECT * FROM sq1 WHERE num > ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\n100 is greater than two of the three values, and so the expression evaluates\nas true.\n\nSOME is a synonym for ANY:\n\nSELECT * FROM sq1 WHERE num < SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nIN is a synonym for = ANY, and here there are no matches, so no results are\nreturned:\n\nSELECT * FROM sq1 WHERE num IN (SELECT * FROM sq2);\nEmpty set (0.00 sec)\n\nINSERT INTO sq2 VALUES(100);\nQuery OK, 1 row affected (0.05 sec)\n\nSELECT * FROM sq1 WHERE num <> ANY (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nReading this query, the results may be counter-intuitive. It may seem to read\nas \"SELECT * FROM sq1 WHERE num does not match any results in sq2. Since it\ndoes match 100, it could seem that the results are incorrect. However, the\nquery returns a result if the match does not match any of sq2. Since 100\nalready does not match 40, the expression evaluates to true immediately,\nregardless of the 100\'s matching. It may be more easily readable to use SOME\nin a case such as this:\n\nSELECT * FROM sq1 WHERE num <> SOME (SELECT * FROM sq2);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-and-any/','','https://mariadb.com/kb/en/subqueries-and-any/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,27,'Subqueries and EXISTS','Syntax\n------\n\nSELECT ... WHERE EXISTS <Table subquery>\n\nDescription\n-----------\n\nSubqueries using the EXISTS keyword will return true if the subquery returns\nany rows. Conversely, subqueries using NOT EXISTS will return true only if the\nsubquery returns no rows from the table.\n\nEXISTS subqueries ignore the columns specified by the SELECT of the subquery,\nsince they\'re not relevant. For example,\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT * FROM t2);\n\nand\n\nSELECT col1 FROM t1 WHERE EXISTS (SELECT col2 FROM t2);\n\nproduce identical results.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num2 TINYINT);\n\nINSERT INTO sq1 VALUES(100);\n\nINSERT INTO sq2 VALUES(40),(50),(60);\n\nSELECT * FROM sq1 WHERE EXISTS (SELECT * FROM sq2 WHERE num2>50);\n+------+\n| num |\n+------+\n| 100 |\n+------+\n\nSELECT * FROM sq1 WHERE NOT EXISTS (SELECT * FROM sq2 GROUP BY num2 HAVING\nMIN(num2)=40);\nEmpty set (0.00 sec)\n\nURL: https://mariadb.com/kb/en/subqueries-and-exists/','','https://mariadb.com/kb/en/subqueries-and-exists/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (424,27,'Subqueries in a FROM Clause','Although subqueries are more commonly placed in a WHERE clause, they can also\nform part of the FROM clause. Such subqueries are commonly called derived\ntables.\n\nIf a subquery is used in this way, you must also use an AS clause to name the\nresult of the subquery.\n\nORACLE mode\n-----------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, anonymous subqueries in a FROM clause (no AS clause) are\npermitted in ORACLE mode.\n\nExamples\n--------\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\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\nAssume that, given the data above, you want to return the average total for\nall students. In other words, the average of Chun\'s 148 (75+73), Esben\'s 74\n(43+31), etc.\n\nYou cannot do the following:\n\nSELECT AVG(SUM(score)) FROM student GROUP BY name;\nERROR 1111 (HY000): Invalid use of group function\n\nA subquery in the FROM clause is however permitted:\n\nSELECT AVG(sq_sum) FROM (SELECT SUM(score) AS sq_sum FROM student GROUP BY\nname) AS t;\n+-------------+\n| AVG(sq_sum) |\n+-------------+\n| 134.0000 |\n+-------------+\n\nFrom MariaDB 10.6 in ORACLE mode, the following is permitted:\n\nSELECT * FROM (SELECT 1 FROM DUAL), (SELECT 2 FROM DUAL);\n\nURL: https://mariadb.com/kb/en/subqueries-in-a-from-clause/','','https://mariadb.com/kb/en/subqueries-in-a-from-clause/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (425,27,'Subqueries and JOINs','A subquery can quite often, but not in all cases, be rewritten as a JOIN.\n\nRewriting Subqueries as JOINS\n-----------------------------\n\nA subquery using IN can be rewritten with the DISTINCT keyword, for example:\n\nSELECT * FROM table1 WHERE col1 IN (SELECT col1 FROM table2);\n\ncan be rewritten as:\n\nSELECT DISTINCT table1.* FROM table1, table2 WHERE table1.col1=table2.col1;\n\nNOT IN or NOT EXISTS queries can also be rewritten. For example, these two\nqueries returns the same result:\n\nSELECT * FROM table1 WHERE col1 NOT IN (SELECT col1 FROM table2);\nSELECT * FROM table1 WHERE NOT EXISTS (SELECT col1 FROM table2 WHERE\ntable1.col1=table2.col1);\n\nand both can be rewritten as:\n\nSELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE\ntable2.id IS NULL;\n\nSubqueries that can be rewritten as a LEFT JOIN are sometimes more efficient.\n\nUsing Subqueries instead of JOINS\n---------------------------------\n\nThere are some scenarios, though, which call for subqueries rather than joins:\n\n* When you want duplicates, but not false duplicates. Suppose Table_1\n has three rows — {1,1,2}\n — and Table_2 has two rows\n — {1,2,2}. If you need to list the rows\n in Table_1 which are also in Table_2, only this\n subquery-based SELECT statement will give the right answer\n (1,1,2):\n\nSELECT Table_1.column_1 \nFROM Table_1 \nWHERE Table_1.column_1 IN \n (SELECT Table_2.column_1\n FROM Table_2);\n\n* This SQL statement won\'t work:\n\nSELECT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,1,2,2}\n — and the duplication of 2 is an error. This SQL\n statement won\'t work either:\n\nSELECT DISTINCT Table_1.column_1 \nFROM Table_1,Table_2 \nWHERE Table_1.column_1 = Table_2.column_1;\n\n* because the result will be {1,2} — and\n the removal of the duplicated 1 is an error too.\n\n* When the outermost statement is not a query. The SQL statement:\n\nUPDATE Table_1 SET column_1 = (SELECT column_1 FROM Table_2);\n\n* can\'t be expressed using a join unless some rare SQL3 features are used.\n\n* When the join is over an expression. The SQL statement:\n\nSELECT * FROM Table_1 \nWHERE column_1 + 5 =\n (SELECT MAX(column_1) FROM Table_2);\n\n* is hard to express with a join. In fact, the only way we can think of is\n this SQL statement:\n\nSELECT Table_1.*\nFROM Table_1, \n (SELECT MAX(column_1) AS max_column_1 FROM Table_2) AS Table_2\nWHERE Table_1.column_1 + 5 = Table_2.max_column_1;\n\n* which still involves a parenthesized query, so nothing is gained from the\n transformation.\n\n* When you want to see the exception. For example, suppose the question is:\n what books are longer than Das Kapital? These two queries are effectively\n almost the same:\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 JOIN Books AS Bookcolumn_2 USING(page_count) \nWHERE title = \'Das Kapital\';\n\nSELECT DISTINCT Bookcolumn_1.* \nFROM Books AS Bookcolumn_1 \nWHERE Bookcolumn_1.page_count > \n (SELECT DISTINCT page_count\n FROM Books AS Bookcolumn_2\n WHERE title = \'Das Kapital\');\n\n* The difference is between these two SQL statements is, if there are two\n editions of Das Kapital (with different page counts), then the self-join\n example will return the books which are longer than the shortest edition\n of Das Kapital. That might be the wrong answer, since the original\n question didn\'t ask for \"... longer than ANY book named Das Kapital\"\n (it seems to contain a false assumption that there\'s only one edition).\n\nURL: https://mariadb.com/kb/en/subqueries-and-joins/','','https://mariadb.com/kb/en/subqueries-and-joins/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (426,27,'Subquery Limitations','There are a number of limitations regarding subqueries, which are discussed\nbelow. The following tables and data will be used in the examples that follow:\n\nCREATE TABLE staff(name VARCHAR(10),age TINYINT);\n\nCREATE TABLE customer(name VARCHAR(10),age TINYINT);\n\nINSERT INTO staff VALUES \n(\'Bilhah\',37), (\'Valerius\',61), (\'Maia\',25);\n\nINSERT INTO customer VALUES \n(\'Thanasis\',48), (\'Valerius\',61), (\'Brion\',51);\n\nORDER BY and LIMIT\n------------------\n\nTo use ORDER BY or limit LIMIT in subqueries both must be used.. For example:\n\nSELECT * FROM staff WHERE name IN (SELECT name FROM customer ORDER BY name);\n+----------+------+\n| name | age |\n+----------+------+\n| Valerius | 61 |\n+----------+------+\n\nis valid, but\n\nSELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name\nLIMIT 1);\nERROR 1235 (42000): This version of MariaDB doesn\'t \n yet support \'LIMIT & IN/ALL/ANY/SOME subquery\'\n\nis not.\n\nModifying and Selecting from the Same Table\n-------------------------------------------\n\nIt\'s not possible to both modify and select from the same table in a subquery.\nFor example:\n\nDELETE FROM staff WHERE name = (SELECT name FROM staff WHERE age=61);\nERROR 1093 (HY000): Table \'staff\' is specified twice, both \n as a target for \'DELETE\' and as a separate source for data\n\nRow Comparison Operations\n-------------------------\n\nThere is only partial support for row comparison operations. The expression in\n\nexpr op {ALL|ANY|SOME} subquery,\n\nmust be scalar and the subquery can only return a single column.\n\nHowever, because of the way IN is implemented (it is rewritten as a sequence\nof = comparisons and AND), the expression in\n\nexpression [NOT] IN subquery\n\nis permitted to be an n-tuple and the subquery can return rows of n-tuples.\n\nFor example:\n\nSELECT * FROM staff WHERE (name,age) NOT IN (\n SELECT name,age FROM customer WHERE age >=51]\n);\n+--------+------+\n| name | age |\n+--------+------+\n| Bilhah | 37 |\n| Maia | 25 |\n+--------+------+\n\nis permitted, but\n\nSELECT * FROM staff WHERE (name,age) = ALL (\n SELECT name,age FROM customer WHERE age >=51\n);\nERROR 1241 (21000): Operand should contain 1 column(s)\n\nis not.\n\nCorrelated Subqueries\n---------------------\n\nSubqueries in the FROM clause cannot be correlated subqueries. They cannot be\nevaluated for each row of the outer query since they are evaluated to produce\na result set during when the query is executed.\n\nStored Functions\n----------------\n\nA subquery can refer to a stored function which modifies data. This is an\nextension to the SQL standard, but can result in indeterminate outcomes. For\nexample, take:\n\nSELECT ... WHERE x IN (SELECT f() ...);\n\nwhere f() inserts rows. The function f() could be executed a different number\nof times depending on how the optimizer chooses to handle the query.\n\nThis sort of construct is therefore not safe to use in replication that is not\nrow-based, as there could be different results on the master and the slave.\n\nURL: https://mariadb.com/kb/en/subquery-limitations/','','https://mariadb.com/kb/en/subquery-limitations/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (427,27,'UNION','UNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nSyntax\n------\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-----------\n\nUNION is used to combine the results from multiple SELECT statements into a\nsingle result set.\n\nThe column names from the first SELECT statement are used as the column names\nfor the results returned. Selected columns listed in corresponding positions\nof each SELECT statement should have the same data type. (For example, the\nfirst column selected by the first statement should have the same type as the\nfirst column selected by the other statements.)\n\nIf they don\'t, the type and length of the columns in the result take into\naccount the values returned by all of the SELECTs, so there is no need for\nexplicit casting. Note that currently this is not the case for recursive CTEs\n- see MDEV-12325.\n\nTable names can be specified as db_name.tbl_name. This permits writing UNIONs\nwhich involve multiple databases. See Identifier Qualifiers for syntax details.\n\nUNION queries cannot be used with aggregate functions.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nALL/DISTINCT\n------------\n\nThe ALL keyword causes duplicate rows to be preserved. The DISTINCT keyword\n(the default if the keyword is omitted) causes duplicate rows to be removed by\nthe results.\n\nUNION ALL and UNION DISTINCT can both be present in a query. In this case,\nUNION DISTINCT will override any UNION ALLs to its left.\n\nMariaDB starting with 10.1.1\n----------------------------\nUntil MariaDB 10.1.1, all UNION ALL statements required the server to create a\ntemporary table. Since MariaDB 10.1.1, the server can in most cases execute\nUNION ALL without creating a temporary table, improving performance (see\nMDEV-334).\n\nORDER BY and LIMIT\n------------------\n\nIndividual SELECTs can contain their own ORDER BY and LIMIT clauses. In this\ncase, the individual queries need to be wrapped between parentheses. However,\nthis does not affect the order of the UNION, so they only are useful to limit\nthe record read by one SELECT.\n\nThe UNION can have global ORDER BY and LIMIT clauses, which affect the whole\nresultset. If the columns retrieved by individual SELECT statements have an\nalias (AS), the ORDER BY must use that alias, not the real column names.\n\nHIGH_PRIORITY\n-------------\n\nSpecifying a query as HIGH_PRIORITY will not work inside a UNION. If applied\nto the first SELECT, it will be ignored. Applying to a later SELECT results in\na syntax error:\n\nERROR 1234 (42000): Incorrect usage/placement of \'HIGH_PRIORITY\'\n\nSELECT ... INTO ...\n-------------------\n\nIndividual SELECTs cannot be written INTO DUMPFILE or INTO OUTFILE. If the\nlast SELECT statement specifies INTO DUMPFILE or INTO OUTFILE, the entire\nresult of the UNION will 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 also be used.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nExamples\n--------\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 rows:\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 email)\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 use of a sort\ncolumn:\n\n(SELECT 1 AS sort_column, e_name AS name, email FROM employees)\nUNION\n(SELECT 2, c_name AS name, email FROM customers) ORDER BY sort_column;\n\nDifference between UNION, EXCEPT and INTERSECT. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 (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 (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\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 (428,27,'EXCEPT','MariaDB starting with 10.3.0\n----------------------------\nEXCEPT was introduced in MariaDB 10.3.0.\n\nThe result of EXCEPT is all records of the left SELECT result set except\nrecords which are in right SELECT result set, i.e. it is subtraction of two\nresult sets. From MariaDB 10.6.1, MINUS is a synonym.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nPlease note:\n\n* Brackets for explicit operation precedence are not supported; use a subquery\nin the FROM clause as a workaround).\n\nDescription\n-----------\n\nMariaDB has supported EXCEPT and INTERSECT in addition to UNION since MariaDB\n10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nEXCEPT implicitly supposes a DISTINCT operation.\n\nThe result of EXCEPT is all records of the left SELECT result except records\nwhich are in right SELECT result set, i.e. it is subtraction of two result\nsets.\n\nEXCEPT and UNION have the same operation precedence and INTERSECT has a higher\nprecedence, unless running in Oracle mode, in which case all three have the\nsame precedence.\n\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nEXCEPT ALL and EXCEPT DISTINCT were introduced in MariaDB 10.5.0. The ALL\noperator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\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. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 c 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 c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 5 |\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 (429,27,'INTERSECT','MariaDB starting with 10.3.0\n----------------------------\nINTERSECT was introduced in MariaDB 10.3.0.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) SELECT ...]\n[ORDER BY [column [, column ...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nMariaDB has supported INTERSECT (as well as EXCEPT) in addition to UNION since\nMariaDB 10.3.\n\nAll behavior for naming columns, ORDER BY and LIMIT is the same as for UNION.\n\nINTERSECT implicitly supposes a DISTINCT operation.\n\nThe result of an intersect is the intersection of right and left SELECT\nresults, i.e. only records that are present in both result sets will be\nincluded in the result of the operation.\n\nINTERSECT has higher precedence than UNION and EXCEPT (unless running running\nin Oracle mode, in which case all three have the same precedence). If possible\nit will be executed linearly but if not it will be translated to a subquery in\nthe 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\nMariaDB starting with 10.4.0\n----------------------------\n\nParentheses\n-----------\n\nFrom MariaDB 10.4.0, parentheses can be used to specify precedence. Before\nthis, a syntax error would be returned.\n\nMariaDB starting with 10.5.0\n----------------------------\n\nALL/DISTINCT\n------------\n\nINTERSECT ALL and INTERSECT DISTINCT were introduced in MariaDB 10.5.0. The\nALL operator leaves duplicates intact, while the DISTINCT operator removes\nduplicates. DISTINCT is the default behavior if neither operator is supplied,\nand the only behavior prior to MariaDB 10.5.\n\nExamples\n--------\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. INTERSECT ALL and EXCEPT ALL\nare available from MariaDB 10.5.0.\n\nCREATE TABLE seqs (i INT);\nINSERT INTO seqs VALUES (1),(2),(2),(3),(3),(4),(5),(6);\n\nSELECT i FROM seqs WHERE i <= 3 UNION SELECT i FROM seqs WHERE i>=3;\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 UNION ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n| 3 |\n| 3 |\n| 3 |\n| 3 |\n| 4 |\n| 5 |\n| 6 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 EXCEPT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 2 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\n+------+\n\nSELECT i FROM seqs WHERE i <= 3 INTERSECT ALL SELECT i FROM seqs WHERE i>=3;\n+------+\n| i |\n+------+\n| 3 |\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 (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 (SELECT c FROM t3));\n+------+\n| a |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 6 |\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 (430,27,'Precedence Control in Table Operations','MariaDB starting with 10.4.0\n----------------------------\nBeginning in MariaDB 10.4, you can control the ordering of execution on table\noperations using parentheses.\n\nSyntax\n------\n\n( expression )\n[ORDER BY [column[, column...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUsing parentheses in your SQL allows you to control the order of execution for\nSELECT statements and Table Value Constructor, including UNION, EXCEPT, and\nINTERSECT operations. MariaDB executes the parenthetical expression before the\nrest of the statement. You can then use ORDER BY and LIMIT clauses the further\norganize the result-set.\n\nNote: In practice, the Optimizer may rearrange the exact order in which\nMariaDB executes different parts of the statement. When it calculates the\nresult-set, however, it returns values as though the parenthetical expression\nwere executed first.\n\nExample\n-------\n\nCREATE TABLE test.t1 (num INT);\n\nINSERT INTO test.t1 VALUES (1),(2),(3);\n\n(SELECT * FROM test.t1 \n UNION \n VALUES (10)) \nINTERSECT \nVALUES (1),(3),(10),(11);\n+------+\n| num |\n+------+\n| 1 |\n| 3 |\n| 10 |\n+------+\n\n((SELECT * FROM test.t1 \n UNION\n VALUES (10))\n INTERSECT \n VALUES (1),(3),(10),(11)) \nORDER BY 1 DESC;\n+------+\n| num |\n+------+\n| 10 |\n| 3 |\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/precedence-control-in-table-operations/','','https://mariadb.com/kb/en/precedence-control-in-table-operations/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,27,'LIMIT','Description\n-----------\n\nUse the LIMIT clause to restrict the number of returned rows. When you use a\nsingle integer n with LIMIT, the first n rows will be returned. Use the ORDER\nBY clause to control which rows come first. You can also select a number of\nrows after an offset using 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 rows will be ignored,\nand the following n rows will be returned.\n\nExecuting an UPDATE with the LIMIT clause is not safe for replication. LIMIT 0\nis an exception to this rule (see MDEV-6170).\n\nThere is a LIMIT ROWS EXAMINED optimization which provides the means to\nterminate the execution of SELECT statements which examine too many rows, and\nthus use too many resources. See LIMIT ROWS EXAMINED.\n\nMulti-Table Updates\n-------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use LIMIT (or ORDER BY) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nGROUP_CONCAT\n------------\n\nMariaDB starting with 10.3.2\n----------------------------\nStarting from MariaDB 10.3.3, it is possible to use LIMIT with GROUP_CONCAT().\n\nExamples\n--------\n\nCREATE TABLE members (name VARCHAR(20));\nINSERT INTO members VALUES(\'Jagdish\'),(\'Kenny\'),(\'Rokurou\'),(\'Immaculada\');\n\nSELECT * FROM members;\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| name |\n+---------+\n| Jagdish |\n| Kenny |\n+---------+\n\nAll the names in alphabetical order:\n\nSELECT * FROM members ORDER BY name;\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| name |\n+------------+\n| Immaculada |\n| Jagdish |\n+------------+\n\nThe third name, ordered alphabetically (the first name would be offset zero,\nso the third is offset two):\n\nSELECT * FROM members ORDER BY name LIMIT 2,1;\n+-------+\n| name |\n+-------+\n| Kenny |\n+-------+\n\nFrom MariaDB 10.3.2, LIMIT can be used in a multi-table update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (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, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\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| 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, so, for example,\ngiven 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) ORDER BY cc\nDESC),\",\",1) FROM d;\n+----------------------------------------------------------------------------+\n| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY 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 LIMIT 1) FROM d;\n+-------------------------------------------------------------+\n| GROUP_CONCAT(CONCAT_WS(\":\",dd,cc) ORDER BY cc DESC LIMIT 1) |\n+-------------------------------------------------------------+\n| 2017-01-04:3 |\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 (432,27,'ORDER BY','Description\n-----------\n\nUse the ORDER BY clause to order a resultset, such as that are returned from a\nSELECT statement. You can specify just a column or use any expression with\nfunctions. If you are using the GROUP BY clause, you can use grouping\nfunctions in ORDER BY. Ordering is done after grouping.\n\nYou can use multiple ordering expressions, separated by commas. Rows will be\nsorted by the first expression, then by the second expression if they have the\nsame value for the first, and so on.\n\nYou can use the keywords ASC and DESC after each ordering expression to force\nthat ordering to be ascending or descending, respectively. Ordering is\nascending by default.\n\nYou can also use a single integer as the ordering expression. If you use an\ninteger n, the results will be ordered by the nth column in the select\nexpression.\n\nWhen string values are compared, they are compared as if by the STRCMP\nfunction. STRCMP ignores trailing whitespace and may normalize characters and\nignore case, depending on the collation in use.\n\nDuplicated entries in the ORDER BY clause are removed.\n\nORDER BY can also be used to order the activities of a DELETE or UPDATE\nstatement (usually with the LIMIT clause).\n\nMariaDB starting with 10.3.2\n----------------------------\nUntil MariaDB 10.3.1, it was not possible to use ORDER BY (or LIMIT) in a\nmulti-table UPDATE statement. This restriction was lifted in MariaDB 10.3.2.\n\nMariaDB starting with 10.5\n--------------------------\nFrom MariaDB 10.5, MariaDB allows packed sort keys and values of non-sorted\nfields in the sort buffer. This can make filesort temporary files much smaller\nwhen VARCHAR, CHAR or BLOBs are used, notably speeding up some ORDER BY sorts.\n\nExamples\n--------\n\nCREATE TABLE seq (i INT, x VARCHAR(1));\nINSERT INTO seq VALUES (1,\'a\'), (2,\'b\'), (3,\'b\'), (4,\'f\'), (5,\'e\');\n\nSELECT * FROM seq ORDER BY i;\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| 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| 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 1;\n\nSELECT * FROM seq;\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 update:\n\nCREATE TABLE warehouse (product_id INT, qty INT);\nINSERT INTO warehouse VALUES (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, store.qty =\nstore.qty+2 \n WHERE (warehouse.product_id = store.product_id AND store.product_id >= 1)\n ORDER BY store.product_id DESC LIMIT 2;\n\nSELECT * FROM warehouse;\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| product_id | qty |\n+------------+------+\n| 1 | 5 |\n| 2 | 5 |\n| 3 | 7 |\n| 4 | 7 |\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,'GROUP BY','Use the GROUP BY clause in a SELECT statement to group rows together that have\nthe same value in one or more column, or the same computed value using\nexpressions with any functions and operators except grouping functions. When\nyou use a GROUP BY clause, you will get a single result row for each group of\nrows that have the same value for the expression given in GROUP BY.\n\nWhen grouping rows, grouping values are compared as if by the = operator. For\nstring values, the = operator ignores trailing whitespace and may normalize\ncharacters and ignore case, depending on the collation in use.\n\nYou can use any of the grouping functions in your select expression. Their\nvalues will be calculated based on all the rows that have been grouped\ntogether for each result row. If you select a non-grouped column or a value\ncomputed from a non-grouped column, it is undefined which row the returned\nvalue is taken from. This is not permitted if the ONLY_FULL_GROUP_BY SQL_MODE\nis used.\n\nYou can use multiple expressions in the GROUP BY clause, separated by commas.\nRows are grouped together if they match on each of the expressions.\n\nYou can also use a single integer as the grouping expression. If you use an\ninteger n, the results will be grouped by the nth column in the select\nexpression.\n\nThe WHERE clause is applied before the GROUP BY clause. It filters\nnon-aggregated rows before the rows are grouped together. To filter grouped\nrows based on aggregate values, use the HAVING clause. The HAVING clause takes\nany expression and evaluates it as a boolean, just like the WHERE clause. You\ncan use grouping functions in the HAVING clause. As with the select\nexpression, if you reference non-grouped columns in the HAVING clause, the\nbehavior is undefined.\n\nBy default, if a GROUP BY clause is present, the rows in the output will be\nsorted by the expressions used in the GROUP BY. You can also specify ASC or\nDESC (ascending, descending) after those expressions, like in ORDER BY. The\ndefault is ASC.\n\nIf you want the rows to be sorted by another field, you can add an explicit\nORDER BY. If you don\'t want the result to be ordered, you can add ORDER BY\nNULL.\n\nWITH ROLLUP\n-----------\n\nThe WITH ROLLUP modifer adds extra rows to the resultset that represent\nsuper-aggregate summaries. For a full description with examples, see SELECT\nWITH ROLLUP.\n\nGROUP BY Examples\n-----------------\n\nConsider the following table that records how many times each user has played\nand 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| 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 refer back to an\nidentifer specified with AS. Get a list of win averages along with a count:\n\nSELECT (wins / plays) AS winavg, COUNT(*) FROM plays GROUP BY winavg;\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 in the select expression. For each win\naverage as above, get a list of the average play count taken to get that\naverage:\n\nSELECT (wins / plays) AS winavg, AVG(plays) FROM plays \n GROUP BY winavg;\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 clause. The HAVING\nclause is applied after GROUP BY and allows you to filter on aggregate data\nthat is not available to the WHERE clause. Restrict the above example to\nresults that involve an 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| winavg | AVG(plays) |\n+--------+------------+\n| 0.2500 | 26.0000 |\n| 0.3636 | 22.0000 |\n+--------+------------+\n2 rows in set (0.00 sec)\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 (434,27,'WITH','MariaDB starting with 10.2.1\n----------------------------\nCommon Table Expressions were introduced in MariaDB 10.2.1.\n\nSyntax\n------\n\nWITH [RECURSIVE] table_reference [(columns_list)] AS (\n SELECT ...\n)\n[CYCLE cycle_column_list RESTRICT]\nSELECT ...\n\nDescription\n-----------\n\nThe WITH keyword signifies a Common Table Expression (CTE). It allows you to\nrefer to a subquery expression many times in a query, as if having a temporary\ntable that only exists for the duration of a query.\n\nThere are two kinds of CTEs:\n\n* Non-Recursive\n* Recursive (signified by the RECURSIVE keyword, supported since MariaDB\n10.2.2)\n\nYou can use table_reference as any normal table in the external SELECT part.\nYou can also use WITH in subqueries, as well as with EXPLAIN and SELECT.\n\nPoorly-formed recursive CTEs can in theory cause infinite loops. The\nmax_recursive_iterations system variable limits the number of recursions.\n\nCYCLE ... RESTRICT\n------------------\n\nMariaDB starting with 10.5.2\n----------------------------\nThe CYCLE clause enables CTE cycle detection, avoiding excessive or infinite\nloops, MariaDB supports a relaxed, non-standard grammar.\n\nThe SQL Standard permits a CYCLE clause, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE <cycle column list>\nSET <cycle mark column> TO <cycle mark value> DEFAULT <non-cycle mark value>\nUSING <path column>\n\nwhere all clauses are mandatory.\n\nMariaDB does not support this, but from 10.5.2 permits a non-standard relaxed\ngrammar, as follows:\n\nWITH RECURSIVE ... (\n ...\n)\nCYCLE <cycle column list> RESTRICT\n\nWith the use of CYCLE ... RESTRICT it makes no difference whether the CTE uses\nUNION ALL or UNION DISTINCT anymore. UNION ALL means \"all rows, but without\ncycles\", which is exactly what the CYCLE clause enables. And UNION DISTINCT\nmeans all rows should be different, which, again, is what will happen — as\nuniqueness is enforced over a subset of columns, complete rows will\nautomatically all be different.\n\nExamples\n--------\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 < 5)\n SELECT t2.c FROM t2, t WHERE t2.c = t.a);\n\nBelow is an example of a Recursive CTE:\n\nWITH RECURSIVE ancestors AS \n ( SELECT * FROM folks\n WHERE name=\"Alex\"\n UNION\n SELECT f.*\n FROM folks AS f, ancestors AS a\n WHERE f.id = a.father OR f.id = a.mother )\nSELECT * FROM ancestors;\n\nTake the following structure, and data,\n\nCREATE TABLE t1 (from_ int, to_ int);\nINSERT INTO t1 VALUES (1,2), (1,100), (2,3), (3,4), (4,1);\nSELECT * FROM t1;\n+-------+------+\n| from_ | to_ |\n+-------+------+\n| 1 | 2 |\n| 1 | 100 |\n| 2 | 3 |\n| 3 | 4 |\n| 4 | 1 |\n+-------+------+\n\nGiven the above, the following query would theoretically result in an infinite\nloop due to the last record in t1 (note that max_recursive_iterations is set\nto 10 for the purposes of this example, to avoid the excessive number of\ncycles):\n\nSET max_recursive_iterations=10;\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION DISTINCT SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n| 5 | 1 | 2 |\n| 5 | 1 | 100 |\n| 6 | 2 | 3 |\n| 7 | 3 | 4 |\n| 8 | 4 | 1 |\n| 9 | 1 | 2 |\n| 9 | 1 | 100 |\n| 10 | 2 | 3 |\n+-------+-------+------+\n\nHowever, the CYCLE ... RESTRICT clause (from MariaDB 10.5.2) can overcome this:\n\nWITH RECURSIVE cte (depth, from_, to_) AS ( \n SELECT 0,1,1 UNION SELECT depth+1, t1.from_, t1.to_\n FROM t1, cte WHERE t1.from_ = cte.to_\n) \nCYCLE from_, to_ RESTRICT \nSELECT * FROM cte;\n+-------+-------+------+\n| depth | from_ | to_ |\n+-------+-------+------+\n| 0 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 1 | 100 |\n| 2 | 2 | 3 |\n| 3 | 3 | 4 |\n| 4 | 4 | 1 |\n+-------+-------+------+\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 (435,27,'Non-Recursive Common Table Expressions Overview','Common Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. There are two kinds of CTEs:\nNon-Recursive, which this article covers; and Recursive.\n\nMariaDB starting with 10.2.1\n----------------------------\nCommon table expressions were introduced in MariaDB 10.2.1.\n\nNon-Recursive CTEs\n------------------\n\nThe WITH keyword signifies a CTE. It is given a name, followed by a body (the\nmain 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 are several\nadvantages and caveats to them. The syntax is more readable than nested FROM\n(SELECT ...). A CTE can refer to another and it can be referenced from\nmultiple places.\n\nA CTE referencing Another CTE\n-----------------------------\n\nUsing this format makes for a more readable SQL than a nested FROM(SELECT ...)\nclause. 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 IN(\'NL\',...) )\nSELECT\n...\nFROM eu_engineers;\n\nMultiple Uses of a CTE\n----------------------\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. Below is an example\nof 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\nURL: https://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 (436,27,'Recursive Common Table Expressions Overview','MariaDB starting with 10.2.2\n----------------------------\nRecursive Common Table Expressions have been supported since MariaDB 10.2.2.\n\nCommon Table Expressions (CTEs) are a standard SQL feature, and are\nessentially temporary named result sets. CTEs first appeared in the SQL\nstandard in 1999, and the first implementations began appearing in 2007.\n\nThere are two kinds of CTEs:\n\n* Non-recursive\n* Recursive, which this article covers.\n\nSQL is generally poor at recursive structures.\n\nCTEs permit a query to reference itself. A recursive CTE will repeatedly\nexecute subsets of the data until it obtains the complete result set. This\nmakes it particularly useful for handing hierarchical or tree-structured data.\nmax_recursive_iterations avoids infinite loops.\n\nSyntax example\n--------------\n\nWITH RECURSIVE signifies a recursive CTE. It is given a name, followed by a\nbody (the main query) as follows:\n\nComputation\n-----------\n\nGiven the following structure:\n\nFirst execute the anchor part of the query:\n\nNext, execute the recursive part of the query:\n\nSummary so far\n--------------\n\nwith recursive R as (\n select anchor_data\n union [all]\n select recursive_part\n from R, ...\n)\nselect ...\n\n* Compute anchor_data\n* Compute recursive_part to get the new data\n* if (new data is non-empty) goto 2;\n\nCAST to avoid truncating data\n-----------------------------\n\nAs currently implemented by MariaDB and by the SQL Standard, data may be\ntruncated if not correctly cast. It is necessary to CAST the column to the\ncorrect width if the CTE\'s recursive part produces wider values for a column\nthan the CTE\'s nonrecursive part. Some other DBMS give an error in this\nsituation, and MariaDB\'s behavior may change in future - see MDEV-12325. See\nthe examples below.\n\nExamples\n--------\n\nTransitive closure - determining bus destinations\n-------------------------------------------------\n\nSample data:\n\nCREATE TABLE bus_routes (origin varchar(50), dst varchar(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 the origin:\n\nWITH RECURSIVE bus_dst as ( \n SELECT origin as dst FROM bus_routes WHERE origin=\'New York\'\n UNION\n SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst=\nbus_routes.origin \n) \nSELECT * FROM bus_dst;\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:\n\n* Starting from New York\n* Boston and Washington are added\n\nNext, the recursive part:\n\n* Starting from Boston and then Washington\n* Raleigh is added\n* UNION excludes nodes that are already present.\n\nComputing paths - determining bus routes\n----------------------------------------\n\nThis time, we are trying to get bus routes such as \"New York -> Washington ->\nRaleigh\".\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 York\'\n UNION\n SELECT CONCAT(paths.cur_path, \',\', bus_routes.dst), bus_routes.dst\n FROM paths\n JOIN bus_routes\n ON paths.cur_dest = bus_routes.origin AND\n NOT FIND_IN_SET(bus_routes.dst, paths.cur_path)\n) \nSELECT * FROM paths;\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-----------------------------\n\nIn the following example, data is truncated because the results are not\nspecifically 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)\nSELECT col FROM tbl\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| col |\n+---------------------+\n| NULL |\n| THIS NEVER SHOWS UP |\n+---------------------+\n\nURL: https://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 (437,27,'SELECT WITH ROLLUP','Syntax\n------\n\nSee SELECT for the full syntax.\n\nDescription\n-----------\n\nThe WITH ROLLUP modifier adds extra rows to the resultset that represent\nsuper-aggregate summaries. The super-aggregated column is represented by a\nNULL value. Multiple aggregates over different columns will be added if there\nare multiple GROUP BY columns.\n\nThe LIMIT clause can be used at the same time, and is applied after the WITH\nROLLUP rows have been added.\n\nWITH ROLLUP cannot be used with ORDER BY. Some sorting is still possible by\nusing ASC or DESC clauses with the GROUP BY column, although the\nsuper-aggregate rows will always be added last.\n\nExamples\n--------\n\nThese examples use the following sample table\n\nCREATE TABLE booksales ( \n country VARCHAR(35), genre ENUM(\'fiction\',\'non-fiction\'), year YEAR, sales\nINT);\n\nINSERT INTO booksales VALUES\n (\'Senegal\',\'fiction\',2014,12234), (\'Senegal\',\'fiction\',2015,15647),\n (\'Senegal\',\'non-fiction\',2014,64980), (\'Senegal\',\'non-fiction\',2015,78901),\n (\'Paraguay\',\'fiction\',2014,87970), (\'Paraguay\',\'fiction\',2015,76940),\n (\'Paraguay\',\'non-fiction\',2014,8760), (\'Paraguay\',\'non-fiction\',2015,9030);\n\nThe addition of the WITH ROLLUP modifier in this example adds an extra row\nthat aggregates both years:\n\nSELECT year, SUM(sales) FROM booksales GROUP BY year;\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 ROLLUP;\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 the country change,\nanother super-aggregate row is added:\n\nSELECT country, year, genre, SUM(sales) \n FROM booksales GROUP BY country, year, genre;\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| 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 LIMIT 4;\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 ROLLUP;\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\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 (438,27,'SELECT INTO OUTFILE','Syntax\n------\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-----------\n\nSELECT INTO OUTFILE writes the resulting rows to a file, and allows the use of\ncolumn and row terminators to specify a particular output format. The default\nis to terminate fields with tabs (\\t) and lines with newlines (\\n).\n\nThe file must not exist. It cannot be overwritten. A user needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nThe LOAD DATA INFILE statement complements SELECT INTO OUTFILE.\n\nCharacter-sets\n--------------\n\nThe CHARACTER SET clause specifies the character set in which the results are\nto be written. Without the clause, no conversion takes place (the binary\ncharacter set). In this case, if there are multiple character sets, the output\nwill contain these too, and may not easily be able to be reloaded.\n\nIn cases where you have two servers using different character-sets, using\nSELECT INTO OUTFILE to transfer data from one to the other can have unexpected\nresults. To ensure that MariaDB correctly interprets the escape sequences, use\nthe CHARACTER SET clause on both the SELECT INTO OUTFILE statement and the\nsubsequent LOAD DATA INFILE statement.\n\nExample\n-------\n\nThe following example produces a file in the CSV format:\n\nSELECT customer_id, firstname, surname INTO OUTFILE \'/exportdata/customers.txt\'\n FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\"\'\n LINES TERMINATED BY \'\\n\'\n FROM customers;\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 INTO DUMPFILE','Syntax\n------\n\nSELECT ... INTO DUMPFILE \'file_path\'\n\nDescription\n-----------\n\nSELECT ... INTO DUMPFILE is a SELECT clause which writes the resultset into a\nsingle unformatted row, without any separators, in a file. The results will\nnot be returned to the client.\n\nfile_path can be an absolute path, or a relative path starting from the data\ndirectory. It can only be specified as a string literal, not as a variable.\nHowever, the statement can be dynamically composed and executed as a prepared\nstatement to work around this limitation.\n\nThis statement is binary-safe and so is particularly useful for writing BLOB\nvalues to file. It can be used, for example, to copy an image or an audio\ndocument from the database 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 needs the FILE\nprivilege to run this statement. Also, MariaDB needs permission to write files\nin the specified location. If the secure_file_priv system variable is set to a\nnon-empty directory name, the file can only be written to that directory.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nExample\n-------\n\nSELECT _utf8\'Hello world!\' INTO DUMPFILE \'/tmp/world\';\n\nSELECT LOAD_FILE(\'/tmp/world\') AS world;\n+--------------+\n| world |\n+--------------+\n| Hello world! |\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 (440,27,'FOR UPDATE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nThe FOR UPDATE clause of SELECT applies only when autocommit is set to 0 or\nthe SELECT is enclosed in a transaction. A lock is acquired on the rows, and\nother transactions are prevented from writing the rows, acquire locks, and\nfrom reading them (unless their isolation level is READ UNCOMMITTED).\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\n\nIf the isolation level is set to SERIALIZABLE, all plain SELECT statements are\nconverted to SELECT ... LOCK IN SHARE MODE.\n\nExample\n-------\n\nSELECT * FROM trans WHERE period=2001 FOR UPDATE;\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 (441,27,'LOCK IN SHARE MODE','InnoDB supports row-level locking. Selected rows can be locked using LOCK IN\nSHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read\nby the query, and it will be released when the current transaction is\ncommitted.\n\nWhen LOCK IN SHARE MODE is specified in a SELECT statement, MariaDB will wait\nuntil all transactions that have modified the rows are committed. Then, a\nwrite lock is acquired. All transactions can read the rows, but if they want\nto modify them, they have to wait until your transaction is committed.\n\nIf autocommit is set to 1, the LOCK IN SHARE MODE and FOR UPDATE clauses have\nno effect.\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 (442,27,'Optimizer Hints','Optimizer hints\n---------------\n\nThere are some options available in SELECT to affect the execution plan. These\nare known as optimizer hints.\n\nHIGH PRIORITY\n-------------\n\nHIGH_PRIORITY gives the statement a higher priority. If the table is locked,\nhigh priority SELECTs will be executed as soon as the lock is released, even\nif other statements are queued. HIGH_PRIORITY applies only if the storage\nengine only supports table-level locking (MyISAM, MEMORY, MERGE). See\nHIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nSQL_CACHE / SQL_NO_CACHE\n------------------------\n\nIf the query_cache_type system variable is set to 2 or DEMAND, and the current\nstatement is cacheable, SQL_CACHE causes the query to be cached and\nSQL_NO_CACHE causes the query not to be cached. For UNIONs, SQL_CACHE or\nSQL_NO_CACHE should be specified for the first query. See also The Query Cache\nfor more detail and a list of the types of statements that aren\'t cacheable.\n\nSQL_BUFFER_RESULT\n-----------------\n\nSQL_BUFFER_RESULT forces the optimizer to use a temporary table to process the\nresult. This is useful to free locks as soon as possible.\n\nSQL_SMALL_RESULT / SQL_BIG_RESULT\n---------------------------------\n\nSQL_SMALL_RESULT and SQL_BIG_RESULT tell the optimizer whether the result is\nvery big or not. Usually, GROUP BY and DISTINCT operations are performed using\na temporary table. Only if the result is very big, using a temporary table is\nnot convenient. The optimizer automatically knows if the result is too big,\nbut you can force the optimizer to use a temporary table with\nSQL_SMALL_RESULT, or avoid the temporary table using SQL_BIG_RESULT.\n\nSTRAIGHT_JOIN\n-------------\n\nSTRAIGHT_JOIN applies to the JOIN queries, and tells the optimizer that the\ntables must be read in the order they appear in the SELECT. For const and\nsystem table this options is sometimes ignored.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nSQL_CALC_FOUND_ROWS is only applied when using the LIMIT clause. If this\noption is used, MariaDB will count how many rows would match the query,\nwithout the LIMIT clause. That number can be retrieved in the next query,\nusing FOUND_ROWS().\n\nUSE/FORCE/IGNORE INDEX\n----------------------\n\nUSE INDEX, FORCE INDEX and IGNORE INDEX constrain the query planning to a\nspecific index.\n\nFor further information about some of these options, see How to force query\nplans.\n\nURL: https://mariadb.com/kb/en/optimizer-hints/','','https://mariadb.com/kb/en/optimizer-hints/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (443,27,'PROCEDURE','The PROCEDURE clause of SELECT passes the whole result set to a Procedure\nwhich will process it. These Procedures are not Stored Procedures, and can\nonly be written in the C language, so it is necessary to recompile the server.\n\nCurrently, the only available procedure is ANALYSE, which examines the\nresultset and suggests the optimal datatypes for each column. It is defined in\nthe sql/sql_analyse.cc file, and can be used as an example to create more\nProcedures.\n\nThis clause cannot be used in a view\'s definition.\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 (444,27,'DUAL','Description\n-----------\n\nYou are allowed to specify DUAL as a dummy table name in situations where no\ntables are referenced, such as the following SELECT statement:\n\nSELECT 1 + 1 FROM DUAL;\n+-------+\n| 1 + 1 |\n+-------+\n| 2 |\n+-------+\n\nDUAL is purely for the convenience of people who require that all SELECT\nstatements should have FROM and possibly other clauses. MariaDB ignores the\nclauses. MariaDB does not require FROM DUAL if no tables are referenced.\n\nFROM DUAL could be used when you only SELECT computed values, but require a\nWHERE clause, perhaps to test that a script correctly handles empty resultsets:\n\nSELECT 1 FROM DUAL WHERE FALSE;\nEmpty set (0.00 sec)\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 (445,27,'SELECT ... OFFSET ... FETCH','MariaDB starting with 10.6.0\n----------------------------\nSELECT ... OFFSET ... FETCH was introduced in MariaDB 10.6.\n\nSyntax\n------\n\nOFFSET start { ROW | ROWS }\nFETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }\n\nDescription\n-----------\n\nThe OFFSET clause allows one to return only those elements of a resultset that\ncome after a specified offset. The FETCH clause specifies the number of rows\nto return, while ONLY or WITH TIES specifies whether or not to also return any\nfurther results that tie for last place according to the ordered resultset.\n\nEither the singular ROW or the plural ROWS can be used after the OFFSET and\nFETCH clauses; the choice has no impact on the results.\n\nIn the case of WITH TIES, an ORDER BY clause is required, otherwise an ERROR\nwill be returned.\n\nSELECT i FROM t1 FETCH FIRST 2 ROWS WITH TIES;\nERROR 4180 (HY000): FETCH ... WITH TIES requires ORDER BY clause to be present\n\nExamples\n--------\n\nGiven a table with 6 rows:\n\nCREATE OR REPLACE TABLE t1 (i INT);\nINSERT INTO t1 VALUES (1),(2),(3),(4), (4), (5);\nSELECT i FROM t1 ORDER BY i ASC;\n+------+\n| i |\n+------+\n| 1 |\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nOFFSET 2 allows one to skip the first two results.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 2 ROWS;\n+------+\n| i |\n+------+\n| 3 |\n| 4 |\n| 4 |\n| 5 |\n+------+\n\nFETCH FIRST 3 ROWS ONLY limits the results to three rows only\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS ONLY;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nThe same outcome can also be achieved with the LIMIT clause:\n\nSELECT i FROM t1 ORDER BY i ASC LIMIT 3 OFFSET 1;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n+------+\n\nWITH TIES ensures the tied result 4 is also returned.\n\nSELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS WITH TIES;\n+------+\n| i |\n+------+\n| 2 |\n| 3 |\n| 4 |\n| 4 |\n+------+\n\nURL: https://mariadb.com/kb/en/select-offset-fetch/','','https://mariadb.com/kb/en/select-offset-fetch/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (446,27,'INSERT','Syntax\n------\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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nThe INSERT statement is used to insert new rows into an existing table. The\nINSERT ... VALUES and INSERT ... SET forms of the statement insert rows based\non explicitly specified values. The INSERT ... SELECT form inserts rows\nselected from another table or tables. INSERT ... SELECT is discussed further\nin the INSERT ... SELECT article.\n\nThe table name can be specified in the form db_name.tbl_name or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use INSERT ... SELECT to copy rows between different databases.\n\nThe PARTITION clause can be used in both the INSERT and the SELECT part. See\nPartition Pruning and Selection for details.\n\nMariaDB starting with 10.5\n--------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.\n\nThe columns list is optional. It specifies which values are explicitly\ninserted, and in which order. If this clause is not specified, all values must\nbe explicitly specified, in the same order they are listed in the table\ndefinition.\n\nThe list of value follow the VALUES or VALUE keyword (which are\ninterchangeable, regardless how much values you want to insert), and is\nwrapped by parenthesis. The values must be listed in the same order as the\ncolumns list. It is possible to specify more than one list to insert more than\none rows with a single statement. If many rows are inserted, this is a speed\noptimization.\n\nFor one-row statements, the SET clause may be more simple, because you don\'t\nneed to remember the columns order. All values are specified in the form col =\nexpr.\n\nValues can also be specified in the form of a SQL expression or subquery.\nHowever, the subquery cannot access the same table that is named in the INTO\nclause.\n\nIf you use the LOW_PRIORITY keyword, execution of the INSERT is delayed until\nno other clients are reading from the table. If you use the HIGH_PRIORITY\nkeyword, the statement has the same priority as SELECTs. This affects only\nstorage engines that use only table-level locking (MyISAM, MEMORY, MERGE).\nHowever, if one of these keywords is specified, concurrent inserts cannot be\nused. See HIGH_PRIORITY and LOW_PRIORITY clauses for details.\n\nINSERT DELAYED\n--------------\n\nFor more details on the DELAYED option, see INSERT DELAYED.\n\nHIGH PRIORITY and LOW PRIORITY\n------------------------------\n\nSee HIGH_PRIORITY and LOW_PRIORITY.\n\nDefaults and Duplicate Values\n-----------------------------\n\nSee INSERT - Default & Duplicate Values for details..\n\nINSERT IGNORE\n-------------\n\nSee INSERT IGNORE.\n\nINSERT ON DUPLICATE KEY UPDATE\n------------------------------\n\nSee INSERT ON DUPLICATE KEY UPDATE.\n\nExamples\n--------\n\nSpecifying the column names:\n\nINSERT INTO person (first_name, last_name) VALUES (\'John\', \'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 = \'Doe\';\n\nSELECTing from another table:\n\nINSERT INTO contractor SELECT * FROM person WHERE status = \'c\';\n\nSee INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE for further examples.\n\nINSERT ... RETURNING\n--------------------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statement\n\nINSERT INTO t2 VALUES (1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \nRETURNING id2,id2+id2,id2&id2,id2||id2;\n+-----+---------+---------+----------+\n| id2 | id2+id2 | id2&id2 | id2||id2 |\n+-----+---------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+-----+---------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\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 (447,27,'INSERT DELAYED','Syntax\n------\n\nINSERT DELAYED ...\n\nDescription\n-----------\n\nThe DELAYED option for the INSERT statement is a MariaDB/MySQL extension to\nstandard SQL that is very useful if you have clients that cannot or need not\nwait for the INSERT to complete. This is a common situation when you use\nMariaDB for logging and you also periodically run SELECT and UPDATE statements\nthat take a long time to complete.\n\nWhen a client uses INSERT DELAYED, it gets an okay from the server at once,\nand the row is queued to be inserted when the table is not in use by any other\nthread.\n\nAnother major benefit of using INSERT DELAYED is that inserts from many\nclients are bundled together and written in one block. This is much faster\nthan performing many separate inserts.\n\nNote that INSERT DELAYED is slower than a normal INSERT if the table is not\notherwise in use. There is also the additional overhead for the server to\nhandle a separate thread for each table for which there are delayed rows. This\nmeans that you should use INSERT DELAYED only when you are really sure that\nyou need it.\n\nThe queued rows are held only in memory until they are inserted into the\ntable. This means that if you terminate mysqld forcibly (for example, with\nkill -9) or if mysqld dies unexpectedly, any queued rows that have not been\nwritten to disk are lost.\n\nThe number of concurrent INSERT DELAYED threads is limited by the\nmax_delayed_threads server system variables. If it is set to 0, INSERT DELAYED\nis disabled. The session value can be equal to the global value, or 0 to\ndisable this statement for the current session. If this limit has been\nreached, the DELAYED clause will be silently ignore for subsequent statements\n(no error will be produced).\n\nLimitations\n-----------\n\nThere are some limitations on the use of DELAYED:\n\n* INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE,\n and BLACKHOLE tables. If you execute INSERT DELAYED with another storage\nengine, you will get an error like this: ERROR 1616 (HY000): DELAYED option\nnot supported for table \'tab_name\'\n* For MyISAM tables, if there are no free blocks in the middle of the data\n file, concurrent SELECT and INSERT statements are supported. Under these\n circumstances, you very seldom need to use INSERT DELAYED\n with MyISAM.\n* INSERT 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.\n* Because 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.\n* DELAYED rows are not visible to SELECT\n statements until they actually have been inserted.\n* After INSERT DELAYED, ROW_COUNT() returns the number of the rows you tried\nto insert, not the number of the successful writes.\n* DELAYED 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 replication.\n* Pending INSERT DELAYED statements are lost if a table is\n write locked and ALTER TABLE is used to modify the table structure.\n* INSERT DELAYED is not supported for views. If you try, you will get an error\nlike this: ERROR 1347 (HY000): \'view_name\' is not BASE TABLE\n* INSERT DELAYED is not supported for partitioned tables.\n* INSERT DELAYED is not supported within stored programs.\n* INSERT DELAYED does not work with triggers.\n* INSERT DELAYED does not work if there is a check constraint in place.\n* INSERT DELAYED does not work if skip-new mode is active.\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 (448,27,'INSERT SELECT','Syntax\n------\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-----------\n\nWith INSERT ... SELECT, you can quickly insert many rows into a table from one\nor 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 (see Identifier\nQualifiers). This allows to copy rows between different databases.\n\nIf the new table has a primary key or UNIQUE indexes, you can use IGNORE to\nhandle duplicate key errors during the query. The newer values will not be\ninserted if an identical value already exists.\n\nREPLACE can be used instead of INSERT to prevent duplicates on UNIQUE indexes\nby deleting old values. In that case, ON DUPLICATE KEY UPDATE cannot be used.\n\nINSERT ... SELECT works for tables which already exist. To create a table for\na given resultset, you can use CREATE TABLE ... SELECT.\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 (449,27,'LOAD DATA INFILE','Syntax\n------\n\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nLOAD DATA INFILE is unsafe for statement-based replication.\n\nReads rows from a text file into the designated table on the database at a\nvery high speed. The file name must be given as a literal string.\n\nFiles are written to disk using the SELECT INTO OUTFILE statement. You can\nthen read the files back into a table using the LOAD DATA INFILE statement.\nThe FIELDS and LINES clauses are the same in both statements. These clauses\nare optional, but if both are specified then the FIELDS clause must precede\nLINES.\n\nExecuting this statement activates INSERT triggers.\n\nOne must have the FILE privilege to be able to execute LOAD DATA. This is the\nensure the normal users will not attempt to read system files.\n\nNote that MariaDB\'s systemd unit file restricts access to /home, /root, and\n/run/user by default. See Configuring access to home directories.\n\nLOAD DATA LOCAL INFILE\n----------------------\n\nWhen you execute the LOAD DATA INFILE statement, MariaDB Server attempts to\nread the input file from its own file system. In contrast, when you execute\nthe LOAD DATA LOCAL INFILE statement, the client attempts to read the input\nfile from its file system, and it sends the contents of the input file to the\nMariaDB Server. This allows you to load files from the client\'s local file\nsystem into the database.\n\nIn the event that you don\'t want to permit this operation (such as for\nsecurity reasons), you can disable the LOAD DATA LOCAL INFILE statement on\neither the server or the client.\n\n* The LOAD DATA LOCAL INFILE statement can be disabled on the server by\nsetting the local_infile system variable to 0.\n* The LOAD DATA LOCAL INFILE statement can be disabled on the client. If you\nare using MariaDB Connector/C, this can be done by unsetting the\nCLIENT_LOCAL_FILES capability flag with the mysql_real_connect function or by\nunsetting the MYSQL_OPT_LOCAL_INFILE option with mysql_optionsv function. If\nyou are using a different client or client library, then see the documentation\nfor your specific client or client library to determine how it handles the\nLOAD DATA LOCAL INFILE statement.\n\nIf the LOAD DATA LOCAL INFILE statement is disabled by either the server or\nthe client and if the user attempts to execute it, then the server will cause\nthe statement to fail with the following error message:\n\nThe used command is not allowed with this MariaDB version\n\nNote that it is not entirely accurate to say that the MariaDB version does not\nsupport the command. It would be more accurate to say that the MariaDB\nconfiguration does not support the command. See MDEV-20500 for more\ninformation.\n\nFrom MariaDB 10.5.2, the error message is more accurate:\n\nThe used command is not allowed because the MariaDB server or client \n has disabled the local infile capability\n\nREPLACE and IGNORE\n------------------\n\nIn cases where you load data from a file into a table that already contains\ndata and has a primary key, you may encounter issues where the statement\nattempts to insert a row with a primary key that already exists. When this\nhappens, the statement fails with Error 1064, protecting the data already on\nthe table. In cases where you want MariaDB to overwrite duplicates, use the\nREPLACE keyword.\n\nThe REPLACE keyword works like the REPLACE statement. Here, the statement\nattempts to load the data from the file. If the row does not exist, it adds it\nto the table. If the row contains an existing Primary Key, it replaces the\ntable data. That is, in the event of a conflict, it assumes the file contains\nthe desired row.\n\nThis operation can cause a degradation in load speed by a factor of 20 or more\nif the part that has already been loaded is larger than the capacity of the\nInnoDB Buffer Pool. This happens because it causes a lot of turnaround in the\nbuffer pool.\n\nUse the IGNORE keyword when you want to skip any rows that contain a\nconflicting primary key. Here, the statement attempts to load the data from\nthe file. If the row does not exist, it adds it to the table. If the row\ncontains an existing primary key, it ignores the addition request and moves on\nto the next. That is, in the event of a conflict, it assumes the table\ncontains the desired row.\n\nCharacter-sets\n--------------\n\nWhen the statement opens the file, it attempts to read the contents using the\ndefault character-set, as defined by the character_set_database system\nvariable.\n\nIn the cases where the file was written using a character-set other than the\ndefault, you can specify the character-set to use with the CHARACTER SET\nclause in the statement. It ignores character-sets specified by the SET NAMES\nstatement and by the character_set_client system variable. Setting the\nCHARACTER SET clause to a value of binary indicates \"no conversion.\"\n\nThe statement interprets all fields in the file as having the same\ncharacter-set, regardless of the column data type. To properly interpret file\ncontents, you must ensure that it was written with the correct character-set.\nIf you write a data file with mysqldump -T or with the SELECT INTO OUTFILE\nstatement with the mysql client, be sure to use the --default-character-set\noption, so that the output is written with the desired character-set.\n\nWhen using mixed character sets, use the CHARACTER SET clause in both SELECT\nINTO OUTFILE and LOAD DATA INFILE to ensure that MariaDB correctly interprets\nthe escape sequences.\n\nThe character_set_filesystem system variable controls the interpretation of\nthe filename.\n\nIt is currently not possible to load data files that use the ucs2 character\nset.\n\nPreprocessing Inputs\n--------------------\n\ncol_name_or_user_var can be a column name, or a user variable. In the case of\na variable, the SET statement can be used to preprocess the value before\nloading into the table.\n\nPriority and Concurrency\n------------------------\n\nIn storage engines that perform table-level locking (MyISAM, MEMORY and\nMERGE), using the LOW_PRIORITY keyword, MariaDB delays insertions until no\nother clients are reading from the table. Alternatively, when using the MyISAM\nstorage engine, you can use the CONCURRENT keyword to perform concurrent\ninsertion.\n\nThe LOW_PRIORITY and CONCURRENT keywords are mutually exclusive. They cannot\nbe used in the same statement.\n\nProgress Reporting\n------------------\n\nThe LOAD DATA INFILE statement supports progress reporting. You may find this\nuseful when dealing with long-running operations. Using another client you can\nissue a SHOW PROCESSLIST query to check the progress of the data load.\n\nUsing mariadb-import/mysqlimport\n--------------------------------\n\nMariaDB ships with a separate utility for loading data from files:\nmariadb-import (or mysqlimport before MariaDB 10.5). It operates by sending\nLOAD DATA INFILE statements to the server.\n\nUsing mariadb-import/mysqlimport you can compress the file using the\n--compress option, to get better performance over slow networks, providing\nboth the client and server support the compressed protocol. Use the --local\noption to load from the local file system.\n\nIndexing\n--------\n\nIn cases where the storage engine supports ALTER TABLE... DISABLE KEYS\nstatements (MyISAM and Aria), the LOAD DATA INFILE statement automatically\ndisables indexes during the execution.\n\nExamples\n--------\n\nYou have a file with this content (note the the separator is \',\', not tab,\nwhich is the default):\n\n2,2\n3,3\n4,4\n5,5\n6,8\n\nCREATE TABLE t1 (a int, b int, c int, d int);\nLOAD DATA LOCAL INFILE \n \'/tmp/loaddata7.dat\' into table t1 fields terminated by \',\' (a,b) set c=a+b;\nSELECT * FROM t1;\n+------+------+------+\n| a | b | c |\n+------+------+------+\n| 2 | 2 | 4 |\n| 3 | 3 | 6 |\n| 4 | 4 | 8 |\n| 5 | 5 | 10 |\n| 6 | 8 | 14 |\n+------+------+------+\n\nAnother example, given the following data (the separator is a tab):\n\n1 a\n2 b\n\nThe value of the first column is doubled before loading:\n\nLOAD DATA INFILE \'ld.txt\' INTO TABLE ld (@i,v) SET i=@i*2;\n\nSELECT * FROM ld;\n+------+------+\n| i | v |\n+------+------+\n| 2 | a |\n| 4 | b |\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 (450,27,'LOAD XML','Syntax\n------\n\nLOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE [db_name.]tbl_name\n [CHARACTER SET charset_name]\n [ROWS IDENTIFIED BY \'<tagname>\']\n [IGNORE number {LINES | ROWS}]\n [(column_or_user_var,...)]\n [SET col_name = expr,...]\n\nDescription\n-----------\n\nThe LOAD XML statement reads data from an XML file into a table. The file_name\nmust be given as a literal string. The tagname in the optional ROWS IDENTIFIED\nBY clause must also be given as a literal string, and must be surrounded by\nangle brackets (< and >).\n\nLOAD XML acts as the complement of running the mysql client in XML output mode\n(that is, starting the client with the --xml option). To write data from a\ntable to an XML file, use a command such as the following one from the system\nshell:\n\nshell> mysql --xml -e \'SELECT * FROM mytable\' > file.xml\n\nTo read the file back into a table, use LOAD XML INFILE. By default, the <row>\nelement is considered to be the equivalent of a database table row; this can\nbe changed using the ROWS IDENTIFIED BY clause.\n\nThis statement supports three different XML formats:\n\n* Column names as attributes and column values as attribute values:\n\n<row column1=\"value1\" column2=\"value2\" .../>\n\n* Column names as tags and column values as the content of these tags:\n\n<row>\n <column1>value1</column1>\n <column2>value2</column2>\n</row>\n\n* Column names are the name attributes of <field> tags, and values are\n the contents of these tags:\n\n<row>\n <field name=\'column1\'>value1</field>\n <field name=\'column2\'>value2</field>\n</row>\n\nThis is the format used by other tools, such as mysqldump.\n\nAll 3 formats can be used in the same XML file; the import routine\nautomatically detects the format for each row and interprets it correctly.\nTags are matched based on the tag or attribute name and the column name.\n\nThe following clauses work essentially the same way for LOAD XML as they do\nfor LOAD DATA:\n\n* LOW_PRIORITY or CONCURRENT\n* LOCAL\n* REPLACE or IGNORE\n* CHARACTER SET\n* (column_or_user_var,...)\n* SET\n\nSee LOAD DATA for more information about these clauses.\n\nThe IGNORE number LINES or IGNORE number ROWS clause causes the first number\nrows in the XML file to be skipped. It is analogous to the LOAD DATA\nstatement\'s IGNORE ... LINES clause.\n\nIf the LOW_PRIORITY keyword is used, insertions are delayed until no other\nclients are reading from the table. The CONCURRENT keyword allowes the use of\nconcurrent inserts. These clauses cannot be specified together.\n\nThis statement activates INSERT triggers.\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 (451,27,'Concurrent Inserts','The MyISAM storage engine supports concurrent inserts. This feature allows\nSELECT statements to be executed during INSERT operations, reducing contention.\n\nWhether concurrent inserts can be used or not depends on the value of the\nconcurrent_insert server system variable:\n\n* NEVER (0) disables concurrent inserts.\n* AUTO (1) allows concurrent inserts only when the target table has no free\nblocks (no data in the middle of the table has been deleted after the last\nOPTIMIZE TABLE). This is the default.\n* ALWAYS (2) always enables concurrent inserts, in which case new rows are\nadded at the end of a table if the table is being used by another thread.\n\nIf the binary log is used, CREATE TABLE ... SELECT and INSERT ... SELECT\nstatements cannot use concurrent inserts. These statements acquire a read lock\non the table, so concurrent inserts will need to wait. This way the log can be\nsafely used to restore data.\n\nConcurrent inserts are not used by replicas with the row based replication\n(see binary log formats).\n\nIf an INSERT statement contain the HIGH_PRIORITY clause, concurrent inserts\ncannot be used. INSERT ... DELAYED is usually unneeded if concurrent inserts\nare enabled.\n\nLOAD DATA INFILE uses concurrent inserts if the CONCURRENT keyword is\nspecified and concurrent_insert is not NEVER. This makes the statement slower\n(even if no other sessions access the table) but reduces contention.\n\nLOCK TABLES allows non-conflicting concurrent inserts if a READ LOCAL lock is\nused. Concurrent inserts are not allowed if the LOCAL keyword is omitted.\n\nNotes\n-----\n\nThe decision to enable concurrent insert for a table is done when the table is\nopened. If you change the value of concurrent_insert it will only affect new\nopened tables. If you want it to work for also for tables in use or cached,\nyou should do FLUSH TABLES after setting the variable.\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 (452,27,'HIGH_PRIORITY and LOW_PRIORITY','The InnoDB storage engine uses row-level locking to ensure data integrity.\nHowever some storage engines (such as MEMORY, MyISAM, Aria and MERGE) lock the\nwhole table to prevent conflicts. These storage engines use two separate\nqueues to remember pending statements; one is for SELECTs and the other one is\nfor write statements (INSERT, DELETE, UPDATE). By default, the latter has a\nhigher priority.\n\nTo give write operations a lower priority, the low_priority_updates server\nsystem variable can be set to ON. The option is available on both the global\nand session levels, and it can be set at startup or via the SET statement.\n\nWhen too many table locks have been set by write statements, some pending\nSELECTs are executed. The maximum number of write locks that can be acquired\nbefore this happens is determined by the max_write_lock_count server system\nvariable, which is dynamic.\n\nIf write statements have a higher priority (default), the priority of\nindividual write statements (INSERT, REPLACE, UPDATE, DELETE) can be changed\nvia the LOW_PRIORITY attribute, and the priority of a SELECT statement can be\nraised via the HIGH_PRIORITY attribute. Also, LOCK TABLES supports a\nLOW_PRIORITY attribute for WRITE locks.\n\nIf read statements have a higher priority, the priority of an INSERT can be\nchanged via the HIGH_PRIORITY attribute. However, the priority of other write\nstatements cannot be raised individually.\n\nThe use of LOW_PRIORITY or HIGH_PRIORITY for an INSERT prevents Concurrent\nInserts from being used.\n\nURL: https://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 (453,27,'INSERT - Default & Duplicate Values','Default Values\n--------------\n\nIf the SQL_MODE contains STRICT_TRANS_TABLES and you are inserting into a\ntransactional table (like InnoDB), or if the SQL_MODE contains\nSTRICT_ALL_TABLES, all NOT NULL columns which do not have a DEFAULT value (and\nare not AUTO_INCREMENT) must be explicitly referenced in INSERT statements. If\nnot, an error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nIn all other cases, if a NOT NULL column without a DEFAULT value is not\nreferenced, an empty value will be inserted (for example, 0 for INTEGER\ncolumns and \'\' for CHAR columns). See NULL Values in MariaDB:Inserting for\nexamples.\n\nIf a NOT NULL column having a DEFAULT value is not referenced, NULL will be\ninserted.\n\nIf a NULL column having a DEFAULT value is not referenced, its default value\nwill be inserted. It is also possible to explicitly assign the default value\nusing the DEFAULT keyword or the DEFAULT() function.\n\nIf the DEFAULT keyword is used but the column does not have a DEFAULT value,\nan error like this is produced:\n\nERROR 1364 (HY000): Field \'col\' doesn\'t have a default value\n\nDuplicate Values\n----------------\n\nBy default, if you try to insert a duplicate row and there is a UNIQUE index,\nINSERT stops and an error like this is produced:\n\nERROR 1062 (23000): Duplicate entry \'dup_value\' for key \'col\'\n\nTo handle duplicates you can use the IGNORE clause, INSERT ON DUPLICATE KEY\nUPDATE or the REPLACE statement. Note that the IGNORE and DELAYED options are\nignored when you use ON DUPLICATE KEY UPDATE.\n\nURL: https://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 (454,27,'INSERT IGNORE','Ignoring Errors\n---------------\n\nNormally INSERT stops and rolls back when it encounters an error.\n\nBy using the IGNORE keyword all errors are converted to warnings, which will\nnot stop inserts of additional rows.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nPrior to MySQL and MariaDB 5.5.28, no warnings were issued for duplicate key\nerrors when using IGNORE. You can get the old behavior if you set OLD_MODE to\nNO_DUP_KEY_WARNINGS_WITH_IGNORE.\n\nExamples\n--------\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| 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| Level | Code | Message |\n+---------+------+---------------------------------+\n| Warning | 1062 | Duplicate entry \'2\' for key \'x\' |\n+---------+------+---------------------------------+\n\nSELECT * FROM t1;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nSee INSERT ON DUPLICATE KEY UPDATE for further examples using that syntax.\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 (455,27,'INSERT ON DUPLICATE KEY UPDATE','Syntax\n------\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-----------\n\nINSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL extension to the INSERT\nstatement that, if it finds a duplicate unique or primary key, will instead\nperform an UPDATE.\n\nThe row/s affected value is reported as 1 if a row is inserted, and 2 if a row\nis updated, unless the API\'s CLIENT_FOUND_ROWS flag is set.\n\nIf more than one unique index is matched, only the first is updated. It is not\nrecommended to use this statement on tables with more than one unique index.\n\nIf the table has an AUTO_INCREMENT primary key and the statement inserts or\nupdates a row, the LAST_INSERT_ID() function returns its AUTO_INCREMENT value.\n\nThe VALUES() function can only be used in a ON DUPLICATE KEY UPDATE clause and\nhas no meaning in any other context. It returns the column values from the\nINSERT portion of the statement. This function is particularly useful for\nmulti-rows inserts.\n\nThe IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY\nUPDATE.\n\nSee Partition Pruning and Selection for details on the PARTITION clause.\n\nThis statement activates INSERT and UPDATE triggers. See Trigger Overview for\ndetails.\n\nSee also a similar statement, REPLACE.\n\nExamples\n--------\n\nCREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal VARCHAR(30));\nINSERT INTO ins_duplicate VALUES (1,\'Aardvark\'), (2,\'Cheetah\'), (3,\'Zebra\');\n\nIf there is no existing key, the statement runs as a regular INSERT:\n\nINSERT INTO ins_duplicate VALUES (4,\'Gorilla\') \n ON DUPLICATE 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, due to the existing\nkey:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\');\nERROR 1062 (23000): Duplicate entry \'1\' for key \'PRIMARY\'\n\nHowever, we can use an INSERT ON DUPLICATE KEY UPDATE instead:\n\nINSERT INTO ins_duplicate VALUES (1,\'Antelope\') \n ON DUPLICATE KEY UPDATE animal=\'Antelope\';\nQuery OK, 2 rows affected (0.09 sec)\n\nNote that there are two rows reported as affected, but this refers only to the\nUPDATE.\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 is updated. This\ncan be unsafe and is not recommended unless you are certain what you are doing.\n\nINSERT INTO ins_duplicate VALUES (2,\'Lion\',13) \n ON DUPLICATE KEY UPDATE animal=\'Lion\';\nQuery OK, 2 rows affected (0.004 sec)\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, which also matched,\nit was not updated.\n\nChanging id to an auto_increment field. If a new row is added, the\nauto_increment is moved forward. If the row is updated, it remains the same.\n\nALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;\nALTER TABLE ins_duplicate DROP id2;\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (2,\'Leopard\') \n ON DUPLICATE KEY UPDATE animal=\'Leopard\';\nQuery OK, 2 rows affected (0.00 sec)\n\nSELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 5 |\n+----------------+\n\nINSERT INTO ins_duplicate VALUES (5,\'Wild Dog\') \n ON DUPLICATE 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 \n WHERE TABLE_NAME=\'ins_duplicate\';\n+----------------+\n| Auto_increment |\n+----------------+\n| 6 |\n+----------------+\n\nRefering to column values from the INSERT portion of the statement:\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\nURL: https://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 (456,27,'INSERT...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nINSERT ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe inserted rows.\n\nSyntax\n------\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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_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] ... ] [RETURNING select_expr\n [, select_expr ...]]\n\nDescription\n-----------\n\nINSERT ... RETURNING returns a resultset of the inserted rows.\n\nThis returns the listed columns for all the rows that are inserted, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple INSERT statements:\n\nCREATE OR REPLACE TABLE t2 (id INT, animal VARCHAR(20), t TIMESTAMP);\n\nINSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t;\n+------+---------------------+\n| id | t |\n+------+---------------------+\n| 2 | 2021-04-28 00:59:32 |\n| 3 | 2021-04-28 00:59:32 |\n+------+---------------------+\n\nINSERT INTO t2(id,animal) VALUES\n(1,\'Dog\'),(2,\'Lion\'),(3,\'Tiger\'),(4,\'Leopard\') \n RETURNING id,id+id,id&id,id||id;\n+------+-------+-------+--------+\n| id | id+id | id&id | id||id |\n+------+-------+-------+--------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n| 3 | 6 | 3 | 1 |\n| 4 | 8 | 4 | 1 |\n+------+-------+-------+--------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\n\nPREPARE stmt FROM \"INSERT INTO t1 SET id1=1, animal1=\'Bear\' RETURNING f(id1),\nUPPER(animal1)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f(id1) | UPPER(animal1) |\n+---------+----------------+\n| 2 | BEAR |\n+---------+----------------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used.\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values, and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used or it can be used in\nINSERT...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the INSERT table.\n\nURL: https://mariadb.com/kb/en/insertreturning/','','https://mariadb.com/kb/en/insertreturning/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (457,27,'REPLACE...RETURNING','MariaDB starting with 10.5.0\n----------------------------\nREPLACE ... RETURNING was added in MariaDB 10.5.0, and returns a resultset of\nthe replaced rows.\n\nSyntax\n------\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n {VALUES | VALUE} ({expr | DEFAULT},...),(...),...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)]\n SET col={expr | DEFAULT}, ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nOr:\n\nREPLACE [LOW_PRIORITY | DELAYED]\n [INTO] tbl_name [PARTITION (partition_list)] [(col,...)]\n SELECT ...\n[RETURNING select_expr \n [, select_expr ...]]\n\nDescription\n-----------\n\nREPLACE ... RETURNING returns a resultset of the replaced rows.\n\nThis returns the listed columns for all the rows that are replaced, or\nalternatively, the specified SELECT expression. Any SQL expressions which can\nbe calculated can be used in the select expression for the RETURNING clause,\nincluding virtual columns and aliases, expressions which use various operators\nsuch as bitwise, logical and arithmetic operators, string functions, date-time\nfunctions, numeric functions, control flow functions, secondary functions and\nstored functions. Along with this, statements which have subqueries and\nprepared statements can also be used.\n\nExamples\n--------\n\nSimple REPLACE statement\n\nREPLACE INTO t2 VALUES (1,\'Leopard\'),(2,\'Dog\') RETURNING id2, id2+id2 \nas Total ,id2|id2, id2&&id2;\n+-----+-------+---------+----------+\n| id2 | Total | id2|id2 | id2&&id2 |\n+-----+-------+---------+----------+\n| 1 | 2 | 1 | 1 |\n| 2 | 4 | 2 | 1 |\n+-----+-------+---------+----------+\n\nUsing stored functions in RETURNING\n\nDELIMITER |\nCREATE FUNCTION f(arg INT) RETURNS INT\n BEGIN\n RETURN (SELECT arg+arg);\n END|\n\nDELIMITER ;\nPREPARE stmt FROM \"REPLACE INTO t2 SET id2=3, animal2=\'Fox\' RETURNING f2(id2),\nUPPER(animal2)\";\n\nEXECUTE stmt;\n+---------+----------------+\n| f2(id2) | UPPER(animal2) |\n+---------+----------------+\n| 6 | FOX |\n+---------+----------------+\n\nSubqueries in the statement\n\nREPLACE INTO t1 SELECT * FROM t2 RETURNING (SELECT id2 FROM t2 WHERE \nid2 IN (SELECT id2 FROM t2 WHERE id2=1)) AS new_id;\n+--------+\n| new_id |\n+--------+\n| 1 |\n| 1 |\n| 1 |\n| 1 |\n+--------+\n\nSubqueries in the RETURNING clause that return more than one row or column\ncannot be used..\n\nAggregate functions cannot be used in the RETURNING clause. Since aggregate\nfunctions work on a set of values and if the purpose is to get the row count,\nROW_COUNT() with SELECT can be used, or it can be used in\nREPLACE...SELECT...RETURNING if the table in the RETURNING clause is not the\nsame as the REPLACE table.\n\nURL: https://mariadb.com/kb/en/replacereturning/','','https://mariadb.com/kb/en/replacereturning/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (458,27,'CALL','Syntax\n------\n\nCALL sp_name([parameter[,...]])\nCALL sp_name[()]\n\nDescription\n-----------\n\nThe CALL statement invokes a stored procedure that was defined previously with\nCREATE PROCEDURE.\n\nStored procedure names can be specified as database_name.procedure_name.\nProcedure names and database names can be quoted with backticks (). This is\nnecessary if they are reserved words, or contain special characters. See\nidentifier qualifiers for details.\n\nCALL p() and CALL p are equivalent.\n\nIf parentheses are used, any number of spaces, tab characters and newline\ncharacters are allowed between the procedure\'s name and the open parenthesis.\n\nCALL can pass back values to its caller using parameters that are declared as\nOUT or INOUT parameters. If no value is assigned to an OUT parameter, NULL is\nassigned (and its former value is lost). To pass such values from another\nstored program you can use user-defined variables, local variables or\nroutine\'s parameters; in other contexts, you can only use user-defined\nvariables.\n\nCALL can also be executed as a prepared statement. Placeholders can be used\nfor IN parameters in all versions of MariaDB; for OUT and INOUT parameters,\nplaceholders can be used since MariaDB 5.5.\n\nWhen the procedure returns, a client program can also obtain the number of\nrows affected for the final statement executed within the routine: At the SQL\nlevel, call the ROW_COUNT() function; from the C API, call the\nmysql_affected_rows() function.\n\nIf the CLIENT_MULTI_RESULTS API flag is set, CALL can return any number of\nresultsets and the called stored procedure can execute prepared statements. If\nit is not set, at most one resultset can be returned and prepared statements\ncannot be used within procedures.\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 (459,27,'DO','Syntax\n------\n\nDO expr [, expr] ...\n\nDescription\n-----------\n\nDO executes the expressions but does not return any results. In most respects,\nDO is shorthand for SELECT expr, ..., but has the advantage that it is\nslightly faster when you do not care about the result.\n\nDO is useful primarily with functions that have side effects, such as\nRELEASE_LOCK().\n\nURL: https://mariadb.com/kb/en/do/','','https://mariadb.com/kb/en/do/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (460,27,'Comment Syntax','There are three supported comment styles in MariaDB:\n\n* From a \'#\' to the end of a line:SELECT * FROM users; # This is a comment\n\n* From a \'-- \' to the end of a line. The space after the two dashes is\nrequired (as in MySQL).SELECT * FROM users; -- This is a comment\n\n* C style comments from an opening \'/*\' to a closing \'*/\'. Comments of this\nform can span multiple lines:SELECT * FROM users; /* This is a\nmulti-line\ncomment */\n\nNested comments are possible in some situations, but they are not supported or\nrecommended.\n\nExecutable Comments\n-------------------\n\nAs an aid to portability between different databases, MariaDB supports\nexecutable comments. These special comments allow you to embed SQL code which\nwill not execute when run on other databases, but will execute when run on\nMariaDB.\n\nMariaDB supports both MySQL\'s executable comment format, and a slightly\nmodified version specific to MariaDB. This way, if you have SQL code that\nworks on MySQL and MariaDB, but not other databases, you can wrap it in a\nMySQL executable comment, and if you have code that specifically takes\nadvantage of features only available in MariaDB you can use the MariaDB\nspecific format to hide the code from MySQL.\n\nExecutable Comment Syntax\n-------------------------\n\nMySQL and MariaDB executable comment syntax:\n\n/*! MySQL or MariaDB-specific code */\n\nCode that should be executed only starting from a specific MySQL or MariaDB\nversion:\n\n/*!##### MySQL or MariaDB-specific code */\n\nThe numbers, represented by \'######\' in the syntax examples above specify the\nspecific the minimum versions of MySQL and MariaDB that should execute the\ncomment. The first number is the major version, the second 2 numbers are the\nminor version and the last 2 is the patch level.\n\nFor example, if you want to embed some code that should only execute on MySQL\nor MariaDB starting from 5.1.0, you would do the following:\n\n/*!50100 MySQL and MariaDB 5.1.0 (and above) code goes here. */\n\nMariaDB-only executable comment syntax (starting from MariaDB 5.3.1):\n\n/*M! MariaDB-specific code */\n/*M!###### MariaDB-specific code */\n\nMariaDB ignores MySQL-style executable comments that have a version number in\nthe range 50700..99999. This is needed to skip features introduced in\nMySQL-5.7 that are not ported to MariaDB 10.x yet.\n\n/*!50701 MariaDB-10.x ignores MySQL-5.7 specific code */\n\nNote: comments which have a version number in the range 50700..99999 that use\nMariaDB-style executable comment syntax are still executed.\n\n/*M!50701 MariaDB-10.x does not ignore this */\n\nStatement delimiters cannot be used within executable comments.\n\nExamples\n--------\n\nIn MySQL all the following will return 2: In MariaDB, the last 2 queries would\nreturn 3.\n\nSELECT 2 /* +1 */;\nSELECT 1 /*! +1 */;\nSELECT 1 /*!50101 +1 */;\nSELECT 2 /*M! +1 */;\nSELECT 2 /*M!50301 +1 */;\n\nThe following executable statement will not work due to the delimiter inside\nthe executable portion:\n\n/*M!100100 select 1 ; */\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat corresponds to your MariaDB server version for the right syntax to use\nnear \'\' at line 1\n\nInstead, the delimiter should be placed outside the executable portion:\n\n/*M!100100 select 1 */;\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n\nURL: https://mariadb.com/kb/en/comment-syntax/','','https://mariadb.com/kb/en/comment-syntax/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (461,27,'HANDLER Commands','Syntax\n------\n\nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE\n\nDescription\n-----------\n\nThe HANDLER statement provides direct access to table storage engine\ninterfaces for key lookups and key or table scans. It is available for at\nleast Aria, Memory, MyISAM and InnoDB tables (and should work with most\n\'normal\' storage engines, but not with system tables, MERGE or views).\n\nHANDLER ... OPEN opens a table, allowing it to be accessible to subsequent\nHANDLER ... READ statements. The table can either be opened using an alias\n(which must then be used by HANDLER ... READ, or a table name.\n\nThe table object is only closed when HANDLER ... CLOSE is called by the\nsession, and is not shared by other sessions.\n\nPrepared statements work with HANDLER READ, which gives a much higher\nperformance (50% speedup) as there is no parsing and all data is transformed\nin binary (without conversions to text, as with the normal protocol).\n\nThe HANDLER command does not work with partitioned tables.\n\nKey Lookup\n----------\n\nA key lookup is started with:\n\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value,value) [LIMIT...]\n\nThe values stands for the value of each of the key columns. For most key types\n(except for HASH keys in MEMORY storage engine) you can use a prefix subset of\nit\'s columns.\n\nIf you are using LIMIT, then in case of >= or > then there is an implicit NEXT\nimplied, while if you are using <= or < then there is an implicit PREV implied.\n\nAfter the initial read, you can use\n\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\nor\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nto scan the rows in key order.\n\nNote that the row order is not defined for keys with duplicated values and\nwill vary from engine to engine.\n\nKey Scans\n---------\n\nYou can scan a table in key order by doing:\n\nHANDLER tbl_name READ index_name FIRST [ LIMIT ... ]\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\n\nor, if the handler supports backwards key scans (most do):\n\nHANDLER tbl_name READ index_name LAST [ LIMIT ... ]\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n\nTable Scans\n-----------\n\nYou can scan a table in row order by doing:\n\nHANDLER tbl_name READ FIRST [ LIMIT ... ]\nHANDLER tbl_name READ NEXT [ LIMIT ... ]\n\nLimitations\n-----------\n\nAs this is a direct interface to the storage engine, some limitations may\napply for what you can do and what happens if the table changes. Here follows\nsome of the common limitations:\n\nFinding \'Old Rows\'\n------------------\n\nHANDLER READ is not transaction safe, consistent or atomic. It\'s ok for the\nstorage engine to returns rows that existed when you started the scan but that\nwere later deleted. This can happen as the storage engine may cache rows as\npart of the scan from a previous read.\n\nYou may also find rows committed since the scan originally started.\n\nInvisible Columns\n-----------------\n\nHANDLER ... READ also reads the data of invisible-columns.\n\nSystem-Versioned Tables\n-----------------------\n\nHANDLER ... READ reads everything from system-versioned tables, and so\nincludes row_start and row_end fields, as well as all rows that have since\nbeen deleted or changed, including when history partitions are used.\n\nOther Limitations\n-----------------\n\n* If you do an ALTER TABLE, all your HANDLERs for that table are automatically\nclosed.\n* If you do an ALTER TABLE for a table that is used by some other connection\nwith HANDLER, the ALTER TABLE will wait for the HANDLER to be closed.\n* For HASH keys, you must use all key parts when searching for a row.\n* For HASH keys, you can\'t do a key scan of all values. You can only find all\nrows with the same key value.\n* While each HANDLER READ command is atomic, if you do a scan in many steps,\nthen some engines may give you error 1020 if the table changed between the\ncommands. Please refer to the specific engine handler page if this happens.\n\nError Codes\n-----------\n\n* Error 1031 (ER_ILLEGAL_HA) Table storage engine for \'t1\' doesn\'t have this\noption\nIf you get this for HANDLER OPEN it means the storage engine doesn\'t support\nHANDLER calls.\nIf you get this for HANDLER READ it means you are trying to use an incomplete\nHASH key.\n\n* Error 1020 (ER_CHECKREAD) Record has changed since last read in table \'...\'\nThis means that the table changed between two reads and the handler can\'t\nhandle this case for the given scan.\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 (462,27,'HANDLER for MEMORY Tables','This article explains how to use HANDLER commands efficiently with MEMORY/HEAP\ntables.\n\nIf you want to scan a table for over different key values, not just search for\nexact key values, you should create your keys with \'USING BTREE\':\n\nCREATE TABLE t1 (a INT, b INT, KEY(a), KEY b USING BTREE (b)) engine=memory;\n\nIn the above table, a is a HASH key that only supports exact matches (=) while\nb is a BTREE key that you can use to scan the table in key order, starting\nfrom start or from a given key value.\n\nThe limitations for HANDLER READ with Memory|HEAP tables are:\n\nLimitations for HASH keys\n-------------------------\n\n* You must use all key parts when searching for a row.\n* You can\'t do a key scan of all values. You can only find all rows with the\nsame key value.\n* READ NEXT gives error 1031 if the tables changed since last read.\n\nLimitations for BTREE keys\n--------------------------\n\n* READ NEXT gives error 1031 if the tables changed since last read. This\nlimitation can be lifted in the future.\n\nLimitations for table scans\n---------------------------\n\n* READ NEXT gives error 1031 if the table was truncated since last READ call.\n\nURL: https://mariadb.com/kb/en/handler-for-memory-tables/','','https://mariadb.com/kb/en/handler-for-memory-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,27,'Useful MariaDB Queries','This page is intended to be a quick reference of commonly-used and/or useful\nqueries in MariaDB.\n\nCreating a Table\n----------------\n\nCREATE TABLE t1 ( a INT );\nCREATE TABLE t2 ( b INT );\nCREATE TABLE student_tests (\n name CHAR(10), test CHAR(10), \n score TINYINT, test_date DATE\n);\n\nSee CREATE TABLE for more.\n\nInserting Records\n-----------------\n\nINSERT INTO t1 VALUES (1), (2), (3);\nINSERT INTO t2 VALUES (2), (4);\n\nINSERT INTO student_tests \n (name, test, score, test_date) VALUES\n (\'Chun\', \'SQL\', 75, \'2012-11-05\'), \n (\'Chun\', \'Tuning\', 73, \'2013-06-14\'),\n (\'Esben\', \'SQL\', 43, \'2014-02-11\'), \n (\'Esben\', \'Tuning\', 31, \'2014-02-09\'), \n (\'Kaolin\', \'SQL\', 56, \'2014-01-01\'),\n (\'Kaolin\', \'Tuning\', 88, \'2013-12-29\'), \n (\'Tatiana\', \'SQL\', 87, \'2012-04-28\'), \n (\'Tatiana\', \'Tuning\', 83, \'2013-09-30\');\n\nSee INSERT for more.\n\nUsing AUTO_INCREMENT\n--------------------\n\nThe AUTO_INCREMENT attribute is used to automatically generate a unique\nidentity for new rows.\n\nCREATE TABLE student_details (\n id INT NOT NULL AUTO_INCREMENT, name CHAR(10), \n date_of_birth DATE, PRIMARY KEY (id)\n);\n\nWhen inserting, the id field can be omitted, and is automatically created.\n\nINSERT INTO student_details (name,date_of_birth) VALUES \n (\'Chun\', \'1993-12-31\'), \n (\'Esben\',\'1946-01-01\'),\n (\'Kaolin\',\'1996-07-16\'),\n (\'Tatiana\', \'1988-04-13\');\n\nSELECT * FROM student_details;\n+----+---------+---------------+\n| id | name | date_of_birth |\n+----+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+----+---------+---------------+\n\nSee AUTO_INCREMENT for more.\n\nQuerying from two tables on a common value\n------------------------------------------\n\nSELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.b;\n\nThis kind of query is called a join - see JOINS for more.\n\nFinding the Maximum Value\n-------------------------\n\nSELECT MAX(a) FROM t1;\n+--------+\n| MAX(a) |\n+--------+\n| 3 |\n+--------+\n\nSee the MAX() function for more, as well as Finding the maximum value and\ngrouping the results below for a more practical example.\n\nFinding the Minimum Value\n-------------------------\n\nSELECT MIN(a) FROM t1;\n+--------+\n| MIN(a) |\n+--------+\n| 1 |\n+--------+\n\nSee the MIN() function for more.\n\nFinding the Average Value\n-------------------------\n\nSELECT AVG(a) FROM t1;\n+--------+\n| AVG(a) |\n+--------+\n| 2.0000 |\n+--------+\n\nSee the AVG() function for more.\n\nFinding the Maximum Value and Grouping the Results\n--------------------------------------------------\n\nSELECT name, MAX(score) FROM student_tests GROUP BY name;\n+---------+------------+\n| name | MAX(score) |\n+---------+------------+\n| Chun | 75 |\n| Esben | 43 |\n| Kaolin | 88 |\n| Tatiana | 87 |\n+---------+------------+\n\nSee the MAX() function for more.\n\nOrdering Results\n----------------\n\nSELECT name, test, score FROM student_tests ORDER BY score DESC;\n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n| Tatiana | Tuning | 83 |\n| Chun | SQL | 75 |\n| Chun | Tuning | 73 |\n| Kaolin | SQL | 56 |\n| Esben | SQL | 43 |\n| Esben | Tuning | 31 |\n+---------+--------+-------+\n\nSee ORDER BY for more.\n\nFinding the Row with the Minimum of a Particular Column\n-------------------------------------------------------\n\nIn this example, we want to find the lowest test score for any student.\n\nSELECT name,test, score FROM student_tests WHERE score=(SELECT MIN(score) FROM\nstudent);\n+-------+--------+-------+\n| name | test | score |\n+-------+--------+-------+\n| Esben | Tuning | 31 |\n+-------+--------+-------+\n\nFinding Rows with the Maximum Value of a Column by Group\n--------------------------------------------------------\n\nThis example returns the best test results of each student:\n\nSELECT name, test, score FROM student_tests st1 WHERE score = (\n SELECT MAX(score) FROM student st2 WHERE st1.name = st2.name\n); \n+---------+--------+-------+\n| name | test | score |\n+---------+--------+-------+\n| Chun | SQL | 75 |\n| Esben | SQL | 43 |\n| Kaolin | Tuning | 88 |\n| Tatiana | SQL | 87 |\n+---------+--------+-------+\n\nCalculating Age\n---------------\n\nThe TIMESTAMPDIFF function can be used to calculate someone\'s age:\n\nSELECT CURDATE() AS today;\n+------------+\n| today |\n+------------+\n| 2014-02-17 |\n+------------+\n\nSELECT name, date_of_birth, TIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS\nage \n FROM student_details;\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\nSee TIMESTAMPDIFF() for more.\n\nUsing User-defined Variables\n----------------------------\n\nThis example sets a user-defined variable with the average test score, and\nthen uses it in a later query to return all results above the average.\n\nSELECT @avg_score:= AVG(score) FROM student_tests;\n+-------------------------+\n| @avg_score:= AVG(score) |\n+-------------------------+\n| 67.000000000 |\n+-------------------------+\n\nSELECT * FROM student_tests WHERE score > @avg_score;\n+---------+--------+-------+------------+\n| name | test | score | test_date |\n+---------+--------+-------+------------+\n| Chun | SQL | 75 | 2012-11-05 |\n| Chun | Tuning | 73 | 2013-06-14 |\n| Kaolin | Tuning | 88 | 2013-12-29 |\n| Tatiana | SQL | 87 | 2012-04-28 |\n| Tatiana | Tuning | 83 | 2013-09-30 |\n+---------+--------+-------+------------+\n\nUser-defined variables can also be used to add an incremental counter to a\nresultset:\n\nSET @count = 0;\n\nSELECT @count := @count + 1 AS counter, name, date_of_birth FROM\nstudent_details;\n+---------+---------+---------------+\n| counter | name | date_of_birth |\n+---------+---------+---------------+\n| 1 | Chun | 1993-12-31 |\n| 2 | Esben | 1946-01-01 |\n| 3 | Kaolin | 1996-07-16 |\n| 4 | Tatiana | 1988-04-13 |\n+---------+---------+---------------+\n\nSee User-defined Variables for more.\n\nView Tables in Order of Size\n----------------------------\n\nReturns a list of all tables in the database, ordered by size:\n\nSELECT table_schema as `DB`, table_name AS `Table`, \n ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`\n FROM information_schema.TABLES\n ORDER BY (data_length + index_length) DESC;\n\n+--------------------+---------------------------------------+-----------+\n| DB | Table | Size (MB) |\n+--------------------+---------------------------------------+-----------+\n| wordpress | wp_simple_history_contexts | 7.05 |\n| wordpress | wp_posts | 6.59 |\n| wordpress | wp_simple_history | 3.05 |\n| wordpress | wp_comments | 2.73 |\n| wordpress | wp_commentmeta | 2.47 |\n| wordpress | wp_simple_login_log | 2.03 |\n...\n\nRemoving Duplicates\n-------------------\n\nMariaDB starting with 10.3\n--------------------------\nThe following syntax is only valid MariaDB 10.3 and beyond:\n\nThis example assumes there\'s a unique ID, but that all other fields are\nidentical. In the example below, there are 4 records, 3 of which are\nduplicates, so two of the three duplicates need to be removed. The\nintermediate SELECT is not necessary, but demonstrates what is being returned.\n\nCREATE TABLE t (id INT, f1 VARCHAR(2));\n\nINSERT INTO t VALUES (1,\'a\'), (2,\'a\'), (3,\'b\'), (4,\'a\');\n\nSELECT * FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n);\n+------+------+------+------+\n| id | f1 | id | f1 |\n+------+------+------+------+\n| 4 | a | 1 | a |\n| 4 | a | 2 | a |\n+------+------+------+------+\n\nDELETE FROM t WHERE id IN (\n SELECT t2.id FROM t t1, t t2 WHERE t1.f1=t2.f1 AND t1.id<>t2.id AND t1.id=(\n SELECT MAX(id) FROM t tab WHERE tab.f1=t1.f1\n )\n);\nQuery OK, 2 rows affected (0.120 sec)\n\nSELECT * FROM t;\n+------+------+\n| id | f1 |\n+------+------+\n| 3 | b |\n| 4 | a |\n+------+------\n\nURL: https://mariadb.com/kb/en/useful-mariadb-queries/','','https://mariadb.com/kb/en/useful-mariadb-queries/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,28,'ANALYZE FORMAT=JSON','ANALYZE FORMAT=JSON is a mix of the EXPLAIN FORMAT=JSON and ANALYZE statement\nfeatures. The ANALYZE FORMAT=JSON $statement will execute $statement, and then\nprint the output of EXPLAIN FORMAT=JSON, amended with data from the query\nexecution.\n\nBasic Execution Data\n--------------------\n\nYou can get the following also from tabular ANALYZE statement form:\n\n* r_rows is provided for any node that reads rows. It shows how many rows\nwere read, on average \n* r_filtered is provided whenever there is a condition that is checked. It\nshows the percentage of rows left after checking the condition.\n\nAdvanced Execution Data\n-----------------------\n\nThe most important data not available in the regular tabula ANALYZE statement\nare:\n\n* r_loops field. This shows how many times the node was executed. Most query\nplan elements have this field.\n* r_total_time_ms field. It shows how much time in total was spent executing\nthis node. If the node has subnodes, their execution time is included.\n* r_buffer_size field. Query plan nodes that make use of buffers report the\nsize of buffer that was was used.\n\nSHOW ANALYZE FORMAT=JSON\n------------------------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW ANALYZE FORMAT=JSON for <connection_id> extends ANALYZE [FORMAT=JSON]\n<select> to allow one to analyze a query currently running in another\nconnection.\n\nData About Individual Query Plan Nodes\n--------------------------------------\n\n* filesort node reports whether sorting was done with LIMIT n parameter, and\nhow many rows were in the sort result. \n* block-nl-join node has r_loops field, which allows to tell whether Using\njoin buffer was efficient \n* range-checked-for-each-record reports counters that show the result of the\ncheck. \n* expression-cache is used for subqueries, and it reports how many times the\ncache was used, and what cache hit ratio was.\n* union_result node has r_rows so one can see how many rows were produced\nafter UNION operation\n* and so forth\n\nUse Cases\n---------\n\nSee Examples of ANALYZE FORMAT=JSON.\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 (465,28,'ANALYZE FORMAT=JSON Examples','Example #1\n----------\n\nCustomers who have ordered more than 1M goods.\n\nANALYZE FORMAT=JSON\nSELECT COUNT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE o_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) > <cache>((1000 * 1000)))\",\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, which was executed\n150K times (for every row of outer table).\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 (466,28,'ANALYZE Statement','Description\n-----------\n\nThe ANALYZE statement is similar to the EXPLAIN statement. ANALYZE statement\nwill invoke the optimizer, execute the statement, and then produce EXPLAIN\noutput instead of the result set. The EXPLAIN output will be annotated with\nstatistics from statement execution.\n\nThis lets one check how close the optimizer\'s estimates about the query plan\nare to the reality. ANALYZE produces an overview, while the ANALYZE\nFORMAT=JSON command provides a more detailed view of the query plan and the\nquery execution.\n\nThe syntax is\n\nANALYZE explainable_statement;\n\nwhere the statement is any statement for which one can run EXPLAIN.\n\nCommand Output\n--------------\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 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:\n\n* r_rows is an observation-based counterpart of the rows column. It shows how\nmany rows were actually read from the table. \n* r_filtered is an observation-based counterpart of the filtered column. It\nshows which fraction of rows was left after applying the WHERE condition.\n\nInterpreting the Output\n-----------------------\n\nJoins\n-----\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 < 0 AND\n orders.o_totalprice > 200*1000\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\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 |\ncustomer.c_custkey | 7 | 10 | 100.00 | 30.03 | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that\n\n* For table customer, customer.rows=149095, customer.r_rows=150000. The\nestimate for number of rows we will read was fairly precise\n* customer.filtered=18.08, customer.r_filtered=9.13. The optimizer somewhat\noverestimated the number of records that will match selectivity of condition\nattached to `customer` table (in general, when you have a full scan and\nr_filtered is less than 15%, it\'s time to consider adding an appropriate\nindex).\n* For table orders, orders.rows=7, orders.r_rows=10. This means that on\naverage, there are 7 orders for a given c_custkey, but in our case there were\n10, which is close to the expectation (when this number is consistently far\nfrom the expectation, it may be time to run ANALYZE TABLE, or even edit the\ntable statistics manually to get better query plans).\n* orders.filtered=100, orders.r_filtered=30.03. The optimizer didn\'t have any\nway to estimate which fraction of records will be left after it checks the\ncondition that is attached to table orders (it\'s orders.o_totalprice >\n200*1000). So, it used 100%. In reality, it is 30%. 30% is typically not\nselective enough to warrant adding new indexes. For joins with many tables, it\nmight be worth to collect and use column statistics for columns in question,\nthis may help the optimizer to pick a better query plan.\n\nMeaning of NULL in r_rows and r_filtered\n----------------------------------------\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 < -0 AND\n customer.c_comment LIKE \'%foo%\' AND\n orders.o_totalprice > 200*1000;\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\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 |\ncustomer.c_custkey | 7 | NULL | 100.00 | NULL | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that orders.r_rows=NULL and orders.r_filtered=NULL. This\nmeans that table orders was not scanned even once. Indeed, we can also see\ncustomer.r_filtered=0.00. This shows that a part of WHERE attached to table\n`customer` was never satisfied (or, satisfied in less than 0.01% of cases).\n\nANALYZE FORMAT=JSON\n-------------------\n\nANALYZE FORMAT=JSON produces JSON output. It produces much more information\nthan tabular ANALYZE.\n\nNotes\n-----\n\n* ANALYZE UPDATE or ANALYZE DELETE will actually make updates/deletes (ANALYZE\nSELECT will perform the select operation and then discard the resultset).\n* PostgreSQL has a similar command, EXPLAIN ANALYZE.\n* The EXPLAIN in the slow query log feature allows MariaDB to have ANALYZE\noutput of slow queries printed into the slow query log (see MDEV-6388).\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 (467,28,'EXPLAIN','Syntax\n------\n\nEXPLAIN tbl_name [col_name | wild]\n\nOr\n\nEXPLAIN [EXTENDED | PARTITIONS | FORMAT=JSON] \n {SELECT select_options | UPDATE update_options | DELETE delete_options}\n\nDescription\n-----------\n\nThe EXPLAIN statement can be used either as a synonym for DESCRIBE or as a way\nto obtain information about how MariaDB executes a SELECT, UPDATE or DELETE\nstatement:\n\n* \'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or\n \'SHOW COLUMNS FROM tbl_name\'.\n* When you precede a SELECT, UPDATE or a DELETE statement with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains how it would\n process the SELECT, UPDATE or DELETE, including information about how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\n* EXPLAIN PARTITIONS is useful only when examining queries involving\npartitioned tables. For details, see Partition pruning and selection.\n* ANALYZE statement performs the query as well as producing EXPLAIN output,\nand provides actual as well as estimated statistics.\n* EXPLAIN output can be printed in the slow query log. See EXPLAIN in the Slow\nQuery Log for details.\n\nSHOW EXPLAIN shows the output of a running statement. In some cases, its\noutput can be closer to reality than EXPLAIN.\n\nThe ANALYZE statement runs a statement and returns information about its\nexecution plan. It also shows additional columns, to check how much the\noptimizer\'s estimation about filtering and found rows are close to reality.\n\nThere is an online EXPLAIN Analyzer that you can use to share EXPLAIN and\nEXPLAIN EXTENDED output with others.\n\nEXPLAIN can acquire metadata locks in the same way that SELECT does, as it\nneeds to know table metadata and, sometimes, data as well.\n\nColumns in EXPLAIN ... SELECT\n-----------------------------\n\n+--------------------------------------+--------------------------------------+\n| Column name | Description |\n+--------------------------------------+--------------------------------------+\n| id | Sequence number that shows in which |\n| | order tables are joined. |\n+--------------------------------------+--------------------------------------+\n| select_type | What kind of SELECT the table comes |\n| | from. |\n+--------------------------------------+--------------------------------------+\n| table | Alias name of table. Materialized |\n| | temporary tables for sub queries |\n| | are named <subquery#> |\n+--------------------------------------+--------------------------------------+\n| type | How rows are found from the table |\n| | (join type). |\n+--------------------------------------+--------------------------------------+\n| possible_keys | keys in table that could be used to |\n| | find rows in the table |\n+--------------------------------------+--------------------------------------+\n| key | The name of the key that is used to |\n| | retrieve rows. NULL is no key was |\n| | used. |\n+--------------------------------------+--------------------------------------+\n| key_len | How many bytes of the key that was |\n| | used (shows if we are using only |\n| | parts of the multi-column key). |\n+--------------------------------------+--------------------------------------+\n| ref | The reference that is used as the |\n| | key value. |\n+--------------------------------------+--------------------------------------+\n| rows | An estimate of how many rows we |\n| | will find in the table for each key |\n| | lookup. |\n+--------------------------------------+--------------------------------------+\n| Extra | Extra information about this join. |\n+--------------------------------------+--------------------------------------+\n\nHere are descriptions of the values for some of the more complex columns in\nEXPLAIN ... SELECT:\n\n\"Select_type\" Column\n--------------------\n\nThe select_type column can have the following values:\n\n+-----------------+-----------------------------------+-----------------------+\n| Value | Description | Comment |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT | The SUBQUERY is DEPENDENT. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT UNION | The UNION is DEPENDENT. | |\n+-----------------+-----------------------------------+-----------------------+\n| DERIVED | The SELECT is DERIVED from the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| MATERIALIZED | The SUBQUERY is MATERIALIZED. | Materialized tables |\n| | | will be populated at |\n| | | first access and |\n| | | will be accessed by |\n| | | the primary key (= |\n| | | one key lookup). |\n| | | Number of rows in |\n| | | EXPLAIN shows the |\n| | | cost of populating |\n| | | the table |\n+-----------------+-----------------------------------+-----------------------+\n| PRIMARY | The SELECT is in the outermost | |\n| | query, but there is also a | |\n| | SUBQUERY within it. | |\n+-----------------+-----------------------------------+-----------------------+\n| SIMPLE | It is a simple SELECT query | |\n| | without any SUBQUERY or UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| SUBQUERY | The SELECT is a SUBQUERY of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The SUBQUERY is UNCACHEABLE. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The UNION is UNCACHEABLE. | |\n| UNION | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION | The SELECT is a UNION of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION RESULT | The result of the UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| LATERAL DERIVED | The SELECT uses a Lateral | |\n| | Derived optimization | |\n+-----------------+-----------------------------------+-----------------------+\n\n\"Type\" Column\n-------------\n\nThis column contains information on how the table is accessed.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| ALL | A full table scan is done for the table (all |\n| | rows are read). This is bad if the table is |\n| | large and the table is joined against a previous |\n| | table! This happens when the optimizer could |\n| | not find any usable index to access rows. |\n+------------------------+---------------------------------------------------+\n| const | There is only one possibly matching row in the |\n| | table. The row is read before the optimization |\n| | phase and all columns in the table are treated |\n| | as constants. |\n+------------------------+---------------------------------------------------+\n| eq_ref | A unique index is used to find the rows. This is |\n| | the best possible plan to find the row. |\n+------------------------+---------------------------------------------------+\n| fulltext | A fulltext index is used to access the rows. |\n+------------------------+---------------------------------------------------+\n| index_merge | A \'range\' access is done for for several index |\n| | and the found rows are merged. The key column |\n| | shows which keys are used. |\n+------------------------+---------------------------------------------------+\n| index_subquery | This is similar as ref, but used for sub queries |\n| | that are transformed to key lookups. |\n+------------------------+---------------------------------------------------+\n| index | A full scan over the used index. Better than |\n| | ALL but still bad if index is large and the |\n| | table is joined against a previous table. |\n+------------------------+---------------------------------------------------+\n| range | The table will be accessed with a key over one |\n| | or more value ranges. |\n+------------------------+---------------------------------------------------+\n| ref_or_null | Like \'ref\' but in addition another search for |\n| | the \'null\' value is done if the first value was |\n| | not found. This happens usually with sub queries. |\n+------------------------+---------------------------------------------------+\n| ref | A non unique index or prefix of an unique index |\n| | is used to find the rows. Good if the prefix |\n| | doesn\'t match many rows. |\n+------------------------+---------------------------------------------------+\n| system | The table has 0 or 1 rows. |\n+------------------------+---------------------------------------------------+\n| unique_subquery | This is similar as eq_ref, but used for sub |\n| | queries that are transformed to key lookups |\n+------------------------+---------------------------------------------------+\n\n\"Extra\" Column\n--------------\n\nThis column consists of one or more of the following values, separated by \';\'\n\nNote that some of these values are detected after the optimization phase.\n\nThe optimization phase can do the following changes to the WHERE clause:\n\n* Add the expressions from the ON and USING clauses to the WHERE\n clause.\n* Constant propagation: If there is column=constant, replace all column\n instances with this constant.\n* Replace all columns from \'const\' tables with their values.\n* Remove the used key columns from the WHERE (as this will be tested as\n part of the key lookup).\n* Remove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\n* Replace columns with other columns that has identical values:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\n* Add extra conditions to detect impossible row conditions earlier. This\n happens mainly with OUTER JOIN where we in some cases add detection\n of NULL values in the WHERE (Part of \'Not exists\' optimization).\n This can cause an unexpected \'Using where\' in the Extra column.\n* For each table level we remove expressions that have already been tested when\n we read the previous row. Example: When joining tables t1 with t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we don\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know that this\n expression is true.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| const row not found | The table was a system table (a table with |\n| | should exactly one row), but no row was found. |\n+------------------------+---------------------------------------------------+\n| Distinct | If distinct optimization (remove duplicates) was |','','https://mariadb.com/kb/en/explain/');
+update help_topic set description = CONCAT(description, '\n| | used. This is marked only for the last table in |\n| | the SELECT. |\n+------------------------+---------------------------------------------------+\n| Full scan on NULL key | The table is a part of the sub query and if the |\n| | value that is used to match the sub query will |\n| | be NULL, we will do a full table scan. |\n+------------------------+---------------------------------------------------+\n| Impossible HAVING | The used HAVING clause is always false so the |\n| | SELECT will return no rows. |\n+------------------------+---------------------------------------------------+\n| Impossible WHERE | The used WHERE clause is always false so the |\n| noticed after reading | SELECT will return no rows. This case was |\n| const tables. | detected after we had read all \'const\' tables |\n| | and used the column values as constant in the |\n| | WHERE clause. For example: WHERE const_column=5 |\n| | and const_column had a value of 4. |\n+------------------------+---------------------------------------------------+\n| Impossible WHERE | The used WHERE clause is always false so the |\n| | SELECT will return no rows. For example: WHERE |\n| | 1=2 |\n+------------------------+---------------------------------------------------+\n| No matching min/max | During early optimization of MIN()/MAX() values |\n| row | it was detected that no row could match the |\n| | WHERE clause. The MIN()/MAX() function will |\n| | return NULL. |\n+------------------------+---------------------------------------------------+\n| no matching row in | The table was a const table (a table with only |\n| const table | one possible matching row), but no row was found. |\n+------------------------+---------------------------------------------------+\n| No tables used | The SELECT was a sub query that did not use any |\n| | tables. For example a there was no FROM clause |\n| | or a FROM DUAL clause. |\n+------------------------+---------------------------------------------------+\n| Not exists | Stop searching after more row if we find one |\n| | single matching row. This optimization is used |\n| | with LEFT JOIN where one is explicitly searching |\n| | for rows that doesn\'t exists in the LEFT JOIN |\n| | TABLE. Example: SELECT * FROM t1 LEFT JOIN t2 on |\n| | (...) WHERE t2.not_null_column IS NULL. As |\n| | t2.not_null_column can only be NULL if there was |\n| | no matching row for on condition, we can stop |\n| | searching if we find a single matching row. |\n+------------------------+---------------------------------------------------+\n| Open_frm_only | For information_schema tables. Only the frm |\n| | (table definition file was opened) was opened |\n| | for each matching row. |\n+------------------------+---------------------------------------------------+\n| Open_full_table | For information_schema tables. A full table open |\n| | for each matching row is done to retrieve the |\n| | requested information. (Slow) |\n+------------------------+---------------------------------------------------+\n| Open_trigger_only | For information_schema tables. Only the trigger |\n| | file definition was opened for each matching row. |\n+------------------------+---------------------------------------------------+\n| Range checked for | This only happens when there was no good default |\n| each record (index | index to use but there may some index that could |\n| map: ...) | be used when we can treat all columns from |\n| | previous table as constants. For each row |\n| | combination the optimizer will decide which |\n| | index to use (if any) to fetch a row from this |\n| | table. This is not fast, but faster than a full |\n| | table scan that is the only other choice. The |\n| | index map is a bitmask that shows which index |\n| | are considered for each row condition. |\n+------------------------+---------------------------------------------------+\n| Scanned 0/1/all | For information_schema tables. Shows how many |\n| databases | times we had to do a directory scan. |\n+------------------------+---------------------------------------------------+\n| Select tables | All tables in the join was optimized away. This |\n| optimized away | happens when we are only using COUNT(*), MIN() |\n| | and MAX() functions in the SELECT and we where |\n| | able to replace all of these with constants. |\n+------------------------+---------------------------------------------------+\n| Skip_open_table | For information_schema tables. The queried table |\n| | didn\'t need to be opened. |\n+------------------------+---------------------------------------------------+\n| unique row not found | The table was detected to be a const table (a |\n| | table with only one possible matching row) |\n| | during the early optimization phase, but no row |\n| | was found. |\n+------------------------+---------------------------------------------------+\n| Using filesort | Filesort is needed to resolve the query. This |\n| | means an extra phase where we first collect all |\n| | columns to sort, sort them with a disk based |\n| | merge sort and then use the sorted set to |\n| | retrieve the rows in sorted order. If the column |\n| | set is small, we store all the columns in the |\n| | sort file to not have to go to the database to |\n| | retrieve them again. |\n+------------------------+---------------------------------------------------+\n| Using index | Only the index is used to retrieve the needed |\n| | information from the table. There is no need to |\n| | perform an extra seek to retrieve the actual |\n| | record. |\n+------------------------+---------------------------------------------------+\n| Using index condition | Like \'Using where\' but the where condition is |\n| | pushed down to the table engine for internal |\n| | optimization at the index level. |\n+------------------------+---------------------------------------------------+\n| Using index | Like \'Using index condition\' but in addition we |\n| condition(BKA) | use batch key access to retrieve rows. |\n+------------------------+---------------------------------------------------+\n| Using index for | The index is being used to resolve a GROUP BY or |\n| group-by | DISTINCT query. The rows are not read. This is |\n| | very efficient if the table has a lot of |\n| | identical index entries as duplicates are |\n| | quickly jumped over. |\n+------------------------+---------------------------------------------------+\n| Using intersect(...) | For index_merge joins. Shows which index are |\n| | part of the intersect. |\n+------------------------+---------------------------------------------------+\n| Using join buffer | We store previous row combinations in a row |\n| | buffer to be able to match each row against all |\n| | of the rows combinations in the join buffer at |\n| | one go. |\n+------------------------+---------------------------------------------------+\n| Using sort_union(...) | For index_merge joins. Shows which index are |\n| | part of the union. |\n+------------------------+---------------------------------------------------+\n| Using temporary | A temporary table is created to hold the result. |\n| | This typically happens if you are using GROUP |\n| | BY, DISTINCT or ORDER BY. |\n+------------------------+---------------------------------------------------+\n| Using where | A WHERE expression (in additional to the |\n| | possible key lookup) is used to check if the row |\n| | should be accepted. If you don\'t have \'Using |\n| | where\' together with a join type of ALL, you are |\n| | probably doing something wrong! |\n+------------------------+---------------------------------------------------+\n| Using where with | Like \'Using where\' but the where condition is |\n| pushed condition | pushed down to the table engine for internal |\n| | optimization at the row level. |\n+------------------------+---------------------------------------------------+\n| Using buffer | The UPDATE statement will first buffer the rows, |\n| | and then run the updates, rather than do updates |\n| | on the fly. See Using Buffer UPDATE Algorithm |\n| | for a detailed explanation. |\n+------------------------+---------------------------------------------------+\n\nEXPLAIN EXTENDED\n----------------\n\nThe EXTENDED keyword adds another column, filtered, to the output. This is a\npercentage estimate of the table rows that will be filtered by the condition.\n\nAn EXPLAIN EXTENDED will always throw a warning, as it adds extra Message\ninformation to a subsequent SHOW WARNINGS statement. This includes what the\nSELECT query would look like after optimizing and rewriting rules are applied\nand how the optimizer qualifies columns and tables.\n\nExamples\n--------\n\nAs synonym for DESCRIBE or SHOW COLUMNS FROM:\n\nDESCRIBE city;\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 poor 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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example;\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\n------------+\n| Table | Non_unique | Key_name | Seq_in_index | Column_name \n | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |\nIndex_comment |\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\n------------+\n| employees_example | 0 | PRIMARY | 1 | id \n | A | 7 | NULL | NULL | | BTREE | |\n |\n| employees_example | 0 | employee_code | 1 |\nemployee_code | A | 7 | NULL | NULL | | BTREE \n | | |\n| employees_example | 1 | first_name | 1 | first_name \n | A | NULL | NULL | NULL | | BTREE | |\n |') WHERE help_topic_id = 467;
+update help_topic set description = CONCAT(description, '\n| employees_example | 1 | first_name | 2 | last_name \n | A | NULL | NULL | NULL | | BTREE | |\n |\n+-------------------+------------+---------------+--------------+--------------\n+-----------+-------------+----------+--------+------+------------+---------+--\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-----+-------+------+-------+\n| 1 | SIMPLE | employees_example | const | PRIMARY | PRIMARY | 4\n | const | 1 | |\n+------+-------------+-------------------+-------+---------------+---------+---\n-----+-------+------+-------+\n\nThe type is const, which means that only one possible result could be\nreturned. Now, returning the same record but searching by their phone number:\n\nEXPLAIN SELECT * FROM employees_example WHERE home_phone=\'326-555-3492\';\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n| id | select_type | table | type | possible_keys | key |\nkey_len | ref | rows | Extra |\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n| 1 | SIMPLE | employees_example | ALL | NULL | NULL | NULL \n | NULL | 6 | Using where |\n+------+-------------+-------------------+------+---------------+------+-------\n-+------+------+-------------+\n\nHere, the type is All, which means no index could be used. Looking at the rows\ncount, a full table scan (all six rows) had to be performed in order to\nretrieve the record. If it\'s a requirement to search by phone number, an index\nwill have to be created.\n\nSHOW EXPLAIN example:\n\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len | ref |\nrows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL |\n1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nExample of ref_or_null Optimization\n-----------------------------------\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 subqueries with NOT\nIN as then one has to do an extra check for NULL values if the first value\ndidn\'t have a matching row.\n\nURL: https://mariadb.com/kb/en/explain/') WHERE help_topic_id = 467;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,28,'EXPLAIN ANALYZE','The syntax for the EXPLAIN ANALYZE feature was changed to ANALYZE statement,\navailable since MariaDB 10.1.0. See ANALYZE statement.\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 (469,28,'EXPLAIN FORMAT=JSON','Synopsis\n--------\n\nEXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in\nJSON form. The output always has one row which has only one column titled\n\"JSON\". The contents are a JSON representation of the query plan, formatted\nfor readability:\n\nEXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\\G\n\n*************************** 1. row ***************************\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------------------------------\n\nThe output of MariaDB\'s EXPLAIN FORMAT=JSON is different from EXPLAIN\nFORMAT=JSON in MySQL.The reasons for that are:\n\n* MySQL\'s output has deficiencies. Some are listed here: EXPLAIN FORMAT=JSON\nin MySQL\n* The output of MySQL\'s EXPLAIN FORMAT=JSON is not defined. Even MySQL\nWorkbench has trouble parsing it (see this blog post).\n* MariaDB has query optimizations that MySQL does not have. Ergo, MariaDB\ngenerates query plans that MySQL does not generate.\n\nA (as yet incomplete) list of how MariaDB\'s output is different from MySQL can\nbe found here: EXPLAIN FORMAT=JSON differences from MySQL.\n\nOutput Format\n-------------\n\nTODO: MariaDB\'s output format description.\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 (470,28,'DESCRIBE','Syntax\n------\n\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDescription\n-----------\n\nDESCRIBE provides information about the columns in a table. It is a shortcut\nfor SHOW COLUMNS FROM. These statements also display information for views.\n\ncol_name can be a column name, or a string containing the SQL \"%\" and \"_\"\nwildcard characters to obtain output only for the columns with names matching\nthe string. There is no need to enclose the string within quotes unless it\ncontains spaces or other special characters.\n\nDESCRIBE city;\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 more information about the output\ncolumns.\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 (471,29,'Identifier Names','Databases, tables, indexes, columns, aliases, views, stored routines,\ntriggers, events, variables, partitions, tablespaces, savepoints, labels,\nusers, roles, are collectively known as identifiers, and have certain rules\nfor naming.\n\nIdentifiers may be quoted using the backtick character - `. Quoting is\noptional for identifiers that don\'t contain special characters, or for\nidentifiers that are not reserved words. If the ANSI_QUOTES SQL_MODE flag is\nset, double quotes (\") can also be used to quote identifiers. If the MSSQL\nflag is set, square brackets ([ and ]) can be used for quoting.\n\nEven when using reserved words as names, fully qualified names do not need to\nbe quoted. For example, test.select has only one possible meaning, so it is\ncorrectly parsed even without quotes.\n\nUnquoted\n--------\n\nThe following characters are valid, and allow identifiers to be unquoted:\n\n* ASCII: [0-9,a-z,A-Z$_] (numerals 0-9, basic Latin letters, both lowercase\nand uppercase, dollar sign, underscore)\n* Extended: U+0080 .. U+FFFF\n\nQuoted\n------\n\nThe following characters are valid, but identifiers using them must be quoted:\n\n* ASCII: U+0001 .. U+007F (full Unicode Basic Multilingual Plane (BMP) except\nfor U+0000)\n* Extended: U+0080 .. U+FFFF \n* Identifier quotes can themselves be used as part of an identifier, as long\nas they are quoted.\n\nFurther Rules\n-------------\n\nThere are a number of other rules for identifiers:\n\n* Identifiers are stored as Unicode (UTF-8)\n* Identifiers may or may not be case-sensitive. See Indentifier\nCase-sensitivity.\n* Database, table and column names can\'t end with space characters\n* Identifier names may begin with a numeral, but can\'t only contain numerals\nunless quoted.\n* An identifier starting with a numeral, followed by an \'e\', may be parsed as\na floating point number, and needs to be quoted.\n* Identifiers are not permitted to contain the ASCII NUL character (U+0000)\nand supplementary characters (U+10000 and higher).\n* Names such as 5e6, 9e are not prohibited, but it\'s strongly recommended not\nto use them, as they could lead to ambiguity in certain contexts, being\ntreated as a number or expression.\n* User variables cannot be used as part of an identifier, or as an identifier\nin an SQL statement.\n\nQuote Character\n---------------\n\nThe regular quote character is the backtick character - `, but if the\nANSI_QUOTES SQL_MODE option is specified, a regular double quote - \" may be\nused as well.\n\nThe backtick character can be used as part of an identifier. In that case the\nidentifier needs to be quoted. The quote character can be the backtick, but in\nthat case, the backtick in the name must be escaped with another backtick.\n\nMaximum Length\n--------------\n\n* Databases, tables, columns, indexes, constraints, stored routines, triggers,\nevents, views, tablespaces, servers and log file groups have a maximum length\nof 64 characters.\n* Compound statement labels have a maximum length of 16 characters\n* Aliases have a maximum length of 256 characters, except for column aliases\nin CREATE VIEW statements, which are checked against the maximum column length\nof 64 characters (not the maximum alias length of 256 characters).\n* Users have a maximum length of 80 characters.\n* Roles have a maximum length of 128 characters.\n* Multi-byte characters do not count extra towards towards the character limit.\n\nMultiple Identifiers\n--------------------\n\nMariaDB allows the column name to be used on its own if the reference will be\nunambiguous, or the table name to be used with the column name, or all three\nof the database, table and column names. A period is used to separate the\nidentifiers, and the period can be surrounded by spaces.\n\nExamples\n--------\n\nUsing the period to separate identifiers:\n\nCREATE TABLE t1 (i int);\n\nINSERT INTO t1(i) VALUES (10);\n\nSELECT i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT test.t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nThe period can be separated by spaces:\n\nSELECT test . t1 . i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nResolving ambiguity:\n\nCREATE TABLE t2 (i int);\n\nSELECT i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\nERROR 1052 (23000): Column \'i\' in field list is ambiguous\n\nSELECT t1.i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nCreating a table with characters that require quoting:\n\nCREATE TABLE 123% (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'123% (i int)\' at line 1\n\nCREATE TABLE `123%` (i int);\nQuery OK, 0 rows affected (0.85 sec)\n\nCREATE TABLE `TABLE` (i int);\nQuery OK, 0 rows affected (0.36 sec)\n\nUsing double quotes as a quoting character:\n\nCREATE TABLE \"SELECT\" (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'\"SELECT\" (i int)\' at line 1\n\nSET sql_mode=\'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.03 sec)\n\nCREATE TABLE \"SELECT\" (i int);\nQuery OK, 0 rows affected (0.46 sec)\n\nUsing an identifier quote as part of an identifier name:\n\nSHOW VARIABLES LIKE \'sql_mode\';\n+---------------+-------------+\n| Variable_name | Value |\n+---------------+-------------+\n| sql_mode | ANSI_QUOTES |\n+---------------+-------------+\n\nCREATE TABLE \"fg`d\" (i int);\nQuery OK, 0 rows affected (0.34 sec)\n\nCreating the table named * (Unicode number: U+002A) requires quoting.\n\nCREATE TABLE `*` (a INT);\n\nFloating point ambiguity:\n\nCREATE TABLE 8984444cce5d (x INT);\nQuery OK, 0 rows affected (0.38 sec)\n\nCREATE TABLE 8981e56cce5d (x INT);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'8981e56cce5d (x INT)\' at line 1\n\nCREATE TABLE `8981e56cce5d` (x INT);\nQuery OK, 0 rows affected (0.39 sec)\n\nURL: https://mariadb.com/kb/en/identifier-names/','','https://mariadb.com/kb/en/identifier-names/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,29,'Identifier Case-sensitivity','Whether objects are case-sensitive or not is partly determined by the\nunderlying operating system. Unix-based systems are case-sensitive, Windows is\nnot, while Mac OS X is usually case-insensitive by default, but devices can be\nconfigured as case-sensitive using Disk Utility.\n\nDatabase, table, table aliases and trigger names are affected by the systems\ncase-sensitivity, while index, column, column aliases, stored routine and\nevent names are never case sensitive.\n\nLog file group name are case sensitive.\n\nThe lower_case_table_names server system variable plays a key role. It\ndetermines whether table names, aliases and database names are compared in a\ncase-sensitive manner. If set to 0 (the default on Unix-based systems), table\nnames and aliases and database names are compared in a case-sensitive manner.\nIf set to 1 (the default on Windows), names are stored in lowercase and not\ncompared in a case-sensitive manner. If set to 2 (the default on Mac OS X),\nnames are stored as declared, but compared in lowercase.\n\nIt is thus possible to make Unix-based systems behave like Windows and ignore\ncase-sensitivity, but the reverse is not true, as the underlying Windows\nfilesystem can not support this.\n\nEven on case-insensitive systems, you are required to use the same case\nconsistently within the same statement. The following statement fails, as it\nrefers to the table name in a different case.\n\nSELECT * FROM a_table WHERE A_table.id>10;\n\nFor a full list of identifier naming rules, see Identifier Names.\n\nPlease note that lower_case_table_names is a database initialization\nparameter. This means that, along with innodb_page_size, this variable must be\nset before running mysql_install_db, and will not change the behavior of\nservers unless applied before the creation of core system databases.\n\nURL: https://mariadb.com/kb/en/identifier-case-sensitivity/','','https://mariadb.com/kb/en/identifier-case-sensitivity/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,29,'Binary Literals','Binary literals can be written in one of the following formats: b\'value\',\nB\'value\' or 0bvalue, where value is a string composed by 0 and 1 digits.\n\nBinary literals are interpreted as binary strings, and are convenient to\nrepresent VARBINARY, BINARY or BIT values.\n\nTo convert a binary literal into an integer, just add 0.\n\nExamples\n--------\n\nPrinting the value as a binary string:\n\nSELECT 0b1000001;\n+-----------+\n| 0b1000001 |\n+-----------+\n| A |\n+-----------+\n\nConverting the same value into a number:\n\nSELECT 0b1000001+0;\n+-------------+\n| 0b1000001+0 |\n+-------------+\n| 65 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/binary-literals/','','https://mariadb.com/kb/en/binary-literals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,29,'Boolean Literals','In MariaDB, FALSE is a synonym of 0 and TRUE is a synonym of 1. These\nconstants are case insensitive, so TRUE, True, and true are equivalent.\n\nThese terms are not synonyms of 0 and 1 when used with the IS operator. So,\nfor example, 10 IS TRUE returns 1, while 10 = TRUE returns 0 (because 1 != 10).\n\nThe IS operator accepts a third constant exists: UNKNOWN. It is always a\nsynonym of NULL.\n\nTRUE and FALSE are reserved words, while UNKNOWN is not.\n\nURL: https://mariadb.com/kb/en/sql-language-structure-boolean-literals/','','https://mariadb.com/kb/en/sql-language-structure-boolean-literals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,29,'Date and Time Literals','Standard syntaxes\n-----------------\n\nMariaDB supports the SQL standard and ODBC syntaxes for DATE, TIME and\nTIMESTAMP literals.\n\nSQL standard syntax:\n\n* DATE \'string\'\n* TIME \'string\'\n* TIMESTAMP \'string\'\n\nODBC syntax:\n\n* {d \'string\'}\n* {t \'string\'}\n* {ts \'string\'}\n\nThe timestamp literals are treated as DATETIME literals, because in MariaDB\nthe range of DATETIME is closer to the TIMESTAMP range in the SQL standard.\n\nstring is a string in a proper format, as explained below.\n\nDATE literals\n-------------\n\nA DATE string is a string in one of the following formats: \'YYYY-MM-DD\' or\n\'YY-MM-DD\'. Note that any punctuation character can be used as delimiter. All\ndelimiters must consist of 1 character. Different delimiters can be used in\nthe same string. Delimiters are optional (but if one delimiter is used, all\ndelimiters must be used).\n\nA DATE literal can also be an integer, in one of the following formats:\nYYYYMMDD or YYMMDD.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'19940101\'\n\'940101\'\n\'1994-01-01\'\n\'94/01/01\'\n\'1994-01/01\'\n\'94:01!01\'\n19940101\n940101\n\nDATETIME literals\n-----------------\n\nA DATETIME string is a string in one of the following formats: \'YYYY-MM-DD\nHH:MM:SS\' or \'YY-MM-DD HH:MM:SS\'. Note that any punctuation character can be\nused as delimiter for the date part and for the time part. All delimiters must\nconsist of 1 character. Different delimiters can be used in the same string.\nThe hours, minutes and seconds parts can consist of one character. For this\nreason, delimiters are mandatory for DATETIME literals.\n\nThe delimiter between the date part and the time part can be a T or any\nsequence of space characters (including tabs, new lines and carriage returns).\n\nA DATETIME literal can also be a number, in one of the following formats:\nYYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD. In this case, all the time\nsubparts must consist of 2 digits.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'1994-01-01T12:30:03\'\n\'1994/01/01\\n\\t 12+30+03\'\n\'1994/01\\\\01\\n\\t 12+30-03\'\n\'1994-01-01 12:30:3\'\n\nTIME literals\n-------------\n\nA TIME string is a string in one of the following formats: \'D HH:MM:SS\',\n\'HH:MM:SS, \'D HH:MM\', \'HH:MM\', \'D HH\', or \'SS\'. D is a value from 0 to 34\nwhich represents days. : is the only allowed delimiter for TIME literals.\nDelimiters are mandatory, with an exception: the \'HHMMSS\' format is allowed.\nWhen delimiters are used, each part of the literal can consist of one\ncharacter.\n\nA TIME literal can also be a number in one of the following formats: HHMMSS,\nMMSS, or SS.\n\nThe following literals are equivalent:\n\n\'09:05:00\'\n\'9:05:0\'\n\'9:5:0\'\n\'090500\'\n\n2-digit years\n-------------\n\nThe year part in DATE and DATETIME literals is determined as follows:\n\n* 70 - 99 = 1970 - 1999\n* 00 - 69 = 2000 - 2069\n\nMicroseconds\n------------\n\nDATETIME and TIME literals can have an optional microseconds part. For both\nstring and numeric forms, it is expressed as a decimal part. Up to 6 decimal\ndigits are allowed. Examples:\n\n\'12:30:00.123456\'\n123000.123456\n\nSee Microseconds in MariaDB for details.\n\nDate and time literals and the SQL_MODE\n---------------------------------------\n\nUnless the SQL_MODE NO_ZERO_DATE flag is set, some special values are allowed:\nthe \'0000-00-00\' DATE, the \'00:00:00\' TIME, and the 0000-00-00 00:00:00\nDATETIME.\n\nIf the ALLOW_INVALID_DATES flag is set, the invalid dates (for example, 30th\nFebruary) are allowed. If not, if the NO_ZERO_DATE is set, an error is\nproduced; otherwise, a zero-date is returned.\n\nUnless the NO_ZERO_IN_DATE flag is set, each subpart of a date or time value\n(years, hours...) can be set to 0.\n\nURL: https://mariadb.com/kb/en/date-and-time-literals/','','https://mariadb.com/kb/en/date-and-time-literals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,29,'Hexadecimal Literals','Hexadecimal literals can be written using any of the following syntaxes:\n\n* x\'value\'\n* X\'value\' (SQL standard)\n* 0xvalue (ODBC)\n\nvalue is a sequence of hexadecimal digits (from 0 to 9 and from A to F). The\ncase of the digits does not matter. With the first two syntaxes, value must\nconsist of an even number of digits. With the last syntax, digits can be even,\nand they are treated as if they had an extra 0 at the beginning.\n\nNormally, hexadecimal literals are interpreted as binary string, where each\npair of digits represents a character. When used in a numeric context, they\nare interpreted as integers. (See the example below). In no case can a\nhexadecimal literal be a decimal number.\n\nThe first two syntaxes; X\'value\' and x\'value, follow the SQL standard, and\nbehave as a string in all contexts in MariaDB since MariaDB 10.0.3 and MariaDB\n5.5.31 (fixing MDEV-4489). The latter syntax, 0xvalue, is a MySQL/MariaDB\nextension for hex hybrids and behaves as a string or as a number depending on\ncontext. MySQL treats all syntaxes the same, so there may be different results\nin MariaDB and MySQL (see below).\n\nExamples\n--------\n\nRepresenting the a character with the three syntaxes explained above:\n\nSELECT x\'61\', X\'61\', 0x61;\n+-------+-------+------+\n| x\'61\' | X\'61\' | 0x61 |\n+-------+-------+------+\n| a | a | a |\n+-------+-------+------+\n\nHexadecimal literals in a numeric context:\n\nSELECT 0 + 0xF, -0xF;\n+---------+------+\n| 0 + 0xF | -0xF |\n+---------+------+\n| 15 | -15 |\n+---------+------+\n\nFun with Types\n--------------\n\nCREATE TABLE t1 (a INT, b VARCHAR(10));\nINSERT INTO t1 VALUES (0x31, 0x61),(COALESCE(0x31), COALESCE(0x61));\n\nSELECT * FROM t1;\n+------+------+\n| a | b |\n+------+------+\n| 49 | a |\n| 1 | a |\n+------+------+\n\nThe reason for the differing results above is that when 0x31 is inserted\ndirectly to the column, it\'s treated as a number, while when 0x31 is passed to\nCOALESCE(), it\'s treated as a string, because:\n\n* HEX values have a string data type by default.\n* COALESCE() has the same data type as the argument.\n\nDifferences Between MariaDB and MySQL\n-------------------------------------\n\nSELECT x\'0a\'+0;\n+---------+\n| x\'0a\'+0 |\n+---------+\n| 0 |\n+---------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect DOUBLE value: \'\\x0A\'\n\nSELECT X\'0a\'+0;\n+---------+\n| X\'0a\'+0 |\n+---------+\n| 0 |\n+---------+\n1 row in set, 1 warning (0.00 sec)\n\nWarning (Code 1292): Truncated incorrect DOUBLE value: \'\\x0A\'\n\nSELECT 0x0a+0;\n+--------+\n| 0x0a+0 |\n+--------+\n| 10 |\n+--------+\n\nIn MySQL (up until at least MySQL 8.0.26):\n\nSELECT x\'0a\'+0;\n+---------+\n| x\'0a\'+0 |\n+---------+\n| 10 |\n+---------+\n\nSELECT X\'0a\'+0;\n+---------+\n| X\'0a\'+0 |\n+---------+\n| 10 |\n+---------+\n\nSELECT 0x0a+0;\n+--------+\n| 0x0a+0 |\n+--------+\n| 10 |\n+--------+\n\nURL: https://mariadb.com/kb/en/hexadecimal-literals/','','https://mariadb.com/kb/en/hexadecimal-literals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,29,'Identifier Qualifiers','Qualifiers are used within SQL statements to reference data structures, such\nas databases, tables, or columns. For example, typically a SELECT query\ncontains references to some columns and at least one table.\n\nQualifiers can be composed by one or more identifiers, where the initial parts\naffect the context within which the final identifier is interpreted:\n\n* For a database, only the database identifier needs to be specified.\n* For objects which are contained in a database (like tables, views,\nfunctions, etc) the database identifier can be specified. If no database is\nspecified, the current database is assumed (see USE and DATABASE() for more\ndetails). If there is no default database and no database is specified, an\nerror is issued.\n* For column names, the table and the database are generally obvious from the\ncontext of the statement. It is however possible to specify the table\nidentifier, or the database identifier plus the table identifier.\n* An identifier is fully-qualified if it contains all possible qualifiers, for\nexample, the following column is fully qualified: db_name.tbl_name.col_name.\n\nIf a qualifier is composed by more than one identifier, a dot (.) must be used\nas a separator. All identifiers can be quoted individually. Extra spacing\n(including new lines and tabs) is allowed.\n\nAll the following examples are valid:\n\n* db_name.tbl_name.col_name\n* tbl_name\n* `db_name`.`tbl_name`.`col_name`\n* `db_name` . `tbl_name`\n* db_name. tbl_name\n\nIf a table identifier is prefixed with a dot (.), the default database is\nassumed. This syntax is supported for ODBC compliance, but has no practical\neffect on MariaDB. These qualifiers are equivalent:\n\n* tbl_name\n* . tbl_name\n* .`tbl_name`\n* . `tbl_name`\n\nFor DML statements, it is possible to specify a list of the partitions using\nthe PARTITION clause. See Partition Pruning and Selection for details.\n\nURL: https://mariadb.com/kb/en/identifier-qualifiers/','','https://mariadb.com/kb/en/identifier-qualifiers/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,29,'Identifier to File Name Mapping','Some identifiers map to a file name on the filesystem. Databases each have\ntheir own directory, while, depending on the storage engine, table names and\nindex names may map to a file name.\n\nNot all characters that are allowed in table names can be used in file names.\nEvery filesystem has its own rules of what characters can be used in file\nnames. To let the user create tables using all characters allowed in the SQL\nStandard and to not depend on whatever particular filesystem a particular\ndatabase resides, MariaDB encodes \"potentially unsafe\" characters in the table\nname to derive the corresponding file name.\n\nThis is implemented using a special character set. MariaDB converts a table\nname to the \"filename\" character set to get the file name for this table. And\nit converts the file name from the \"filename\" character set to, for example,\nutf8 to get the table name for this file name.\n\nThe conversion rules are as follows: if the identifier is made up only of\nbasic Latin numbers, letters and/or the underscore character, the encoding\nmatches the name (see however Identifier Case Sensitivity). Otherwise they are\nencoded according to the following table:\n\n+-----------------+------------+-----------+--------+-----------+-----------+\n| Code Range | Pattern | Number | Used | Unused | Blocks |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 00C0..017F | [@][0..4][ | 5*20= 100 | 97 | 3 | Latin-1 |\n| | ..z] | | | | Supplemen |\n| | | | | | + Latin |\n| | | | | | Extended- |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0370..03FF | [@][5..9][ | 5*20= 100 | 88 | 12 | Greek |\n| | ..z] | | | | and |\n| | | | | | Coptic |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0400..052F | [@][g..z][ | 20*7= 140 | 137 | 3 | Cyrillic |\n| | ..6] | | | | + |\n| | | | | | Cyrillic |\n| | | | | | Supplemen |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0530..058F | [@][g..z][ | 20*2= 40 | 38 | 2 | Armenian |\n| | ..8] | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 2160..217F | [@][g..z][ | 20*1= 20 | 16 | 4 | Number |\n| | ] | | | | Forms |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 0180..02AF | [@][g..z][ | 20*11=220 | 203 | 17 | Latin |\n| | ..k] | | | | Extended- |\n| | | | | | + IPA |\n| | | | | | Extension |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 1E00..1EFF | [@][g..z][ | 20*7= 140 | 136 | 4 | Latin |\n| | ..r] | | | | Extended |\n| | | | | | Additiona |\n| | | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 1F00..1FFF | [@][g..z][ | 20*8= 160 | 144 | 16 | Greek |\n| | ..z] | | | | Extended |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| .... .... | [@][a..f][ | 6*20= 120 | 0 | 120 | RESERVED |\n| | ..z] | | | | |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| 24B6..24E9 | [@][@][a.. | 26 | 26 | 0 | Enclosed |\n| | ] | | | | Alphanume |\n| | | | | | ics |\n+-----------------+------------+-----------+--------+-----------+-----------+\n| FF21..FF5A | [@][a..z][ | 26 | 26 | 0 | Halfwidth |\n| | ] | | | | and |\n| | | | | | Fullwidth |\n| | | | | | forms |\n+-----------------+------------+-----------+--------+-----------+-----------+\n\nCode Range values are UCS-2.\n\nAll of this encoding happens transparently at the filesystem level with one\nexception. Until MySQL 5.1.6, an old encoding was used. Identifiers created in\na version before MySQL 5.1.6, and which haven\'t been updated to the new\nencoding, the server prefixes mysql50 to their name.\n\nExamples\n--------\n\nFind the file name for a table with a non-Latin1 name:\n\nselect cast(convert(\"this_is_таблица\" USING filename) as binary);\n+------------------------------------------------------------------+\n| cast(convert(\"this_is_таблица\" USING filename) as binary) |\n+------------------------------------------------------------------+\n| this_is_@y0@g0@h0@r0@o0@i1@g0 |\n+------------------------------------------------------------------+\n\nFind the table name for a file name:\n\nselect convert(_filename \"this_is_@y0@g0@h0@r0@o0@i1@g0\" USING utf8);\n+---------------------------------------------------------------+\n| convert(_filename \"this_is_@y0@g0@h0@r0@o0@i1@g0\" USING utf8) |\n+---------------------------------------------------------------+\n| this_is_таблица |\n+---------------------------------------------------------------+\n\nAn old table created before MySQL 5.1.6, with the old encoding:\n\nSHOW TABLES;\n+--------------------+\n| Tables_in_test |\n+--------------------+\n| #mysql50#table@1 |\n+--------------------+\n\nThe prefix needs to be supplied to reference this table:\n\nSHOW COLUMNS FROM `table@1`;\nERROR 1146 (42S02): Table \'test.table@1\' doesn\'t exist\n\nSHOW COLUMNS FROM `#mysql50#table@1`;\n+-------+---------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| i | int(11) | YES | | NULL | |\n+-------+---------+------+-----+---------+-------+\n\nURL: https://mariadb.com/kb/en/identifier-to-file-name-mapping/','','https://mariadb.com/kb/en/identifier-to-file-name-mapping/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (479,29,'Numeric Literals','Numeric literals are written as a sequence of digits from 0 to 9. Initial\nzeros are ignored. A sign can always precede the digits, but it is optional\nfor positive numbers. In decimal numbers, the integer part and the decimal\npart are divided with a dot (.).\n\nIf the integer part is zero, it can be omitted, but the literal must begin\nwith a dot.\n\nThe notation with exponent can be used. The exponent is preceded by an E or e\ncharacter. The exponent can be preceded by a sign and must be an integer. A\nnumber N with an exponent part X, is calculated as N * POW(10, X).\n\nIn some cases, adding zeroes at the end of a decimal number can increment the\nprecision of the expression where the number is used. For example, PI() by\ndefault returns a number with 6 decimal digits. But the PI()+0.0000000000\nexpression (with 10 zeroes) returns a number with 10 decimal digits.\n\nHexadecimal literals are interpreted as numbers when used in numeric contexts.\n\nExamples\n--------\n\n10\n+10\n-10\n\nAll these literals are equivalent:\n\n0.1\n.1\n+0.1\n+.1\n\nWith exponents:\n\n0.2E3 -- 0.2 * POW(10, 3) = 200\n.2e3\n.2e+2\n1.1e-10 -- 0.00000000011\n-1.1e10 -- -11000000000\n\nURL: https://mariadb.com/kb/en/numeric-iterals/','','https://mariadb.com/kb/en/numeric-iterals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (480,29,'Reserved Words','The following is a list of all reserved words in MariaDB.\n\nReserved words cannot be used as Identifiers, unless they are quoted.\n\nThe definitive list of reserved words for each version can be found by\nexamining the sql/lex.h and sql/sql_yacc.yy files.\n\nReserved Words\n--------------\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| ACCESSIBLE | |\n+--------------------------------------------+--------------------------------+\n| ADD | |\n+--------------------------------------------+--------------------------------+\n| ALL | |\n+--------------------------------------------+--------------------------------+\n| ALTER | |\n+--------------------------------------------+--------------------------------+\n| ANALYZE | |\n+--------------------------------------------+--------------------------------+\n| AND | |\n+--------------------------------------------+--------------------------------+\n| AS | |\n+--------------------------------------------+--------------------------------+\n| ASC | |\n+--------------------------------------------+--------------------------------+\n| ASENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| BEFORE | |\n+--------------------------------------------+--------------------------------+\n| BETWEEN | |\n+--------------------------------------------+--------------------------------+\n| BIGINT | |\n+--------------------------------------------+--------------------------------+\n| BINARY | |\n+--------------------------------------------+--------------------------------+\n| BLOB | |\n+--------------------------------------------+--------------------------------+\n| BOTH | |\n+--------------------------------------------+--------------------------------+\n| BY | |\n+--------------------------------------------+--------------------------------+\n| CALL | |\n+--------------------------------------------+--------------------------------+\n| CASCADE | |\n+--------------------------------------------+--------------------------------+\n| CASE | |\n+--------------------------------------------+--------------------------------+\n| CHANGE | |\n+--------------------------------------------+--------------------------------+\n| CHAR | |\n+--------------------------------------------+--------------------------------+\n| CHARACTER | |\n+--------------------------------------------+--------------------------------+\n| CHECK | |\n+--------------------------------------------+--------------------------------+\n| COLLATE | |\n+--------------------------------------------+--------------------------------+\n| COLUMN | |\n+--------------------------------------------+--------------------------------+\n| CONDITION | |\n+--------------------------------------------+--------------------------------+\n| CONSTRAINT | |\n+--------------------------------------------+--------------------------------+\n| CONTINUE | |\n+--------------------------------------------+--------------------------------+\n| CONVERT | |\n+--------------------------------------------+--------------------------------+\n| CREATE | |\n+--------------------------------------------+--------------------------------+\n| CROSS | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_DATE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_ROLE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIME | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_USER | |\n+--------------------------------------------+--------------------------------+\n| CURSOR | |\n+--------------------------------------------+--------------------------------+\n| DATABASE | |\n+--------------------------------------------+--------------------------------+\n| DATABASES | |\n+--------------------------------------------+--------------------------------+\n| DAY_HOUR | |\n+--------------------------------------------+--------------------------------+\n| DAY_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| DAY_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| DAY_SECOND | |\n+--------------------------------------------+--------------------------------+\n| DEC | |\n+--------------------------------------------+--------------------------------+\n| DECIMAL | |\n+--------------------------------------------+--------------------------------+\n| DECLARE | |\n+--------------------------------------------+--------------------------------+\n| DEFAULT | |\n+--------------------------------------------+--------------------------------+\n| DELAYED | |\n+--------------------------------------------+--------------------------------+\n| DELETE | |\n+--------------------------------------------+--------------------------------+\n| DELETE_DOMAIN_ID | |\n+--------------------------------------------+--------------------------------+\n| DESC | |\n+--------------------------------------------+--------------------------------+\n| DESCRIBE | |\n+--------------------------------------------+--------------------------------+\n| DETERMINISTIC | |\n+--------------------------------------------+--------------------------------+\n| DISTINCT | |\n+--------------------------------------------+--------------------------------+\n| DISTINCTROW | |\n+--------------------------------------------+--------------------------------+\n| DIV | |\n+--------------------------------------------+--------------------------------+\n| DO_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| DOUBLE | |\n+--------------------------------------------+--------------------------------+\n| DROP | |\n+--------------------------------------------+--------------------------------+\n| DUAL | |\n+--------------------------------------------+--------------------------------+\n| EACH | |\n+--------------------------------------------+--------------------------------+\n| ELSE | |\n+--------------------------------------------+--------------------------------+\n| ELSEIF | |\n+--------------------------------------------+--------------------------------+\n| ENCLOSED | |\n+--------------------------------------------+--------------------------------+\n| ESCAPED | |\n+--------------------------------------------+--------------------------------+\n| EXCEPT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| EXISTS | |\n+--------------------------------------------+--------------------------------+\n| EXIT | |\n+--------------------------------------------+--------------------------------+\n| EXPLAIN | |\n+--------------------------------------------+--------------------------------+\n| FALSE | |\n+--------------------------------------------+--------------------------------+\n| FETCH | |\n+--------------------------------------------+--------------------------------+\n| FLOAT | |\n+--------------------------------------------+--------------------------------+\n| FLOAT4 | |\n+--------------------------------------------+--------------------------------+\n| FLOAT8 | |\n+--------------------------------------------+--------------------------------+\n| FOR | |\n+--------------------------------------------+--------------------------------+\n| FORCE | |\n+--------------------------------------------+--------------------------------+\n| FOREIGN | |\n+--------------------------------------------+--------------------------------+\n| FROM | |\n+--------------------------------------------+--------------------------------+\n| FULLTEXT | |\n+--------------------------------------------+--------------------------------+\n| GENERAL | |\n+--------------------------------------------+--------------------------------+\n| GRANT | |\n+--------------------------------------------+--------------------------------+\n| GROUP | |\n+--------------------------------------------+--------------------------------+\n| HAVING | |\n+--------------------------------------------+--------------------------------+\n| HIGH_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| HOUR_SECOND | |','','https://mariadb.com/kb/en/reserved-words/');
+update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| IF | |\n+--------------------------------------------+--------------------------------+\n| IGNORE | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_SERVER_IDS | |\n+--------------------------------------------+--------------------------------+\n| IN | |\n+--------------------------------------------+--------------------------------+\n| INDEX | |\n+--------------------------------------------+--------------------------------+\n| INFILE | |\n+--------------------------------------------+--------------------------------+\n| INNER | |\n+--------------------------------------------+--------------------------------+\n| INOUT | |\n+--------------------------------------------+--------------------------------+\n| INSENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| INSERT | |\n+--------------------------------------------+--------------------------------+\n| INT | |\n+--------------------------------------------+--------------------------------+\n| INT1 | |\n+--------------------------------------------+--------------------------------+\n| INT2 | |\n+--------------------------------------------+--------------------------------+\n| INT3 | |\n+--------------------------------------------+--------------------------------+\n| INT4 | |\n+--------------------------------------------+--------------------------------+\n| INT8 | |\n+--------------------------------------------+--------------------------------+\n| INTEGER | |\n+--------------------------------------------+--------------------------------+\n| INTERSECT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| INTERVAL | |\n+--------------------------------------------+--------------------------------+\n| INTO | |\n+--------------------------------------------+--------------------------------+\n| IS | |\n+--------------------------------------------+--------------------------------+\n| ITERATE | |\n+--------------------------------------------+--------------------------------+\n| JOIN | |\n+--------------------------------------------+--------------------------------+\n| KEY | |\n+--------------------------------------------+--------------------------------+\n| KEYS | |\n+--------------------------------------------+--------------------------------+\n| KILL | |\n+--------------------------------------------+--------------------------------+\n| LEADING | |\n+--------------------------------------------+--------------------------------+\n| LEAVE | |\n+--------------------------------------------+--------------------------------+\n| LEFT | |\n+--------------------------------------------+--------------------------------+\n| LIKE | |\n+--------------------------------------------+--------------------------------+\n| LIMIT | |\n+--------------------------------------------+--------------------------------+\n| LINEAR | |\n+--------------------------------------------+--------------------------------+\n| LINES | |\n+--------------------------------------------+--------------------------------+\n| LOAD | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIME | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| LOCK | |\n+--------------------------------------------+--------------------------------+\n| LONG | |\n+--------------------------------------------+--------------------------------+\n| LONGBLOB | |\n+--------------------------------------------+--------------------------------+\n| LONGTEXT | |\n+--------------------------------------------+--------------------------------+\n| LOOP | |\n+--------------------------------------------+--------------------------------+\n| LOW_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| MASTER_HEARTBEAT_PERIOD | |\n+--------------------------------------------+--------------------------------+\n| MASTER_SSL_VERIFY_SERVER_CERT | |\n+--------------------------------------------+--------------------------------+\n| MATCH | |\n+--------------------------------------------+--------------------------------+\n| MAXVALUE | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMBLOB | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMINT | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMTEXT | |\n+--------------------------------------------+--------------------------------+\n| MIDDLEINT | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_SECOND | |\n+--------------------------------------------+--------------------------------+\n| MOD | |\n+--------------------------------------------+--------------------------------+\n| MODIFIES | |\n+--------------------------------------------+--------------------------------+\n| NATURAL | |\n+--------------------------------------------+--------------------------------+\n| NOT | |\n+--------------------------------------------+--------------------------------+\n| NO_WRITE_TO_BINLOG | |\n+--------------------------------------------+--------------------------------+\n| NULL | |\n+--------------------------------------------+--------------------------------+\n| NUMERIC | |\n+--------------------------------------------+--------------------------------+\n| OFFSET | Added in MariaDB 10.6.0 |\n+--------------------------------------------+--------------------------------+\n| ON | |\n+--------------------------------------------+--------------------------------+\n| OPTIMIZE | |\n+--------------------------------------------+--------------------------------+\n| OPTION | |\n+--------------------------------------------+--------------------------------+\n| OPTIONALLY | |\n+--------------------------------------------+--------------------------------+\n| OR | |\n+--------------------------------------------+--------------------------------+\n| ORDER | |\n+--------------------------------------------+--------------------------------+\n| OUT | |\n+--------------------------------------------+--------------------------------+\n| OUTER | |\n+--------------------------------------------+--------------------------------+\n| OUTFILE | |\n+--------------------------------------------+--------------------------------+\n| OVER | |\n+--------------------------------------------+--------------------------------+\n| PAGE_CHECKSUM | |\n+--------------------------------------------+--------------------------------+\n| PARSE_VCOL_EXPR | |\n+--------------------------------------------+--------------------------------+\n| PARTITION | |\n+--------------------------------------------+--------------------------------+\n| POSITION | |\n+--------------------------------------------+--------------------------------+\n| PRECISION | |\n+--------------------------------------------+--------------------------------+\n| PRIMARY | |\n+--------------------------------------------+--------------------------------+\n| PROCEDURE | |\n+--------------------------------------------+--------------------------------+\n| PURGE | |\n+--------------------------------------------+--------------------------------+\n| RANGE | |\n+--------------------------------------------+--------------------------------+\n| READ | |\n+--------------------------------------------+--------------------------------+\n| READS | |\n+--------------------------------------------+--------------------------------+\n| READ_WRITE | |\n+--------------------------------------------+--------------------------------+\n| REAL | |\n+--------------------------------------------+--------------------------------+\n| RECURSIVE | |\n+--------------------------------------------+--------------------------------+\n| REF_SYSTEM_ID | |\n+--------------------------------------------+--------------------------------+\n| REFERENCES | |\n+--------------------------------------------+--------------------------------+\n| REGEXP | |\n+--------------------------------------------+--------------------------------+\n| RELEASE | |\n+--------------------------------------------+--------------------------------+\n| RENAME | |') WHERE help_topic_id = 480;
+update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| REPEAT | |\n+--------------------------------------------+--------------------------------+\n| REPLACE | |\n+--------------------------------------------+--------------------------------+\n| REQUIRE | |\n+--------------------------------------------+--------------------------------+\n| RESIGNAL | |\n+--------------------------------------------+--------------------------------+\n| RESTRICT | |\n+--------------------------------------------+--------------------------------+\n| RETURN | |\n+--------------------------------------------+--------------------------------+\n| RETURNING | |\n+--------------------------------------------+--------------------------------+\n| REVOKE | |\n+--------------------------------------------+--------------------------------+\n| RIGHT | |\n+--------------------------------------------+--------------------------------+\n| RLIKE | |\n+--------------------------------------------+--------------------------------+\n| ROWS | |\n+--------------------------------------------+--------------------------------+\n| SCHEMA | |\n+--------------------------------------------+--------------------------------+\n| SCHEMAS | |\n+--------------------------------------------+--------------------------------+\n| SECOND_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| SELECT | |\n+--------------------------------------------+--------------------------------+\n| SENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| SEPARATOR | |\n+--------------------------------------------+--------------------------------+\n| SET | |\n+--------------------------------------------+--------------------------------+\n| SHOW | |\n+--------------------------------------------+--------------------------------+\n| SIGNAL | |\n+--------------------------------------------+--------------------------------+\n| SLOW | |\n+--------------------------------------------+--------------------------------+\n| SMALLINT | |\n+--------------------------------------------+--------------------------------+\n| SPATIAL | |\n+--------------------------------------------+--------------------------------+\n| SPECIFIC | |\n+--------------------------------------------+--------------------------------+\n| SQL | |\n+--------------------------------------------+--------------------------------+\n| SQLEXCEPTION | |\n+--------------------------------------------+--------------------------------+\n| SQLSTATE | |\n+--------------------------------------------+--------------------------------+\n| SQLWARNING | |\n+--------------------------------------------+--------------------------------+\n| SQL_BIG_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SQL_CALC_FOUND_ROWS | |\n+--------------------------------------------+--------------------------------+\n| SQL_SMALL_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SSL | |\n+--------------------------------------------+--------------------------------+\n| STARTING | |\n+--------------------------------------------+--------------------------------+\n| STATS_AUTO_RECALC | |\n+--------------------------------------------+--------------------------------+\n| STATS_PERSISTENT | |\n+--------------------------------------------+--------------------------------+\n| STATS_SAMPLE_PAGES | |\n+--------------------------------------------+--------------------------------+\n| STRAIGHT_JOIN | |\n+--------------------------------------------+--------------------------------+\n| TABLE | |\n+--------------------------------------------+--------------------------------+\n| TERMINATED | |\n+--------------------------------------------+--------------------------------+\n| THEN | |\n+--------------------------------------------+--------------------------------+\n| TINYBLOB | |\n+--------------------------------------------+--------------------------------+\n| TINYINT | |\n+--------------------------------------------+--------------------------------+\n| TINYTEXT | |\n+--------------------------------------------+--------------------------------+\n| TO | |\n+--------------------------------------------+--------------------------------+\n| TRAILING | |\n+--------------------------------------------+--------------------------------+\n| TRIGGER | |\n+--------------------------------------------+--------------------------------+\n| TRUE | |\n+--------------------------------------------+--------------------------------+\n| UNDO | |\n+--------------------------------------------+--------------------------------+\n| UNION | |\n+--------------------------------------------+--------------------------------+\n| UNIQUE | |\n+--------------------------------------------+--------------------------------+\n| UNLOCK | |\n+--------------------------------------------+--------------------------------+\n| UNSIGNED | |\n+--------------------------------------------+--------------------------------+\n| UPDATE | |\n+--------------------------------------------+--------------------------------+\n| USAGE | |\n+--------------------------------------------+--------------------------------+\n| USE | |\n+--------------------------------------------+--------------------------------+\n| USING | |\n+--------------------------------------------+--------------------------------+\n| UTC_DATE | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIME | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| VALUES | |\n+--------------------------------------------+--------------------------------+\n| VARBINARY | |\n+--------------------------------------------+--------------------------------+\n| VARCHAR | |\n+--------------------------------------------+--------------------------------+\n| VARCHARACTER | |\n+--------------------------------------------+--------------------------------+\n| VARYING | |\n+--------------------------------------------+--------------------------------+\n| WHEN | |\n+--------------------------------------------+--------------------------------+\n| WHERE | |\n+--------------------------------------------+--------------------------------+\n| WHILE | |\n+--------------------------------------------+--------------------------------+\n| WINDOW | Only disallowed for table |\n| | aliases. |\n+--------------------------------------------+--------------------------------+\n| WITH | |\n+--------------------------------------------+--------------------------------+\n| WRITE | |\n+--------------------------------------------+--------------------------------+\n| XOR | |\n+--------------------------------------------+--------------------------------+\n| YEAR_MONTH | |\n+--------------------------------------------+--------------------------------+\n| ZEROFILL | |\n+--------------------------------------------+--------------------------------+\n\nExceptions\n----------\n\nSome keywords are exceptions for historical reasons, and are permitted as\nunquoted identifiers. These include:\n\n+-----------------------------------------------------------------------------+\n| Keyword |\n+-----------------------------------------------------------------------------+\n| ACTION |\n+-----------------------------------------------------------------------------+\n| BIT |\n+-----------------------------------------------------------------------------+\n| DATE |\n+-----------------------------------------------------------------------------+\n| ENUM |\n+-----------------------------------------------------------------------------+\n| NO |\n+-----------------------------------------------------------------------------+\n| TEXT |\n+-----------------------------------------------------------------------------+\n| TIME |\n+-----------------------------------------------------------------------------+\n| TIMESTAMP |\n+-----------------------------------------------------------------------------+\n\nOracle Mode\n-----------\n\nIn Oracle mode, from MariaDB 10.3, there are a number of extra reserved words:\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| BODY | |\n+--------------------------------------------+--------------------------------+\n| ELSIF | |\n+--------------------------------------------+--------------------------------+\n| GOTO | |\n+--------------------------------------------+--------------------------------+\n| HISTORY | <= MariaDB 10.3.6 only |') WHERE help_topic_id = 480;
+update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| MINUS | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| OTHERS | |\n+--------------------------------------------+--------------------------------+\n| PACKAGE | |\n+--------------------------------------------+--------------------------------+\n| PERIOD | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| RAISE | |\n+--------------------------------------------+--------------------------------+\n| ROWNUM | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| ROWTYPE | |\n+--------------------------------------------+--------------------------------+\n| SYSDATE | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| SYSTEM | <= MariaDB 10.3.6 only. Note |\n| | however that SYSTEM sometimes |\n| | needs to be quoted to avoid |\n| | confusion with |\n| | System-versioned tables. |\n+--------------------------------------------+--------------------------------+\n| SYSTEM_TIME | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| VERSIONING | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| WITHOUT | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n\nFunction Names\n--------------\n\nIf the IGNORE_SPACE SQL_MODE flag is set, function names become reserved words.\n\nURL: https://mariadb.com/kb/en/reserved-words/') WHERE help_topic_id = 480;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (481,29,'String Literals','Strings are sequences of characters and are enclosed with quotes.\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 quotes (the same\ncharacter must be used to both open and close the string).\n\nThe ANSI SQL-standard does not permit double quotes for enclosing strings, and\nalthough MariaDB does by default, if the MariaDB server has enabled the\nANSI_QUOTES_SQL SQL_MODE, double quotes will be treated as being used for\nidentifiers instead of strings.\n\nStrings that are next to each other are automatically concatenated. For\nexample:\n\n\'The \' \'MariaDB \' \'Foundation\'\n\nand\n\n\'The MariaDB Foundation\'\n\nare equivalent.\n\nThe \\ (backslash character) is used to escape characters (unless the SQL_MODE\nhasn\'t been set to NO_BACKSLASH_ESCAPES). For example:\n\n\'MariaDB\'s new features\'\n\nis not a valid string because of the single quote in the middle of the string,\nwhich is treated as if it closes the string, but is actually meant as part of\nthe string, an apostrophe. 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 the 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 twice:\n\nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n\nEscape Sequences\n----------------\n\nThere are other escape sequences also. Here is a full list:\n\n+-----------------------------------------------+-----------------------------+\n| Escape 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 |\n| | note following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\\\ | Backslash (\"\\\"). |\n+-----------------------------------------------+-----------------------------+\n| \\% | \"%\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\_ | A \"_\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n\nEscaping the % and _ characters can be necessary when using the LIKE operator,\nwhich treats them as special characters.\n\nThe ASCII 26 character (\\Z) needs to be escaped when included in a batch file\nwhich needs to be executed in Windows. The reason is that ASCII 26, in\nWindows, is the end of file (EOF).\n\nBackslash (\\), if not used as an escape character, must always be escaped.\nWhen followed by a character that is not in the above table, backslashes will\nsimply be ignored.\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 (482,29,'Table Value Constructors','MariaDB starting with 10.3.3\n----------------------------\nTable Value Constructors were introduced in MariaDB 10.3.3\n\nSyntax\n------\n\nVALUES ( row_value[, row_value...]), (...)...\n\nDescription\n-----------\n\nIn Unions, Views, and sub-queries, a Table Value Constructor (TVC) allows you\nto inject arbitrary values into the result-set. The given values must have the\nsame number of columns as the result-set, otherwise it returns Error 1222.\n\nExamples\n--------\n\nUsing TVC\'s with UNION operations:\n\nCREATE TABLE test.t1 (val1 INT, val2 INT);\nINSERT INTO test.t1 VALUES(5, 8), (3, 4), (1, 2);\n\nSELECT * FROM test.t1\nUNION\nVALUES (70, 90), (100, 110);\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 5 | 8 | \n| 3 | 4 |\n| 1 | 2 |\n| 70 | 90 |\n| 100 | 110 |\n+------+------+\n\nUsing TVC\'s with a CREATE VIEW statement:\n\nCREATE VIEW v1 AS VALUES (7, 9), (9, 10);\n\nSELECT * FROM v1;\n+---+----+\n| 7 | 9 |\n+---+----+\n| 7 | 9 |\n| 9 | 10 |\n+---+----+\n\nUsing TVC with an ORDER BY clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nORDER BY val1 DESC;\n\nUsing TVC with LIMIT clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nLIMIT 2 OFFSET 4;\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 30 | 40 | \n| 50 | 60 |\n+------+------+\n\nURL: https://mariadb.com/kb/en/table-value-constructors/','','https://mariadb.com/kb/en/table-value-constructors/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,29,'User-Defined Variables','User-defined variables are variables which can be created by the user and\nexist in the session. This means that no one can access user-defined variables\nthat have been set by another user, and when the session is closed these\nvariables expire. However, these variables can be shared between several\nqueries and stored programs.\n\nUser-defined variables names must be preceded by a single at character (@).\nWhile it is safe to use a reserved word as a user-variable name, the only\nallowed characters are ASCII letters, digits, dollar sign ($), underscore (_)\nand dot (.). If other characters are used, the name can be quoted in one of\nthe following ways:\n\n* @`var_name`\n* @\'var_name\'\n* @\"var_name\"\n\nThese characters can be escaped as usual.\n\nUser-variables names are case insensitive, though they were case sensitive in\nMySQL 4.1 and older versions.\n\nUser-defined variables cannot be declared. They can be read even if no value\nhas been set yet; in that case, they are NULL. To set a value for a\nuser-defined variable you can use:\n\n* SET statement;\n* := operator within a SQL statement;\n* SELECT ... INTO.\n\nSince user-defined variables type cannot be declared, the only way to force\ntheir type is using CAST() or CONVERT():\n\nSET @str = CAST(123 AS CHAR(5));\n\nIf a variable has not been used yet, its value is NULL:\n\nSELECT @x IS NULL;\n+------------+\n| @x IS NULL |\n+------------+\n| 1 |\n+------------+\n\nIt is unsafe to read a user-defined variable and set its value in the same\nstatement (unless the command is SET), because the order of these actions is\nundefined.\n\nUser-defined variables can be used in most MariaDB\'s statements and clauses\nwhich accept an SQL expression. However there are some exceptions, like the\nLIMIT clause.\n\nThey must be used to PREPARE a prepared statement:\n\n@sql = \'DELETE FROM my_table WHERE c>1;\';\nPREPARE stmt FROM @sql;\nEXECUTE stmt;\nDEALLOCATE PREPARE stmt;\n\nAnother common use is to include a counter in a query:\n\nSET @var = 0;\nSELECT a, b, c, (@var:=@var+1) AS counter FROM my_table;\n\nInformation Schema\n------------------\n\nUser-defined variables can be viewed in the Information Schema USER_VARIABLES\nTable (as part of the User Variables plugin) from MariaDB 10.2.\n\nFlushing User-Defined Variables\n-------------------------------\n\nUser-defined variables are reset and the Information Schema table emptied with\nthe FLUSH USER_VARIABLES statement.\n\nSET @str = CAST(123 AS CHAR(5));\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\n+---------------+----------------+---------------+--------------------+\n| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |\n+---------------+----------------+---------------+--------------------+\n| str | 123 | VARCHAR | utf8mb3 |\n+---------------+----------------+---------------+--------------------+\n\nFLUSH USER_VARIABLES;\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\nEmpty set (0.000 sec)\n\nURL: https://mariadb.com/kb/en/user-defined-variables/','','https://mariadb.com/kb/en/user-defined-variables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,29,'Delimiters','The default delimiter in the mysql client (from MariaDB 10.4.6, also called\nmariadb) is the semicolon.\n\nWhen creating stored programs from the command-line, it is likely you will\nneed to differentiate between the regular delimiter and a delimiter inside a\nBEGIN END block. To understand better, consider the following example:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND;\n\nIf you enter the above line by line, the mysql client will treat the first\nsemicolon, at the end of the DECLARE x TINYINT line, as the end of the\nstatement. Since that\'s only a partial definition, it will throw a syntax\nerror, as follows:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\nDECLARE x TINYINT;\nERROR 1064 (42000): You have an error in your SQL syntax; \ncheck the manual that corresponds to your MariaDB server version\n for the right syntax to use near \'\' at line 3\n\nThe solution is to specify a distinct delimiter for the duration of the\nprocess, using the DELIMITER command. The delimiter can be any set of\ncharacters you choose, but it needs to be a distinctive set of characters that\nwon\'t cause further confusion. // is a common choice, and used throughout the\nknowledgebase.\n\nHere\'s how the function could be successfully entered from the mysql client\nwith the new delimiter.\n\nDELIMITER //\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND\n\n//\n\nDELIMITER ;\n\nAt the end, the delimiter is restored to the default semicolon. The \\g and \\G\ndelimiters can always be used, even when a custom delimiter is specified.\n\nURL: https://mariadb.com/kb/en/delimiters/','','https://mariadb.com/kb/en/delimiters/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,29,'SQL_MODE=ORACLE','From MariaDB 10.3, setting the sql_mode system variable to Oracle allows the\nserver to understand a subset of Oracle\'s PL/SQL language. For example:\n\nSET SQL_MODE=\'ORACLE\';\n\nAll traditional MariaDB SQL/PSM syntax should work as before, as long as it\ndoes not conflict with Oracle\'s PL/SQL syntax. All MariaDB functions should be\nsupported in both normal and Oracle modes.\n\nPrior to MariaDB 10.3, MariaDB does not support Oracle\'s PL/SQL language, and\nSET SQL_MODE=ORACLE is only an alias for the following sql_mode in those\nversions:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER\';\n\nFrom MariaDB 10.3, SET SQL_MODE=ORACLE is same as:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT\';\n\nSupported Syntax in Oracle Mode\n-------------------------------\n\nStored Procedures and Stored Functions\n--------------------------------------\n\nOracle mode makes the following changes to Stored Procedures and Stored\nFunctions:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (param OUT INT) | ANSI uses (OUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (a IN OUT INT) | ANSI uses (INOUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| AS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | AS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| IS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | IS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| If function has no parameters then | Example: CREATE PROCEDURE p1 AS |\n| parentheses must be omitted | BEGIN NULL; END; |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS BEGIN END p1; | Optional routine name after END |\n| | keyword. MDEV-12089 |\n+-----------------------------------------+-----------------------------------+\n| CREATE FUNCTION f1(a VARCHAR) | VARCHAR can be used without |\n| | length for routine parameters |\n| | and RETURN clause. The length is |\n| | inherited from the argument at |\n| | call time. MDEV-10596 |\n+-----------------------------------------+-----------------------------------+\n| CREATE AGGREGATE FUNCTION f1( ) | Creates an aggregate function, |\n| | which performs the function |\n| | against a set of rows and |\n| | returns one aggregate result. |\n+-----------------------------------------+-----------------------------------+\n| No CALL needed in Stored Procedures | In Oracle mode one can call |\n| | other stored procedures with |\n| | name only. MDEV-12107 |\n+-----------------------------------------+-----------------------------------+\n| RETURN. Can also be used in stored | ANSI uses RETURNS. MariaDB mode |\n| procedures | only supports RETURNS in stored |\n| | functions |\n+-----------------------------------------+-----------------------------------+\n\nCursors\n-------\n\nOracle mode makes the following changes to Cursors:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS CURSOR cur IS | Explicit cursor with FOR loop. |\n| (SELECT a, b FROM t1); BEGIN FOR rec | MDEV-10581 |\n| IN cur ... | |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS rec IN (SELECT | Implicit cursor with FOR loop. |\n| a, b FROM t1) | MDEV-12098 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters. |\n| VARCHAR2) ... OPEN c(1,2) | MDEV-10597 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters and FOR |\n| VARCHAR2) ... FOR rec in c(1,2) | loop. MDEV-12314 |\n+-----------------------------------------+-----------------------------------+\n| s %ISOPEN, %ROWCOUNT, %FOUND, %NOTFOUND | Explicit cursor attributes. |\n| | MDEV-10582 |\n+-----------------------------------------+-----------------------------------+\n\nLOOP\n----\n\nOracle mode makes the following changes to LOOP:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| FOR i IN 1..10 LOOP ... END LOOP | Numeric FOR loop. MDEV-10580 |\n+-----------------------------------------+-----------------------------------+\n| GOTO | GOTO statement. MDEV-10697 |\n+-----------------------------------------+-----------------------------------+\n| <<label>> used with GOTO | ANSI uses label:. MDEV-10697 |\n+-----------------------------------------+-----------------------------------+\n| To leave loop block: EXIT [ label ] [ | ANSI syntax is IF bool_expr THEN |\n| WHEN bool_expr ] | LEAVE label |\n+-----------------------------------------+-----------------------------------+\n| [<<label>>] WHILE boolean_expression | Oracle style WHILE loop |\n| LOOP statement... END LOOP [ label ] ; | |\n+-----------------------------------------+-----------------------------------+\n| CONTINUE [ label ] [ WHEN | CONTINUE is only valid inside a |\n| boolean_expression] | loop |\n+-----------------------------------------+-----------------------------------+\n\nVariables\n---------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| var:= 10; Can also be used | 10.3 | MariaDB uses SET var= |\n| with MariaDB systemvariables | | 10; |\n+------------------------------+-----------------+--------------------------+\n| var INT := 10 | 10.3 | Default variable value |\n+------------------------------+-----------------+--------------------------+\n| var1 | 10.3 | Take data type from a |\n| table_name.column_name%TYPE | | table column. MDEV-10577 |\n+------------------------------+-----------------+--------------------------+\n| var2 var1%TYPE | 10.3 | Take data type from |\n| | | another variable |\n+------------------------------+-----------------+--------------------------+\n| rec1 table_name%ROWTYPE | 10.3 | Take ROW structure from |\n| | | a table. MDEV-12133 |\n+------------------------------+-----------------+--------------------------+\n| rec2 rec1%ROWTYPE | 10.3 | Take ROW structure from |\n| | | ROW variable |\n+------------------------------+-----------------+--------------------------+\n| CURSOR c1 IS SELECT a,b | 10.3 | Take ROW structure from |\n| FROM t1; rec1 c1%ROWTYPE; | | a cursor. MDEV-12011 |\n+------------------------------+-----------------+--------------------------+\n| Variables can be declared | 10.3 | In MariaDB mode, |\n| after cursor declarations | | variables must be |\n| | | declared before |\n| | | cursors. MDEV-10598 |\n+------------------------------+-----------------+--------------------------+\n| Triggers uses :NEW and :OLD | 10.3 | ANSI uses NEW and OLD. |\n| | | MDEV-10579 |\n+------------------------------+-----------------+--------------------------+\n| SQLCODE | 10.3 | Returns the number code |\n| | | of the most recent |\n| | | exception. Can only be |\n| | | used in Stored |\n| | | Procedures. MDEV-10578 |\n+------------------------------+-----------------+--------------------------+\n| SQLERRM | 10.3 | Returns the error |\n| | | message associdated to |\n| | | it\'s error number |\n| | | argument or SQLCODE if |\n| | | no argument is given. |\n| | | Can only be used in |\n| | | Stored Procedures. |\n| | | MDEV-10578 |\n+------------------------------+-----------------+--------------------------+\n| SQL%ROWCOUNT | 10.3 | Almost same as |\n| | | ROW_COUNT(). MDEV-10583 |\n+------------------------------+-----------------+--------------------------+\n| ROWNUM | 10.6.1 | Returns number of |\n| | | accepted rows |\n+------------------------------+-----------------+--------------------------+\n\nExceptions\n----------\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| BEGIN ... EXCEPTION WHEN OTHERS THEN | Exception handlers are declared |\n| BEGIN .. END; END; | at the end of a block |\n+-----------------------------------------+-----------------------------------+\n| TOO_MANY_ROWS, NO_DATA_FOUND, | Predefined exceptions. MDEV-10839 |\n| DUP_VAL_ON_INDEX | |\n+-----------------------------------------+-----------------------------------+\n| RAISE TOO_MANY_ROWS ; .... EXCEPTION | Exception can be used with RAISE |\n| WHEN TOO_MANY_ROWS THEN ... | and EXCEPTION...WHEN. MDEV-10840 |\n+-----------------------------------------+-----------------------------------+\n| CREATE OR REPLACE FUNCTION f1 (a INT) | User defined exceptions. |\n| RETURN INT AS e1 EXCEPTION... | MDEV-10587 |\n+-----------------------------------------+-----------------------------------+\n\nBEGIN Blocks\n------------\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| BEGIN to start a block | MariaDB uses BEGIN NOT ATOMIC |\n| | for anyonymous blocks. MDEV-10655 |\n+-----------------------------------------+-----------------------------------+\n| DECLARE is used before BEGIN | DECLARE a INT; b VARCHAR(10); |\n| | BEGIN v:= 10; END; |\n+-----------------------------------------+-----------------------------------+\n| WHEN DUP_VAL_ON_INDEX THEN NULL ; | Do not require BEGIN..END in |\n| NULL; WHEN OTHERS THEN NULL | multi-statement exception |\n| | handlers in THEN clause. |\n| | MDEV-12088 |\n+-----------------------------------------+-----------------------------------+\n\nSimple Syntax Compatibility\n---------------------------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| ELSIF | 10.3 | ANSI uses ELSEIF |\n+------------------------------+-----------------+--------------------------+\n| SELECT UNIQUE | 10.3 | Same as SELECT |\n| | | DISTINCT. MDEV-12086 |','','https://mariadb.com/kb/en/sql_modeoracle/');
+update help_topic set description = CONCAT(description, '\n+------------------------------+-----------------+--------------------------+\n| TRUNCATE TABLE t1 [DROP | 10.3 | DROP STORAGE and REUSE |\n| STORAGE] or [REUSE STORAGE] | | STORAGE are allowed as |\n| | | optional keywords for |\n| | | TRUNCATE TABLE. |\n| | | MDEV-10588 |\n+------------------------------+-----------------+--------------------------+\n| Subqueries in a FROM clause | 10.6 | SELECT * FROM (SELECT 1 |\n| without an alias | | FROM DUAL), (SELECT 2 |\n| | | FROM DUAL) |\n+------------------------------+-----------------+--------------------------+\n| UNION, EXCEPT and INTERSECT | 10.3 | INTERSECT has higher |\n| all have the same | | precedence than UNION |\n| precedence. | | and EXCEPT in |\n| | | non-Oracle modes. |\n+------------------------------+-----------------+--------------------------+\n| MINUS | 10.6 | MINUS is a synonym for |\n| | | EXCEPT. |\n+------------------------------+-----------------+--------------------------+\n\nFunctions\n---------\n\n+------------------------------+-----------------+--------------------------+\n| Oracle syntax | Version | Description |\n+------------------------------+-----------------+--------------------------+\n| ADD_MONTHS() | 10.6.1 | Added as a wrapper for |\n| | | DATE_ADD() to enhance |\n| | | Oracle compatibility. |\n| | | All modes. |\n+------------------------------+-----------------+--------------------------+\n| CAST(expr as VARCHAR(N)) | 10.3 | Cast expression to a |\n| | | VARCHAR(N). MDEV-11275 |\n+------------------------------+-----------------+--------------------------+\n| DECODE | 10.3 | In Oracle mode, |\n| | | compares and matches |\n| | | search expressions |\n+------------------------------+-----------------+--------------------------+\n| LENGTH() is same as | 10.3 | MariaDB translates |\n| CHAR_LENGTH() | | LENGTH() to |\n| | | OCTET_LENGTH(). In all |\n| | | modes one can use |\n| | | LENGTHB() as a synonym |\n| | | to OCTET_LENGTH() |\n+------------------------------+-----------------+--------------------------+\n| CHR(num) | 10.3 | Returns a VARCHAR(1) |\n| | | with character set and |\n| | | collation according to |\n| | | @@character_set_database |\n| | | and @@collation_database |\n+------------------------------+-----------------+--------------------------+\n| substr(\'abc\',0 ,3) same as | 10.3 | Position 0 for substr() |\n| substr(\'abc\', 1 ,3) | | is same as position 1 |\n+------------------------------+-----------------+--------------------------+\n| SYS_GUID | 10.6.1 | Generates a globally |\n| | | unique identifier. |\n| | | Similar to UUID but |\n| | | without the -. All |\n| | | modes. |\n+------------------------------+-----------------+--------------------------+\n| TO_CHAR | 10.6.1 | Added to enhance Oracle |\n| | | compatibility. All |\n| | | modes. |\n+------------------------------+-----------------+--------------------------+\n| TRIM, LTRIM, RTRIM, LPAD | 10.3 | Returns NULL instead of |\n| and RPAD | | an empty string if |\n| | | returning an empty |\n| | | result. These functions |\n| | | can also be accessed |\n| | | outside of ORACLE mode |\n| | | by suffixing _ORACLE |\n| | | onto the end of the |\n| | | function name, such as |\n| | | TRIM_ORACLE. |\n+------------------------------+-----------------+--------------------------+\n\nPrepared Statements\n-------------------\n\nOracle mode makes the following changes to Prepared Statements:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| PREPARE stmt FROM \'SELECT :1, :2\' | ANSI uses ?. MDEV-10801 |\n+-----------------------------------------+-----------------------------------+\n| EXECUTE IMMEDIATE \'INSERT INTO t1 | Dynamic placeholders. MDEV-10801 |\n| SELECT (:x,:y) FROM DUAL\' USING 10,20 | |\n+-----------------------------------------+-----------------------------------+\n\nSynonyms for Basic SQL Types\n----------------------------\n\n+--------------------------------+-------------------------------------------+\n| Oracle type | MariaDB synonym |\n+--------------------------------+-------------------------------------------+\n| VARCHAR2 | VARCHAR |\n+--------------------------------+-------------------------------------------+\n| NUMBER | DECIMAL |\n+--------------------------------+-------------------------------------------+\n| DATE (with time portion) | MariaDB DATETIME |\n+--------------------------------+-------------------------------------------+\n| RAW | VARBINARY |\n+--------------------------------+-------------------------------------------+\n| CLOB | LONGTEXT |\n+--------------------------------+-------------------------------------------+\n| BLOB | LONGBLOB |\n+--------------------------------+-------------------------------------------+\n\nThis was implemented as part of MDEV-10343.\n\nIf one does a SHOW CREATE TABLE in ORACLE mode on a table that has a native\nMariaDB DATE column, it will be displayed as mariadb_schema.date to not\nconflict with the Oracle DATE type.\n\nPackages\n--------\n\nThe following syntax has been supported since MariaDB 10.3.5:\n\n* CREATE PACKAGE\n* CREATE PACKAGE BODY\n* DROP PACKAGE\n* DROP PACKAGE BODY\n* SHOW CREATE PACKAGE\n* SHOW CREATE PACKAGE BODY\n\nNULL Handling\n-------------\n\nOracle mode makes the following changes to NULL handling:\n\nNULL As a Statement\n-------------------\n\nNULL can be used as a statement:\n\nIF a=10 THEN NULL; ELSE NULL; END IF\n\nTranslating Empty String Literals to NULL\n-----------------------------------------\n\nIn Oracle, empty string (\'\') and NULL are the same thing,\n\nBy using sql_mode=EMPTY_STRING_IS_NULL you can get a similar experience in\nMariaDB:\n\nSET sql_mode=EMPTY_STRING_IS_NULL;\nSELECT \'\' IS NULL; -- returns TRUE\nINSERT INTO t1 VALUES (\'\'); -- inserts NULL\n\nConcat Operator Ignores NULL\n----------------------------\n\nCONCAT() and || ignore NULL in Oracle mode. Can also be accessed outside of\nORACLE mode by using CONCAT_OPERATOR_ORACLE. MDEV-11880 and MDEV-12143.\n\nReserved Words\n--------------\n\nThere are a number of extra reserved words in Oracle mode.\n\nSHOW CREATE TABLE\n-----------------\n\nThe SHOW CREATE TABLE statement will not display MariaDB-specific table\noptions, such as AUTO_INCREMENT or CHARSET, when Oracle mode is set.\n\nURL: https://mariadb.com/kb/en/sql_modeoracle/') WHERE help_topic_id = 485;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,30,'CONTAINS','Syntax\n------\n\nContains(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2. CONTAINS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_CONTAINS() uses object shapes.\n\nThis tests the opposite relationship to Within().\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 (487,30,'CROSSES','Syntax\n------\n\nCrosses(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon or a\nMultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise, returns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nCROSSES() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_CROSSES() uses object shapes.\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 (488,30,'DISJOINT','Syntax\n------\n\nDisjoint(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially disjoint from (does not\nintersect) g2.\n\nDISJOINT() tests the opposite relationship to INTERSECTS().\n\nDISJOINT() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_DISJOINT() uses object shapes.\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 (489,30,'EQUALS','Syntax\n------\n\nEquals(g1,g2)\n\nFrom MariaDB 10.2.3:\n\nMBREQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nEQUALS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_EQUALS() uses object shapes.\n\nFrom MariaDB 10.2.3, MBREQUALS is a synonym for Equals.\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 (490,30,'INTERSECTS','Syntax\n------\n\nINTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nINTERSECTS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_INTERSECTS() uses object shapes.\n\nINTERSECTS() tests the opposite relationship to DISJOINT().\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 (491,30,'OVERLAPS','Syntax\n------\n\nOVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially overlaps g2. The term\nspatially overlaps is used if two geometries intersect and their intersection\nresults in a geometry of the same dimension but not equal to either of the\ngiven geometries.\n\nOVERLAPS() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_OVERLAPS() uses object shapes.\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 (492,30,'ST_CONTAINS','Syntax\n------\n\nST_CONTAINS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether a geometry g1 completely contains geometry\ng2.\n\nST_CONTAINS() uses object shapes, while CONTAINS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_CONTAINS tests the opposite relationship to ST_WITHIN().\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (493,30,'ST_CROSSES','Syntax\n------\n\nST_CROSSES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 if geometry g1 spatially crosses geometry g2. Returns NULL if g1 is\na Polygon or a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\n* The two geometries intersect\n* Their intersection results in a geometry that has a dimension that is one\n less than the maximum dimension of the two given geometries\n* Their intersection is not equal to either of the two given geometries\n\nST_CROSSES() uses object shapes, while CROSSES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'LINESTRING(174 149, 176 151)\');\n\nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (494,30,'ST_DIFFERENCE','Syntax\n------\n\nST_DIFFERENCE(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry representing the point set difference of the given geometry\nvalues.\n\nExample\n-------\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\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 (495,30,'ST_DISJOINT','Syntax\n------\n\nST_DISJOINT(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially disjoint from\n(does not intersect with) geometry g2.\n\nST_DISJOINT() uses object shapes, while DISJOINT(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_DISJOINT() tests the opposite relationship to ST_INTERSECTS().\n\nExamples\n--------\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\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 (496,30,'ST_DISTANCE','Syntax\n------\n\nST_DISTANCE(g1,g2)\n\nDescription\n-----------\n\nReturns the distance between two geometries, or null if not given valid inputs.\n\nExample\n-------\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\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 (497,30,'ST_DISTANCE_SPHERE','MariaDB starting with 10.2.38\n-----------------------------\nST_DISTANCE_SPHERE was introduced in MariaDB 10.2.38, MariaDB 10.3.29, MariaDB\n10.4.19 and MariaDB 10.5.10.\n\nSyntax\n------\n\nST_DISTANCE_SPHERE(g1,g2,[r])\n\nDescription\n-----------\n\nReturns the spherical distance between two geometries (point or multipoint) on\na sphere with the optional radius r (default is the Earth radius if r is not\nspecified), or NULL if not given valid inputs.\n\nExample\n-------\n\nset @zenica = ST_GeomFromText(\'POINT(17.907743 44.203438)\');\nset @sarajevo = ST_GeomFromText(\'POINT(18.413076 43.856258)\');\nSELECT ST_Distance_Sphere(@zenica, @sarajevo);\n55878.59337591705\n\nURL: https://mariadb.com/kb/en/st_distance_sphere/','','https://mariadb.com/kb/en/st_distance_sphere/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,30,'ST_EQUALS','Syntax\n------\n\nST_EQUALS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially equal to geometry\ng2.\n\nST_EQUALS() uses object shapes, while EQUALS(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\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\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 (499,30,'ST_INTERSECTS','Syntax\n------\n\nST_INTERSECTS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially intersects geometry\ng2.\n\nST_INTERSECTS() uses object shapes, while INTERSECTS(), based on the original\nMySQL implementation, uses object bounding rectangles.\n\nST_INTERSECTS() tests the opposite relationship to ST_DISJOINT().\n\nExamples\n--------\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\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 (500,30,'ST_LENGTH','Syntax\n------\n\nST_LENGTH(ls)\n\nDescription\n-----------\n\nReturns as a double-precision number the length of the LineString value ls in\nits associated spatial reference.\n\nExamples\n--------\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\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 (501,30,'ST_OVERLAPS','Syntax\n------\n\nST_OVERLAPS(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially overlaps geometry g2.\n\nThe term spatially overlaps is used if two geometries intersect and their\nintersection results in a geometry of the same dimension but not equal to\neither of the given geometries.\n\nST_OVERLAPS() uses object shapes, while OVERLAPS(), based on the original\nMySQL implementation, uses object bounding rectangles.\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 (502,30,'ST_TOUCHES','Syntax\n------\n\nST_TOUCHES(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 spatially touches geometry g2.\nTwo geometries spatially touch if the interiors of the geometries do not\nintersect, but the boundary of one of the geometries intersects either the\nboundary or the interior of the other.\n\nST_TOUCHES() uses object shapes, while TOUCHES(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\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\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 (503,30,'ST_WITHIN','Syntax\n------\n\nST_WITHIN(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether geometry g1 is spatially within geometry g2.\n\nThis tests the opposite relationship as ST_CONTAINS().\n\nST_WITHIN() uses object shapes, while WITHIN(), based on the original MySQL\nimplementation, uses object bounding rectangles.\n\nExamples\n--------\n\nSET @g1 = ST_GEOMFROMTEXT(\'POINT(174 149)\');\n\nSET @g2 = ST_GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 175\n150))\');\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\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 (504,30,'TOUCHES','Syntax\n------\n\nTouches(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 spatially touches g2. Two geometries\nspatially touch if the interiors of the geometries do not intersect, but the\nboundary of one of the geometries intersects either the boundary or the\ninterior of the other.\n\nTOUCHES() is based on the original MySQL implementation and uses object\nbounding rectangles, while ST_TOUCHES() uses object shapes.\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 (505,30,'WITHIN','Syntax\n------\n\nWithin(g1,g2)\n\nDescription\n-----------\n\nReturns 1 or 0 to indicate whether g1 is spatially within g2. This tests the\nopposite relationship as Contains().\n\nWITHIN() is based on the original MySQL implementation, and uses object\nbounding rectangles, while ST_WITHIN() uses object shapes.\n\nExamples\n--------\n\nSET @g1 = GEOMFROMTEXT(\'POINT(174 149)\');\nSET @g2 = GEOMFROMTEXT(\'POINT(176 151)\');\nSET @g3 = GEOMFROMTEXT(\'POLYGON((175 150, 20 40, 50 60, 125 100, 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\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 (506,31,'Microseconds in MariaDB','The TIME, DATETIME, and TIMESTAMP types, along with the temporal functions,\nCAST and dynamic columns, support microseconds. The datetime precision of a\ncolumn can be specified when creating the table with CREATE TABLE, for example:\n\nCREATE TABLE example(\n col_microsec DATETIME(6),\n col_millisec TIME(3)\n);\n\nGenerally, the precision can be specified for any TIME, DATETIME, or TIMESTAMP\ncolumn, in parentheses, after the type name. The datetime precision specifies\nnumber of digits after the decimal dot and can be any integer number from 0 to\n6. If no precision is specified it is assumed to be 0, for backward\ncompatibility reasons.\n\nA datetime precision can be specified wherever a type name is used. For\nexample:\n\n* when declaring arguments of stored routines.\n* when specifying a return type of a stored function.\n* when declaring variables.\n* in a CAST function:create function example(x datetime(5)) returns time(4)\nbegin\n declare y timestamp(6);\n return cast(x as time(2));\nend;\n\n%f is used as the formatting option for microseconds in the STR_TO_DATE,\nDATE_FORMAT and FROM_UNIXTIME functions, for example:\n\nSELECT STR_TO_DATE(\'20200809 020917076\',\'%Y%m%d %H%i%s%f\');\n+-----------------------------------------------------+\n| STR_TO_DATE(\'20200809 020917076\',\'%Y%m%d %H%i%s%f\') |\n+-----------------------------------------------------+\n| 2020-08-09 02:09:17.076000 |\n+-----------------------------------------------------+\n\nAdditional Information\n----------------------\n\n* when comparing anything to a temporal value (DATETIME, TIME, DATE, or\nTIMESTAMP), both values are compared as temporal values, not as strings.\n* The INFORMATION_SCHEMA.COLUMNS table has a new column DATETIME_PRECISION\n* NOW(), CURTIME(), UTC_TIMESTAMP(), UTC_TIME(), CURRENT_TIME(),\nCURRENT_TIMESTAMP(), LOCALTIME() and LOCALTIMESTAMP() now accept datetime\nprecision as an optional argument. For example:SELECT CURTIME(4);\n--> 10:11:12.3456\n\n* TIME_TO_SEC() and UNIX_TIMESTAMP() preserve microseconds of the argument.\nThese functions will return a decimal number if the result non-zero datetime\nprecision and an integer otherwise (for backward compatibility).SELECT\nTIME_TO_SEC(\'10:10:10.12345\');\n--> 36610.12345\n\n* Current versions of this patch fix a bug in the following optimization: in\n certain queries with DISTINCT MariaDB can ignore this clause if it can\n prove that all result rows are unique anyway, for example, when a primary key\n is compared with a constant. Sometimes this optimization was applied\n incorrectly, though — for example, when comparing a\n string with a date constant. This is now fixed.\n* DATE_ADD() and DATE_SUB() functions can now take a TIME\n expression as an argument (not just DATETIME as before).SELECT\nTIME(\'10:10:10\') + INTERVAL 100 MICROSECOND;\n--> 10:10:10.000100\n\n* The event_time field in the mysql.general_log table and the start_time,\nquery_time, and lock_time fields in the mysql.slow_log table now store values\nwith microsecond precision.\n* This patch fixed a bug when comparing a temporal value using the BETWEEN\noperator and one of the operands is NULL.\n* The old syntax TIMESTAMP(N), where N is the display width, is no longer\nsupported. It was deprecated in MySQL 4.1.0 (released on\n 2003-04-03).\n* when a DATETIME value is compared to a TIME value, the latter is treated as\na full datetime with a zero date part, similar to comparing DATE to a\nDATETIME, or to comparing DECIMAL numbers.\n Earlier versions of MariaDB used to compare only the time part of both\noperands in such a case.\n* In MariaDB, an extra column TIME_MS has been added to the\nINFORMATION_SCHEMA.PROCESSLIST table, as well as to the output of SHOW FULL\nPROCESSLIST.\n\nNote: When you convert a temporal value to a value with a smaller precision,\nit will be truncated, not rounded. This is done to guarantee that the date\npart is not changed. For example:\n\nSELECT CAST(\'2009-12-31 23:59:59.998877\' as DATETIME(3));\n-> 2009-12-31 23:59:59.998\n\nMySQL 5.6 Microseconds\n----------------------\n\nMySQL 5.6 introduced microseconds using a slightly different implementation to\nMariaDB 5.3. Since MariaDB 10.1, MariaDB has defaulted to the MySQL format, by\nmeans of the --mysql56-temporal-format variable. The MySQL version requires\nslightly more storage but has some advantages in permitting the eventual\nsupport of negative dates, and in replication.\n\nURL: https://mariadb.com/kb/en/microseconds-in-mariadb/','','https://mariadb.com/kb/en/microseconds-in-mariadb/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (507,31,'Date and Time Units','The INTERVAL keyword can be used to add or subtract a time interval of time to\na DATETIME, DATE or TIME value.\n\nThe syntax is:\n\nINTERVAL time_quantity time_unit\n\nFor example, the SECOND unit is used below by the DATE_ADD() function:\n\nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\n+-------------------------------------------+\n| \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND |\n+-------------------------------------------+\n| 2009-01-01 00:00:00 |\n+-------------------------------------------+\n\nThe following units are valid:\n\n+---------------------+------------------------------------------------------+\n| Unit | Description |\n+---------------------+------------------------------------------------------+\n| MICROSECOND | Microseconds |\n+---------------------+------------------------------------------------------+\n| SECOND | Seconds |\n+---------------------+------------------------------------------------------+\n| MINUTE | Minutes |\n+---------------------+------------------------------------------------------+\n| HOUR | Hours |\n+---------------------+------------------------------------------------------+\n| DAY | Days |\n+---------------------+------------------------------------------------------+\n| WEEK | Weeks |\n+---------------------+------------------------------------------------------+\n| MONTH | Months |\n+---------------------+------------------------------------------------------+\n| QUARTER | Quarters |\n+---------------------+------------------------------------------------------+\n| YEAR | Years |\n+---------------------+------------------------------------------------------+\n| SECOND_MICROSECOND | Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| MINUTE_MICROSECOND | Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| MINUTE_SECOND | Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| HOUR_MICROSECOND | Hours.Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| HOUR_SECOND | Hours.Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| HOUR_MINUTE | Hours.Minutes |\n+---------------------+------------------------------------------------------+\n| DAY_MICROSECOND | Days Hours.Minutes.Seconds.Microseconds |\n+---------------------+------------------------------------------------------+\n| DAY_SECOND | Days Hours.Minutes.Seconds |\n+---------------------+------------------------------------------------------+\n| DAY_MINUTE | Days Hours.Minutes |\n+---------------------+------------------------------------------------------+\n| DAY_HOUR | Days Hours |\n+---------------------+------------------------------------------------------+\n| YEAR_MONTH | Years-Months |\n+---------------------+------------------------------------------------------+\n\nThe time units containing an underscore are composite; that is, they consist\nof multiple base time units. For base time units, time_quantity is an integer\nnumber. For composite units, the quantity must be expressed as a string with\nmultiple integer numbers separated by any punctuation character.\n\nExample of composite units:\n\nINTERVAL \'2:2\' YEAR_MONTH\nINTERVAL \'1:30:30\' HOUR_SECOND\nINTERVAL \'1!30!30\' HOUR_SECOND -- same as above\n\nTime units can be used in the following contexts:\n\n* after a + or a - operator;\n* with the following DATE or TIME functions: ADDDATE(), SUBDATE(), DATE_ADD(),\nDATE_SUB(), TIMESTAMPADD(), TIMESTAMPDIFF(), EXTRACT();\n* in the ON SCHEDULE clause of CREATE EVENT and ALTER EVENT.\n* when defining a partitioning BY SYSTEM_TIME\n\nURL: https://mariadb.com/kb/en/date-and-time-units/','','https://mariadb.com/kb/en/date-and-time-units/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (508,31,'ADD_MONTHS','MariaDB starting with 10.6.1\n----------------------------\nThe ADD_MONTHS function was introduced in MariaDB 10.6.1 to enhance Oracle\ncompatibility. Similar functionality can be achieved with the DATE_ADD\nfunction.\n\nSyntax\n------\n\nADD_MONTHS(date, months)\n\nDescription\n-----------\n\nADD_MONTHS adds an integer months to a given date (DATE, DATETIME or\nTIMESTAMP), returning the resulting date.\n\nmonths can be positive or negative.\n\nThe resulting day component will remain the same as that specified in date,\nunless the resulting month has fewer days than the day component of the given\ndate, in which case the day will be the last day of the resulting month.\n\nReturns NULL if given an invalid date, or a NULL argument.\n\nExamples\n--------\n\nSELECT ADD_MONTHS(\'2012-01-31\', 2);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', -5);\n+------------------------------+\n| ADD_MONTHS(\'2012-01-31\', -5) |\n+------------------------------+\n| 2011-08-31 |\n+------------------------------+\n\nSELECT ADD_MONTHS(\'2011-01-31\', 1);\n+-----------------------------+\n| ADD_MONTHS(\'2011-01-31\', 1) |\n+-----------------------------+\n| 2011-02-28 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 1);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 1) |\n+-----------------------------+\n| 2012-02-29 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 2);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 2) |\n+-----------------------------+\n| 2012-03-31 |\n+-----------------------------+\n\nSELECT ADD_MONTHS(\'2012-01-31\', 3);\n+-----------------------------+\n| ADD_MONTHS(\'2012-01-31\', 3) |\n+-----------------------------+\n| 2012-04-30 |\n+-----------------------------+\n\nURL: https://mariadb.com/kb/en/add_months/','','https://mariadb.com/kb/en/add_months/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (509,31,'ADDDATE','Syntax\n------\n\nADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, ADDDATE() is a\nsynonym for DATE_ADD(). The related function SUBDATE() is a synonym for\nDATE_SUB(). For information on the INTERVAL unit argument, see the discussion\nfor DATE_ADD().\n\nWhen invoked with the days form of the second argument, MariaDB treats it as\nan integer number of days to be added to expr.\n\nExamples\n--------\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| 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| 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\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 (510,31,'ADDTIME','Syntax\n------\n\nADDTIME(expr1,expr2)\n\nDescription\n-----------\n\nADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time or\ndatetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1:1:1.000002\');\n+---------------------------------------------------------+\n| ADDTIME(\'2007-12-31 23:59:59.999999\', \'1 1: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\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 (511,31,'CONVERT_TZ','Syntax\n------\n\nCONVERT_TZ(dt,from_tz,to_tz)\n\nDescription\n-----------\n\nCONVERT_TZ() converts a datetime value dt from the time zone given by from_tz\nto the time zone given by to_tz and returns the resulting value.\n\nIn order to use named time zones, such as GMT, MET or Africa/Johannesburg, the\ntime_zone tables must be loaded (see mysql_tzinfo_to_sql).\n\nNo conversion will take place if the value falls outside of the supported\nTIMESTAMP range (\'1970-01-01 00:00:01\' to \'2038-01-19 05:14:07\' UTC) when\nconverted from from_tz to UTC.\n\nThis function returns NULL if the arguments are invalid (or named time zones\nhave not been loaded).\n\nSee time zones for more information.\n\nExamples\n--------\n\nSELECT CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12:00:00\',\'+00:00\',\'+10:00\') |\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 12:00:00\',\'GMT\',\'Africa/Johannesburg\');\n+---------------------------------------------------------------+\n| CONVERT_TZ(\'2016-01-01 12: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 takes place:\n\nSELECT CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\');\n+-----------------------------------------------------+\n| CONVERT_TZ(\'1969-12-31 22:00:00\',\'+00:00\',\'+10:00\') |\n+-----------------------------------------------------+\n| 1969-12-31 22:00:00 |\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 (512,31,'CURDATE','Syntax\n------\n\nCURDATE()\nCURRENT_DATE\nCURRENT_DATE()\n\nDescription\n-----------\n\nCURDATE returns the current date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or numeric\ncontext.\n\nCURRENT_DATE and CURRENT_DATE() are synonyms.\n\nExamples\n--------\n\nSELECT CURDATE();\n+------------+\n| CURDATE() |\n+------------+\n| 2019-03-05 |\n+------------+\n\nIn a numeric context (note this is not performing date calculations):\n\nSELECT CURDATE() +0;\n+--------------+\n| CURDATE() +0 |\n+--------------+\n| 20190305 |\n+--------------+\n\nData calculation:\n\nSELECT CURDATE() - INTERVAL 5 DAY;\n+----------------------------+\n| CURDATE() - INTERVAL 5 DAY |\n+----------------------------+\n| 2019-02-28 |\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 (513,31,'CURRENT_DATE','Syntax\n------\n\nCURRENT_DATE, CURRENT_DATE()\n\nDescription\n-----------\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\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 (514,31,'CURRENT_TIME','Syntax\n------\n\nCURRENT_TIME\nCURRENT_TIME([precision])\n\nDescription\n-----------\n\nCURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME().\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 (515,31,'CURRENT_TIMESTAMP','Syntax\n------\n\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\n\nDescription\n-----------\n\nCURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().\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 (516,31,'CURTIME','Syntax\n------\n\nCURTIME([precision])\n\nDescription\n-----------\n\nReturns the current time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context. The\nvalue is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT CURTIME();\n+-----------+\n| CURTIME() |\n+-----------+\n| 12:45:39 |\n+-----------+\n\nSELECT CURTIME() + 0;\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\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 (517,31,'DATE FUNCTION','Syntax\n------\n\nDATE(expr)\n\nDescription\n-----------\n\nExtracts the date part of the date or datetime expression expr.\n\nExamples\n--------\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--------------\n\nUntil MariaDB 5.5.32, some versions of MariaDB returned 0000-00-00 when passed\nan invalid date. From 5.5.32, NULL is returned.\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 (518,31,'DATEDIFF','Syntax\n------\n\nDATEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nDATEDIFF() returns (expr1 – expr2) expressed as a value in days from one date\nto the other. expr1 and expr2 are date or date-and-time expressions. Only the\ndate parts of the values are used in the calculation.\n\nExamples\n--------\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| 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\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 (519,31,'DATE_ADD','Syntax\n------\n\nDATE_ADD(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a \"-\" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nExamples\n--------\n\nSELECT \'2008-12-31 23:59:59\' + INTERVAL 1 SECOND;\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| INTERVAL 1 DAY + \'2008-12-31\' |\n+-------------------------------+\n| 2009-01-01 |\n+-------------------------------+\n\nSELECT \'2005-01-01\' - INTERVAL 1 SECOND;\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\' MINUTE_SECOND);\n+---------------------------------------------------------------+\n| DATE_ADD(\'2100-12-31 23:59:59\', INTERVAL \'1:1\' MINUTE_SECOND) |\n+---------------------------------------------------------------+\n| 2101-01-01 00:01:00 |\n+---------------------------------------------------------------+\n\nSELECT DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\' DAY_HOUR);\n+------------------------------------------------------------+\n| DATE_ADD(\'1900-01-01 00:00:00\', INTERVAL \'-1 10\' DAY_HOUR) |\n+------------------------------------------------------------+\n| 1899-12-30 14:00:00 |\n+------------------------------------------------------------+\n\nSELECT DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL \'1.999999\'\nSECOND_MICROSECOND);\n+------------------------------------------------------------------------------\n-+\n| DATE_ADD(\'1992-12-31 23:59:59.000002\', INTERVAL \'1.999999\'\nSECOND_MICROSECOND) |\n+------------------------------------------------------------------------------\n-+\n| 1993-01-01 00:00:01.000001 \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 (520,31,'DATE_FORMAT','Syntax\n------\n\nDATE_FORMAT(date, format[, locale])\n\nDescription\n-----------\n\nFormats the date value according to the format string.\n\nThe language used for the names is controlled by the value of the\nlc_time_names system variable. See server locale for more on the supported\nlocales.\n\nThe options that can be used by DATE_FORMAT(), as well as its inverse\nSTR_TO_DATE() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Monday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nTo get a date in one of the standard formats, GET_FORMAT() can be used.\n\nExamples\n--------\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 %b %j\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1900-10-04 22:23:00\', \'%D %y %a %d %m %b %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 %S %w\');\n+------------------------------------------------------------+\n| DATE_FORMAT(\'1997-10-04 22:23:00\', \'%H %k %I %r %T %S %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\nMariaDB starting with 10.3.2\n----------------------------\nOptionally, the locale can be explicitly specified as the third DATE_FORMAT()\nargument. Doing so makes the function independent from the session settings,\nand the three argument version of DATE_FORMAT() can be used in virtual indexed\nand 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\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 (521,31,'DATE_SUB','Syntax\n------\n\nDATE_SUB(date,INTERVAL expr unit)\n\nDescription\n-----------\n\nPerforms date arithmetic. The date argument specifies the starting date or\ndatetime value. expr is an expression specifying the interval value to be\nadded or subtracted from the starting date. expr is a string; it may start\nwith a \"-\" for negative intervals. unit is a keyword indicating the units in\nwhich the expression should be interpreted. See Date and Time Units for a\ncomplete list of permitted units.\n\nSee also DATE_ADD().\n\nExamples\n--------\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 1:1:1\' DAY_SECOND);\n+----------------------------------------------------------------+\n| DATE_SUB(\'2005-01-01 00:00:00\', INTERVAL \'1 1:1:1\' DAY_SECOND) |\n+----------------------------------------------------------------+\n| 2004-12-30 22:58:59 |\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 (522,31,'DAY','Syntax\n------\n\nDAY(date)\n\nDescription\n-----------\n\nDAY() is a synonym for DAYOFMONTH().\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 (523,31,'DAYNAME','Syntax\n------\n\nDAYNAME(date)\n\nDescription\n-----------\n\nReturns the name of the weekday for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\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| 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\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 (524,31,'DAYOFMONTH','Syntax\n------\n\nDAYOFMONTH(date)\n\nDescription\n-----------\n\nReturns the day of the month for date, in the range 1 to 31, or 0 for dates\nsuch as \'0000-00-00\' or \'2008-00-00\' which have a zero day part.\n\nDAY() is a synonym.\n\nExamples\n--------\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| 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\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 (525,31,'DAYOFWEEK','Syntax\n------\n\nDAYOFWEEK(date)\n\nDescription\n-----------\n\nReturns the day of the week index for the date (1 = Sunday, 2 = Monday, ..., 7\n= Saturday). These index values correspond to the ODBC standard.\n\nThis contrasts with WEEKDAY() which follows a different index numbering (0 =\nMonday, 1 = Tuesday, ... 6 = Sunday).\n\nExamples\n--------\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| 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\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 (526,31,'DAYOFYEAR','Syntax\n------\n\nDAYOFYEAR(date)\n\nDescription\n-----------\n\nReturns the day of the year for date, in the range 1 to 366.\n\nExamples\n--------\n\nSELECT DAYOFYEAR(\'2018-02-16\');\n+-------------------------+\n| DAYOFYEAR(\'2018-02-16\') |\n+-------------------------+\n| 47 |\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 (527,31,'EXTRACT','Syntax\n------\n\nEXTRACT(unit FROM date)\n\nDescription\n-----------\n\nThe EXTRACT() function extracts the required unit from the date. See Date and\nTime Units for a complete list of permitted units.\n\nIn MariaDB 10.0.7 and MariaDB 5.5.35, EXTRACT (HOUR FROM ...) was changed to\nreturn a value from 0 to 23, adhering to the SQL standard. Until MariaDB\n10.0.6 and MariaDB 5.5.34, and in all versions of MySQL at least as of MySQL\n5.7, it could return a value > 23. HOUR() is not a standard function, so\ncontinues to adhere to the old behaviour inherited from MySQL.\n\nExamples\n--------\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 10: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 FROM...) returns a value\nfrom 0 to 23, as per the SQL standard. HOUR is not a standard function, so\ncontinues to adhere 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\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 (528,31,'FROM_DAYS','Syntax\n------\n\nFROM_DAYS(N)\n\nDescription\n-----------\n\nGiven a day number N, returns a DATE value. The day count is based on the\nnumber of days from the start of the standard calendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the\nGregorian calendar in October 1582. Results will not be reliable since it\ndoesn\'t account for the lost days when the calendar changed from the Julian\ncalendar.\n\nThis is the converse of the TO_DAYS() function.\n\nExamples\n--------\n\nSELECT FROM_DAYS(730669);\n+-------------------+\n| FROM_DAYS(730669) |\n+-------------------+\n| 2000-07-03 |\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 (529,31,'FROM_UNIXTIME','Syntax\n------\n\nFROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)\n\nDescription\n-----------\n\nReturns a representation of the unix_timestamp argument as a value in\n\'YYYY-MM-DD HH:MM:SS\' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether\nthe function is used in a string or numeric context. The value is expressed in\nthe current time zone. unix_timestamp is an internal timestamp value such as\nis produced by the UNIX_TIMESTAMP() function.\n\nIf format is given, the result is formatted according to the format string,\nwhich is used the same way as listed in the entry for the DATE_FORMAT()\nfunction.\n\nTimestamps in MariaDB have a maximum value of 2147483647, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a timestamp beyond this will result in NULL being returned.\nUse DATETIME as a storage type if you require dates beyond this.\n\nThe options that can be used by FROM_UNIXTIME(), as well as DATE_FORMAT() and\nSTR_TO_DATE(), are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Sunday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nPerformance Considerations\n--------------------------\n\nIf your session time zone is set to SYSTEM (the default), FROM_UNIXTIME() will\ncall the OS function to convert the data using the system time zone. At least\non Linux, the corresponding function (localtime_r) uses a global mutex inside\nglibc that can cause contention under high concurrent load.\n\nSet your time zone to a named time zone to avoid this issue. See mysql time\nzone tables for details on how to do this.\n\nExamples\n--------\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| FROM_UNIXTIME(1196440219) + 0 |\n+-------------------------------+\n| 20071130113019.000000 |\n+-------------------------------+\n\nSELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\');\n+---------------------------------------------------------+\n| FROM_UNIXTIME(UNIX_TIMESTAMP(), \'%Y %D %M %h:%i:%s %x\') |\n+---------------------------------------------------------+\n| 2010 27th March 01:03:47 2010 |\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 (530,31,'GET_FORMAT','Syntax\n------\n\nGET_FORMAT({DATE|DATETIME|TIME}, {\'EUR\'|\'USA\'|\'JIS\'|\'ISO\'|\'INTERNAL\'})\n\nDescription\n-----------\n\nReturns a format string. This function is useful in combination with the\nDATE_FORMAT() and the STR_TO_DATE() functions.\n\nPossible result formats are:\n\n+--------------------------------------+--------------------------------------+\n| Function Call | Result Format |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'EUR\') | \'%d.%m.%Y\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'USA\') | \'%m.%d.%Y\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'JIS\') | \'%Y-%m-%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'ISO\') | \'%Y-%m-%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATE,\'INTERNAL\') | \'%Y%m%d\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'EUR\') | \'%Y-%m-%d %H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'USA\') | \'%Y-%m-%d %H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'JIS\') | \'%Y-%m-%d %H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'ISO\') | \'%Y-%m-%d %H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(DATETIME,\'INTERNAL\') | \'%Y%m%d%H%i%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'EUR\') | \'%H.%i.%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'USA\') | \'%h:%i:%s %p\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'JIS\') | \'%H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'ISO\') | \'%H:%i:%s\' |\n+--------------------------------------+--------------------------------------+\n| GET_FORMAT(TIME,\'INTERNAL\') | \'%H%i%s\' |\n+--------------------------------------+--------------------------------------+\n\nExamples\n--------\n\nObtaining the string matching to the standard European date format:\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\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 (531,31,'HOUR','Syntax\n------\n\nHOUR(time)\n\nDescription\n-----------\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much larger,\nso HOUR can return values greater than 23.\n\nThe return value is always positive, even if a negative TIME value is provided.\n\nExamples\n--------\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 10.0.7 and MariaDB\n5.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\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 (532,31,'LAST_DAY','Syntax\n------\n\nLAST_DAY(date)\n\nDescription\n-----------\n\nTakes a date or datetime value and returns the corresponding value for the\nlast day of the month. Returns NULL if the argument is invalid.\n\nExamples\n--------\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: \'2003-03-32\'\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 (533,31,'LOCALTIME','Syntax\n------\n\nLOCALTIME\nLOCALTIME([precision])\n\nDescription\n-----------\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\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 (534,31,'LOCALTIMESTAMP','Syntax\n------\n\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nLOCALTIMESTAMP and LOCALTIMESTAMP() are synonyms for NOW().\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 (535,31,'MAKEDATE','Syntax\n------\n\nMAKEDATE(year,dayofyear)\n\nDescription\n-----------\n\nReturns a date, given year and day-of-year values. dayofyear must be greater\nthan 0 or the result is NULL.\n\nExamples\n--------\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\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 (536,31,'MAKETIME','Syntax\n------\n\nMAKETIME(hour,minute,second)\n\nDescription\n-----------\n\nReturns a time value calculated from the hour, minute, and second arguments.\n\nIf minute or second are out of the range 0 to 60, NULL is returned. The hour\ncan be in the range -838 to 838, outside of which the value is truncated with\na warning.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+-----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'-1000:57:33\' |\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 (537,31,'MICROSECOND','Syntax\n------\n\nMICROSECOND(expr)\n\nDescription\n-----------\n\nReturns the microseconds from the time or datetime expression expr as a number\nin the range from 0 to 999999.\n\nIf expr is a time with no microseconds, zero is returned, while if expr is a\ndate with no time, zero with a warning is returned.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+----------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'2013-08-07\' |\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 (538,31,'MINUTE','Syntax\n------\n\nMINUTE(time)\n\nDescription\n-----------\n\nReturns the minute for time, in the range 0 to 59.\n\nExamples\n--------\n\nSELECT MINUTE(\'2013-08-03 11:04:03\');\n+-------------------------------+\n| MINUTE(\'2013-08-03 11:04:03\') |\n+-------------------------------+\n| 4 |\n+-------------------------------+\n\nSELECT MINUTE (\'23:12:50\');\n+---------------------+\n| MINUTE (\'23:12:50\') |\n+---------------------+\n| 12 |\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 (539,31,'MONTH','Syntax\n------\n\nMONTH(date)\n\nDescription\n-----------\n\nReturns the month for date in the range 1 to 12 for January to December, or 0\nfor dates such as \'0000-00-00\' or \'2008-00-00\' that have a zero month part.\n\nExamples\n--------\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\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 (540,31,'MONTHNAME','Syntax\n------\n\nMONTHNAME(date)\n\nDescription\n-----------\n\nReturns the full name of the month for date. The language used for the name is\ncontrolled by the value of the lc_time_names system variable. See server\nlocale for more on the supported locales.\n\nExamples\n--------\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\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 (541,31,'NOW','Syntax\n------\n\nNOW([precision])\nCURRENT_TIMESTAMP\nCURRENT_TIMESTAMP([precision])\nLOCALTIME, LOCALTIME([precision])\nLOCALTIMESTAMP\nLOCALTIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context. The value is expressed in the current time zone.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nNOW() (or its synonyms) can be used as the default value for TIMESTAMP columns\nas well as, since MariaDB 10.0.1, DATETIME columns. Before MariaDB 10.0.1, it\nwas only possible for a single TIMESTAMP column per table to contain the\nCURRENT_TIMESTAMP as its default.\n\nWhen displayed in the INFORMATION_SCHEMA.COLUMNS table, a default CURRENT\nTIMESTAMP is displayed as CURRENT_TIMESTAMP up until MariaDB 10.2.2, and as\ncurrent_timestamp() from MariaDB 10.2.3, due to to MariaDB 10.2 accepting\nexpressions in the DEFAULT clause.\n\nExamples\n--------\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2010-03-27 13:13:25 |\n+---------------------+\n\nSELECT NOW() + 0;\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 CURRENT_TIMESTAMP);\n\nFrom MariaDB 10.2.2:\n\nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row ***************************\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<= MariaDB 10.2.1\n\nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=\'test\'\n AND COLUMN_NAME LIKE \'%ts%\'\\G\n*************************** 1. row ***************************\n TABLE_CATALOG: def\n TABLE_SCHEMA: test\n TABLE_NAME: t\n COLUMN_NAME: createdTS\n ORDINAL_POSITION: 1\n COLUMN_DEFAULT: CURRENT_TIMESTAMP\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 (542,31,'PERIOD_ADD','Syntax\n------\n\nPERIOD_ADD(P,N)\n\nDescription\n-----------\n\nAdds N months to period P. P is in the format YYMM or YYYYMM, and is not a\ndate value. If P contains a two-digit year, values from 00 to 69 are converted\nto from 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nReturns a value in the format YYYYMM.\n\nExamples\n--------\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\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 (543,31,'PERIOD_DIFF','Syntax\n------\n\nPERIOD_DIFF(P1,P2)\n\nDescription\n-----------\n\nReturns the number of months between periods P1 and P2. P1 and P2 can be in\nthe format YYMM or YYYYMM, and are not date values.\n\nIf P1 or P2 contains a two-digit year, values from 00 to 69 are converted to\nfrom 2000 to 2069, while values from 70 are converted to 1970 upwards.\n\nExamples\n--------\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\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 (544,31,'QUARTER','Syntax\n------\n\nQUARTER(date)\n\nDescription\n-----------\n\nReturns the quarter of the year for date, in the range 1 to 4. Returns 0 if\nmonth contains a zero value, or NULL if the given value is not otherwise a\nvalid date (zero values are accepted).\n\nExamples\n--------\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\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 (545,31,'SECOND','Syntax\n------\n\nSECOND(time)\n\nDescription\n-----------\n\nReturns the second for a given time (which can include microseconds), in the\nrange 0 to 59, or NULL if not given a valid time value.\n\nExamples\n--------\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\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 (546,31,'SEC_TO_TIME','Syntax\n------\n\nSEC_TO_TIME(seconds)\n\nDescription\n-----------\n\nReturns the seconds argument, converted to hours, minutes, and seconds, as a\nTIME value. The range of the result is constrained to that of the TIME data\ntype. A warning occurs if the argument corresponds to a value outside that\nrange.\n\nThe time will be returned in the format hh:mm:ss, or hhmmss if used in a\nnumeric calculation.\n\nExamples\n--------\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| 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| Level | Code | Message |\n+---------+------+-------------------------------------------+\n| Warning | 1292 | Truncated incorrect time value: \'9999999\' |\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 (547,31,'STR_TO_DATE','Syntax\n------\n\nSTR_TO_DATE(str,format)\n\nDescription\n-----------\n\nThis is the inverse of the DATE_FORMAT() function. It takes a string str and a\nformat string format. STR_TO_DATE() returns a DATETIME value if the format\nstring contains both date and time parts, or a DATE or TIME value if the\nstring contains only date or time parts.\n\nThe date, time, or datetime values contained in str should be given in the\nformat indicated by format. If str contains an illegal date, time, or datetime\nvalue, STR_TO_DATE() returns NULL. An illegal value also produces a warning.\n\nThe options that can be used by STR_TO_DATE(), as well as its inverse\nDATE_FORMAT() and the FROM_UNIXTIME() function, are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| %a | Short weekday name in current locale |\n| | (Variable lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %b | Short form month name in current locale. For |\n| | locale en_US this is one of: |\n| | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov |\n| | 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 | Microseconds 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 |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %m | Month with 2 digits. |\n+---------------------------+------------------------------------------------+\n| %p | AM/PM according to current locale (Variable |\n| | lc_time_names). |\n+---------------------------+------------------------------------------------+\n| %r | Time in 12 hour format, followed by AM/PM. |\n| | Short for \'%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 |\n| | week is Sunday. |\n+---------------------------+------------------------------------------------+\n| %u | Week number (00-53), when first day of the |\n| | week is Monday. |\n+---------------------------+------------------------------------------------+\n| %V | Week number (01-53), when first day of the |\n| | week is Sunday. Used with %X. |\n+---------------------------+------------------------------------------------+\n| %v | Week number (01-53), when first day of the |\n| | week is Monday. Used with %x. |\n+---------------------------+------------------------------------------------+\n| %W | Full weekday name in current locale (Variable |\n| | lc_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 |\n| | is Sunday. Used with %V. |\n+---------------------------+------------------------------------------------+\n| %x | Year with 4 digits when first day of the week |\n| | is Monday. 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 |\n| | characters. |\n+---------------------------+------------------------------------------------+\n| %@ | For str_to_date(), skip all alpha characters. |\n+---------------------------+------------------------------------------------+\n| %% | A literal % character. |\n+---------------------------+------------------------------------------------+\n\nExamples\n--------\n\nSELECT STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e, %Y\');\n+---------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday, June 2, 2014\', \'%W, %M %e, %Y\') |\n+---------------------------------------------------------+\n| 2014-06-02 |\n+---------------------------------------------------------+\n\nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e, %Y\');\n+--------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W, %M %e, %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+---------+------+-------------------------------------------------------------\n---------------------+\n| Warning | 1411 | Incorrect datetime value: \'Wednesday23423, June 2, 2014\'\nfor function str_to_date |\n+---------+------+-------------------------------------------------------------\n---------------------+\n\nSELECT STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M %e, %Y\');\n+----------------------------------------------------------------+\n| STR_TO_DATE(\'Wednesday23423, June 2, 2014\', \'%W%#, %M %e, %Y\') |\n+----------------------------------------------------------------+\n| 2014-06-02 |\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 (548,31,'SUBDATE','Syntax\n------\n\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nDescription\n-----------\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE() is a\nsynonym for DATE_SUB(). See Date and Time Units for a complete list of\npermitted units.\n\nThe second form allows the use of an integer value for days. In such cases, it\nis interpreted as the number of days to be subtracted from the date or\ndatetime expression expr.\n\nExamples\n--------\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| 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| 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\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 (549,31,'SUBTIME','Syntax\n------\n\nSUBTIME(expr1,expr2)\n\nDescription\n-----------\n\nSUBTIME() returns expr1 - expr2 expressed as a value in the same format as\nexpr1. expr1 is a time or datetime expression, and expr2 is a time expression.\n\nExamples\n--------\n\nSELECT SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\');\n+--------------------------------------------------------+\n| SUBTIME(\'2007-12-31 23:59:59.999999\',\'1 1:1:1.000002\') |\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\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 (550,31,'SYSDATE','Syntax\n------\n\nSYSDATE([precision])\n\nDescription\n-----------\n\nReturns the current date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nSYSDATE() returns the time at which it executes. This differs from the\nbehavior for NOW(), which returns a constant time that indicates the time at\nwhich the statement began to execute. (Within a stored routine or trigger,\nNOW() returns the time at which the routine or triggering statement began to\nexecute.)\n\nIn addition, changing the timestamp system variable with a SET timestamp\nstatement affects the value returned by NOW() but not by SYSDATE(). This means\nthat timestamp settings in the binary log have no effect on invocations of\nSYSDATE().\n\nBecause SYSDATE() can return different values even within the same statement,\nand is not affected by SET TIMESTAMP, it is non-deterministic and therefore\nunsafe for replication if statement-based binary logging is used. If that is a\nproblem, you can use row-based logging, or start the server with the mysqld\noption --sysdate-is-now to cause SYSDATE() to be an alias for NOW(). The\nnon-deterministic nature of SYSDATE() also means that indexes cannot be used\nfor evaluating expressions that refer to it, and that statements using the\nSYSDATE() function are unsafe for statement-based replication.\n\nExamples\n--------\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\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 (551,31,'TIME Function','Syntax\n------\n\nTIME(expr)\n\nDescription\n-----------\n\nExtracts the time part of the time or datetime expression expr and returns it\nas a string.\n\nExamples\n--------\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\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 (552,31,'TIMEDIFF','Syntax\n------\n\nTIMEDIFF(expr1,expr2)\n\nDescription\n-----------\n\nTIMEDIFF() returns expr1 - expr2 expressed as a time value. expr1 and expr2\nare time or date-and-time expressions, but both must be of the same type.\n\nExamples\n--------\n\nSELECT TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01 00:00:00.000001\');\n+---------------------------------------------------------------+\n| TIMEDIFF(\'2000:01:01 00:00:00\', \'2000:01:01 00:00:00.000001\') |\n+---------------------------------------------------------------+\n| -00:00:00.000001 |\n+---------------------------------------------------------------+\n\nSELECT TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30 01:01:01.000002\');\n+----------------------------------------------------------------------+\n| TIMEDIFF(\'2008-12-31 23:59:59.000001\', \'2008-12-30 01:01:01.000002\') |\n+----------------------------------------------------------------------+\n| 46:58:57.999999 |\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 (553,31,'TIMESTAMP FUNCTION','Syntax\n------\n\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nDescription\n-----------\n\nWith a single argument, this function returns the date or datetime expression\nexpr as a datetime value. With two arguments, it adds the time expression\nexpr2 to the date or datetime expression expr1 and returns the result as a\ndatetime value.\n\nExamples\n--------\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\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 (554,31,'TIMESTAMPADD','Syntax\n------\n\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nDescription\n-----------\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument, which\nshould be one of the following values: MICROSECOND, SECOND, MINUTE, HOUR, DAY,\nWEEK, MONTH, QUARTER, or YEAR.\n\nThe unit value may be specified using one of keywords as shown, or with a\nprefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nBefore MariaDB 5.5, FRAC_SECOND was permitted as a synonym for MICROSECOND.\n\nExamples\n--------\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\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 (555,31,'TIMESTAMPDIFF','Syntax\n------\n\nTIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)\n\nDescription\n-----------\n\nReturns datetime_expr2 - datetime_expr1, where datetime_expr1 and\ndatetime_expr2 are date or datetime expressions. One expression may be a date\nand the other a datetime; a date value is treated as a datetime having the\ntime part \'00:00:00\' where necessary. The unit for the result (an integer) is\ngiven by the unit argument. The legal values for unit are the same as those\nlisted in the description of the TIMESTAMPADD() function, i.e MICROSECOND,\nSECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.\n\nTIMESTAMPDIFF can also be used to calculate age.\n\nExamples\n--------\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 12:05:55\');\n+----------------------------------------------------------+\n| TIMESTAMPDIFF(MINUTE,\'2003-02-01\',\'2003-05-01 12: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 age;\n+------+\n| age |\n+------+\n| 47 |\n+------+\n\nSELECT TIMESTAMPDIFF(YEAR, \'1971-05-06\', CURDATE()) AS age;\n+------+\n| age |\n+------+\n| 48 |\n+------+\n\nAge as of 2014-08-02:\n\nSELECT name, date_of_birth, TIMESTAMPDIFF(YEAR,date_of_birth,\'2014-08-02\') AS\nage \n FROM student_details;\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\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 (556,31,'TIME_FORMAT','Syntax\n------\n\nTIME_FORMAT(time,format)\n\nDescription\n-----------\n\nThis is used like the DATE_FORMAT() function, but the format string may\ncontain format specifiers only for hours, minutes, and seconds. Other\nspecifiers produce a NULL value or 0.\n\nExamples\n--------\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\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 (557,31,'TIME_TO_SEC','Syntax\n------\n\nTIME_TO_SEC(time)\n\nDescription\n-----------\n\nReturns the time argument, converted to seconds.\n\nThe value returned by TIME_TO_SEC is of type DOUBLE. Before MariaDB 5.3 (and\nMySQL 5.6), the type was INT. The returned value preserves microseconds of the\nargument. See also Microseconds in MariaDB.\n\nExamples\n--------\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\nSELECT TIME_TO_SEC(\'09:12:55.2355\');\n+------------------------------+\n| TIME_TO_SEC(\'09:12:55.2355\') |\n+------------------------------+\n| 33175.2355 |\n+------------------------------+\n1 row in set (0.000 sec)\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 (558,31,'TO_DAYS','Syntax\n------\n\nTO_DAYS(date)\n\nDescription\n-----------\n\nGiven a date date, returns the number of days since the start of the current\ncalendar (0000-00-00).\n\nThe function is not designed for use with dates before the advent of the\nGregorian calendar in October 1582. Results will not be reliable since it\ndoesn\'t account for the lost days when the calendar changed from the Julian\ncalendar.\n\nThis is the converse of the FROM_DAYS() function.\n\nExamples\n--------\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\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 (559,31,'TO_SECONDS','Syntax\n------\n\nTO_SECONDS(expr)\n\nDescription\n-----------\n\nReturns the number of seconds from year 0 till expr, or NULL if expr is not a\nvalid date or datetime.\n\nExamples\n--------\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\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 (560,31,'UNIX_TIMESTAMP','Syntax\n------\n\nUNIX_TIMESTAMP()\nUNIX_TIMESTAMP(date)\n\nDescription\n-----------\n\nIf called with no argument, returns a Unix timestamp (seconds since\n\'1970-01-01 00:00:00\' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is\ncalled with a date argument, it returns the value of the argument as seconds\nsince \'1970-01-01 00:00:00\' UTC. date may be a DATE string, a DATETIME string,\na TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server\ninterprets date as a value in the current time zone and converts it to an\ninternal value in UTC. Clients can set their time zone as described in time\nzones.\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, equivalent to\n2038-01-19 05:14:07. This is due to the underlying 32-bit limitation. Using\nthe function on a date beyond this will result in NULL being returned. Use\nDATETIME as a storage type if you require dates beyond this.\n\nError Handling\n--------------\n\nReturns NULL for wrong arguments to UNIX_TIMESTAMP(). In MySQL and MariaDB\nbefore 5.3 wrong arguments to UNIX_TIMESTAMP() returned 0.\n\nCompatibility\n-------------\n\nAs you can see in the examples above, UNIX_TIMESTAMP(constant-date-string)\nreturns a timestamp with 6 decimals while MariaDB 5.2 and before returns it\nwithout decimals. This can cause a problem if you are using UNIX_TIMESTAMP()\nas a partitioning function. You can fix this by using\nFLOOR(UNIX_TIMESTAMP(..)) or changing the date string to a date number, like\n20080101000000.\n\nExamples\n--------\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 10: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 10:30:19\')));\n+-------------------------------------------------------------+\n| FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(\'2007-11-30 10:30:19\'))) |\n+-------------------------------------------------------------+\n| 2007-11-30 10:30:19 |\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 (561,31,'UTC_DATE','Syntax\n------\n\nUTC_DATE, UTC_DATE()\n\nDescription\n-----------\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD format,\ndepending on whether the function is used in a string or numeric context.\n\nExamples\n--------\n\nSELECT UTC_DATE(), UTC_DATE() + 0;\n+------------+----------------+\n| UTC_DATE() | UTC_DATE() + 0 |\n+------------+----------------+\n| 2010-03-27 | 20100327 |\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 (562,31,'UTC_TIME','Syntax\n------\n\nUTC_TIME\nUTC_TIME([precision])\n\nDescription\n-----------\n\nReturns the current UTC time as a value in \'HH:MM:SS\' or HHMMSS.uuuuuu format,\ndepending on whether the function is used in a string or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIME(), UTC_TIME() + 0;\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\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 (563,31,'UTC_TIMESTAMP','Syntax\n------\n\nUTC_TIMESTAMP\nUTC_TIMESTAMP([precision])\n\nDescription\n-----------\n\nReturns the current UTC date and time as a value in \'YYYY-MM-DD HH:MM:SS\' or\nYYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a\nstring or numeric context.\n\nThe optional precision determines the microsecond precision. See Microseconds\nin MariaDB.\n\nExamples\n--------\n\nSELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;\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\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 (564,31,'WEEK','Syntax\n------\n\nWEEK(date[,mode])\n\nDescription\n-----------\n\nThis function returns the week number for date. The two-argument form of\nWEEK() allows you to specify whether the week starts on Sunday or Monday and\nwhether the return value should be in the range from 0 to 53 or from 1 to 53.\nIf the mode argument is omitted, the value of the default_week_format system\nvariable is used.\n\nModes\n-----\n\n+-------+---------------------+--------+------------------------------------+\n| Mode | 1st day of week | Range | Week 1 is the 1st week with |\n+-------+---------------------+--------+------------------------------------+\n| 0 | Sunday | 0-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 1 | Monday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 2 | Sunday | 1-53 | a Sunday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 3 | Monday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 4 | Sunday | 0-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 5 | Monday | 0-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n| 6 | Sunday | 1-53 | more than 3 days this year |\n+-------+---------------------+--------+------------------------------------+\n| 7 | Monday | 1-53 | a Monday in this year |\n+-------+---------------------+--------+------------------------------------+\n\nWith the mode value of 3, which means \'more than 3 days this year\', weeks are\nnumbered according to ISO 8601:1988.\n\nExamples\n--------\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\nSELECT WEEK(\'2019-12-30\',3);\n+----------------------+\n| WEEK(\'2019-12-30\',3) |\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, WEEK(d,0), WEEK(d,1) from t1;\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\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 (565,31,'WEEKDAY','Syntax\n------\n\nWEEKDAY(date)\n\nDescription\n-----------\n\nReturns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).\n\nThis contrasts with DAYOFWEEK() which follows the ODBC standard (1 = Sunday, 2\n= Monday, ..., 7 = Saturday).\n\nExamples\n--------\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| d |\n+---------------------+\n| 2011-10-30 06:31:41 |\n| 2011-01-30 14:03:25 |\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 (566,31,'WEEKOFYEAR','Syntax\n------\n\nWEEKOFYEAR(date)\n\nDescription\n-----------\n\nReturns the calendar week of the date as a number in the range from 1 to 53.\nWEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3).\n\nExamples\n--------\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\nselect * from t1;\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| 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\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 (567,31,'YEAR','Syntax\n------\n\nYEAR(date)\n\nDescription\n-----------\n\nReturns the year for the given date, in the range 1000 to 9999, or 0 for the\n\"zero\" date.\n\nExamples\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| 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| 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\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 (568,31,'YEARWEEK','Syntax\n------\n\nYEARWEEK(date), YEARWEEK(date,mode)\n\nDescription\n-----------\n\nReturns year and week for a date. The mode argument works exactly like the\nmode argument to WEEK(). The year in the result may be different from the year\nin the date argument for the first and the last week of the year.\n\nExamples\n--------\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| 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| YEARWEEK(d) |\n+-------------+\n| 201116 |\n| 201144 |\n| 201105 |\n+-------------+\n3 rows in set (0.03 sec)\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 (569,32,'Well-Known Binary (WKB) Format','WKB stands for Well-Known Binary, a format for representing geographical and\ngeometrical data.\n\nWKB uses 1-byte unsigned integers, 4-byte unsigned integers, and 8-byte\ndouble-precision numbers.\n\n* The first byte indicates the byte order. 00 for big endian, or 01 for little\nendian.\n* The next 4 bytes indicate the geometry type. Values from 1 to 7 indicate\nwhether the type is Point, LineString, Polygon, MultiPoint, MultiLineString,\nMultiPolygon, or GeometryCollection respectively. \n* The 8-byte floats represent the co-ordinates.\n\nTake the following example, a sequence of 21 bytes each represented by two hex\ndigits:\n\n000000000140000000000000004010000000000000\n\n* It\'s big endian\n000000000140000000000000004010000000000000\n\n* It\'s a POINT\n000000000140000000000000004010000000000000\n\n* The X co-ordinate is 2.0\n000000000140000000000000004010000000000000\n\n* The Y-co-ordinate is 4.0\n000000000140000000000000004010000000000000\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 (570,32,'AsBinary','A synonym for ST_AsBinary().\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 (571,32,'AsWKB','A synonym for ST_AsBinary().\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 (572,32,'MLineFromWKB','Syntax\n------\n\nMLineFromWKB(wkb[,srid])\nMultiLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTILINESTRING value using its WKB representation and SRID.\n\nMLineFromWKB() and MultiLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16\n0,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\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 (573,32,'MPointFromWKB','Syntax\n------\n\nMPointFromWKB(wkb[,srid])\nMultiPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOINT value using its WKB representation and SRID.\n\nMPointFromWKB() and MultiPointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(\'MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4,\n6 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\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 (574,32,'MPolyFromWKB','Syntax\n------\n\nMPolyFromWKB(wkb[,srid])\nMultiPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a MULTIPOLYGON value using its WKB representation and SRID.\n\nMPolyFromWKB() and MultiPolygonFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(MPointFromText(\'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 13,59 18)))\'));\n\nSELECT ST_AsText(MPolyFromWKB(@g))\\G\n*************************** 1. row ***************************\nST_AsText(MPolyFromWKB(@g)): MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\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 (575,32,'GeomCollFromWKB','A synonym for ST_GeomCollFromWKB.\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 (576,32,'GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\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 (577,32,'GeometryFromWKB','A synonym for ST_GeomFromWKB.\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 (578,32,'GeomFromWKB','A synonym for ST_GeomFromWKB.\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 (579,32,'LineFromWKB','A synonym for ST_LineFromWKB.\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 (580,32,'LineStringFromWKB','A synonym for ST_LineFromWKB.\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 (581,32,'MultiLineStringFromWKB','A synonym for MLineFromWKB().\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 (582,32,'MultiPointFromWKB','A synonym for MPointFromWKB.\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 (583,32,'MultiPolygonFromWKB','Synonym for MPolyFromWKB.\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 (584,32,'PointFromWKB','A synonym for ST_PointFromWKB.\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 (585,32,'PolyFromWKB','A synonym for ST_PolyFromWKB.\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 (586,32,'PolygonFromWKB','A synonym for ST_PolyFromWKB.\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 (587,32,'ST_AsBinary','Syntax\n------\n\nST_AsBinary(g)\nAsBinary(g)\nST_AsWKB(g)\nAsWKB(g)\n\nDescription\n-----------\n\nConverts a value in internal geometry format to its WKB representation and\nreturns the binary result.\n\nST_AsBinary(), AsBinary(), ST_AsWKB() and AsWKB() are synonyms,\n\nExamples\n--------\n\nSET @poly = ST_GeomFromText(\'POLYGON((0 0,0 1,1 1,1 0,0 0))\');\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\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 (588,32,'ST_AsWKB','A synonym for ST_AsBinary().\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 (589,32,'ST_GeomCollFromWKB','Syntax\n------\n\nST_GeomCollFromWKB(wkb[,srid])\nST_GeometryCollectionFromWKB(wkb[,srid])\nGeomCollFromWKB(wkb[,srid])\nGeometryCollectionFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a GEOMETRYCOLLECTION value using its WKB representation and SRID.\n\nST_GeomCollFromWKB(), ST_GeometryCollectionFromWKB(), GeomCollFromWKB() and\nGeometryCollectionFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_GeomFromText(\'GEOMETRYCOLLECTION(\n POLYGON((5 5,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 10)) |\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 (590,32,'ST_GeometryCollectionFromWKB','A synonym for ST_GeomCollFromWKB.\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 (591,32,'ST_GeometryFromWKB','A synonym for ST_GeomFromWKB.\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 (592,32,'ST_GeomFromWKB','Syntax\n------\n\nST_GeomFromWKB(wkb[,srid])\nST_GeometryFromWKB(wkb[,srid])\nGeomFromWKB(wkb[,srid])\nGeometryFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a geometry value of any type using its WKB representation and SRID.\n\nST_GeomFromWKB(), ST_GeometryFromWKB(), GeomFromWKB() and GeometryFromWKB()\nare synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(\'LINESTRING(0 4, 4 6)\'));\n\nSELECT ST_AsText(ST_GeomFromWKB(@g));\n+-------------------------------+\n| ST_AsText(ST_GeomFromWKB(@g)) |\n+-------------------------------+\n| LINESTRING(0 4,4 6) |\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 (593,32,'ST_LineFromWKB','Syntax\n------\n\nST_LineFromWKB(wkb[,srid])\nLineFromWKB(wkb[,srid])\nST_LineStringFromWKB(wkb[,srid])\nLineStringFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a LINESTRING value using its WKB representation and SRID.\n\nST_LineFromWKB(), LineFromWKB(), ST_LineStringFromWKB(), and\nLineStringFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_LineFromText(\'LineString(0 4,4 6)\'));\n\nSELECT ST_AsText(ST_LineFromWKB(@g)) AS l;\n+---------------------+\n| l |\n+---------------------+\n| LINESTRING(0 4,4 6) |\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 (594,32,'ST_LineStringFromWKB','A synonym for ST_LineFromWKB.\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 (595,32,'ST_PointFromWKB','Syntax\n------\n\nST_PointFromWKB(wkb[,srid])\nPointFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POINT value using its WKB representation and SRID.\n\nST_PointFromWKB() and PointFromWKB() are synonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PointFromText(\'POINT(0 4)\'));\n\nSELECT ST_AsText(ST_PointFromWKB(@g)) AS p;\n+------------+\n| p |\n+------------+\n| POINT(0 4) |\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 (596,32,'ST_PolyFromWKB','Syntax\n------\n\nST_PolyFromWKB(wkb[,srid])\nST_PolygonFromWKB(wkb[,srid])\nPolyFromWKB(wkb[,srid])\nPolygonFromWKB(wkb[,srid])\n\nDescription\n-----------\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nST_PolyFromWKB(), ST_PolygonFromWKB(), PolyFromWKB() and PolygonFromWKB() are\nsynonyms.\n\nExamples\n--------\n\nSET @g = ST_AsBinary(ST_PolyFromText(\'POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1\n1))\'));\n\nSELECT ST_AsText(ST_PolyFromWKB(@g)) AS p;\n+----------------------------------------+\n| p |\n+----------------------------------------+\n| POLYGON((1 1,1 5,4 9,6 9,9 3,7 2,1 1)) |\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 (597,32,'ST_PolygonFromWKB','A synonym for ST_PolyFromWKB.\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 (598,34,'Geometry Types','Description\n-----------\n\nMariaDB provides a standard way of creating spatial columns for geometry\ntypes, for example, with CREATE TABLE or ALTER TABLE. Currently, spatial\ncolumns are supported for MyISAM, InnoDB and ARCHIVE tables. See also SPATIAL\nINDEX.\n\nThe basic geometry type is GEOMETRY. But the type can be more specific. The\nfollowing types are supported:\n\n+-----------------------------------------------------------------------------+\n| Geometry Types |\n+-----------------------------------------------------------------------------+\n| POINT |\n+-----------------------------------------------------------------------------+\n| LINESTRING |\n+-----------------------------------------------------------------------------+\n| POLYGON |\n+-----------------------------------------------------------------------------+\n| MULTIPOINT |\n+-----------------------------------------------------------------------------+\n| MULTILINESTRING |\n+-----------------------------------------------------------------------------+\n| MULTIPOLYGON |\n+-----------------------------------------------------------------------------+\n| GEOMETRYCOLLECTION |\n+-----------------------------------------------------------------------------+\n| GEOMETRY |\n+-----------------------------------------------------------------------------+\n\nExamples\n--------\n\nNote: For clarity, only one type is listed per table in the examples below,\nbut a table row can contain multiple types. For example:\n\nCREATE TABLE object (shapeA POLYGON, shapeB LINESTRING);\n\nPOINT\n-----\n\nCREATE TABLE gis_point (g POINT);\nSHOW FIELDS FROM gis_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\nLINESTRING\n----------\n\nCREATE TABLE gis_line (g LINESTRING);\nSHOW FIELDS FROM gis_line;\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 10)\')),\n (LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));\n\nPOLYGON\n-------\n\nCREATE TABLE gis_polygon (g POLYGON);\nSHOW FIELDS FROM gis_polygon;\nINSERT INTO gis_polygon VALUES\n (PolygonFromText(\'POLYGON((10 10,20 10,20 20,10 20,10 10))\')),\n (PolyFromText(\'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10\n20,10 10))\')),\n (PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30,\n30), Point(0, 0))))));\n\nMULTIPOINT\n----------\n\nCREATE TABLE gis_multi_point (g MULTIPOINT);\nSHOW FIELDS FROM gis_multi_point;\nINSERT INTO gis_multi_point VALUES\n (MultiPointFromText(\'MULTIPOINT(0 0,10 10,10 20,20 20)\')),\n (MPointFromText(\'MULTIPOINT(1 1,11 11,11 21,21 21)\')),\n (MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));\n\nMULTILINESTRING\n---------------\n\nCREATE TABLE gis_multi_line (g MULTILINESTRING);\nSHOW FIELDS FROM gis_multi_line;\nINSERT INTO gis_multi_line VALUES\n (MultiLineStringFromText(\'MULTILINESTRING((10 48,10 21,10 0),(16 0,16\n23,16 48))\')),\n (MLineFromText(\'MULTILINESTRING((10 48,10 21,10 0))\')),\n (MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)),\nLineString(Point(2, 5), Point(5, 8), Point(21, 7))))));\n\nMULTIPOLYGON\n------------\n\nCREATE TABLE gis_multi_polygon (g MULTIPOLYGON);\nSHOW FIELDS FROM gis_multi_polygon;\nINSERT INTO gis_multi_polygon VALUES\n (MultiPolygonFromText(\'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52\n18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))\')),\n (MPolyFromText(\'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 (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3,\n3), Point(3, 0), Point(0, 3)))))));\n\nGEOMETRYCOLLECTION\n------------------\n\nCREATE TABLE gis_geometrycollection (g GEOMETRYCOLLECTION);\nSHOW FIELDS FROM gis_geometrycollection;\nINSERT INTO gis_geometrycollection VALUES\n (GeomCollFromText(\'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10\n10))\')),\n (GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6),\nLineString(Point(3, 6), Point(7, 9)))))),\n (GeomFromText(\'GeometryCollection()\')),\n (GeomFromText(\'GeometryCollection EMPTY\'));\n\nGEOMETRY\n--------\n\nCREATE TABLE gis_geometry (g GEOMETRY);\nSHOW FIELDS FROM gis_geometry;\nINSERT into gis_geometry SELECT * FROM gis_point;\nINSERT into gis_geometry SELECT * FROM gis_line;\nINSERT into gis_geometry SELECT * FROM gis_polygon;\nINSERT into gis_geometry SELECT * FROM gis_multi_point;\nINSERT into gis_geometry SELECT * FROM gis_multi_line;\nINSERT into gis_geometry SELECT * FROM gis_multi_polygon;\nINSERT into gis_geometry SELECT * FROM gis_geometrycollection;\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 (599,34,'Geometry Hierarchy','Description\n-----------\n\nGeometry is the base class. It is an abstract class. The instantiable\nsubclasses of Geometry are restricted to zero-, one-, and two-dimensional\ngeometric objects that exist in two-dimensional coordinate space. All\ninstantiable geometry classes are defined so that valid instances of a\ngeometry class are topologically closed (that is, all defined geometries\ninclude their boundary).\n\nThe base Geometry class has subclasses for Point, Curve, Surface, and\nGeometryCollection:\n\n* Point represents zero-dimensional objects.\n* Curve represents one-dimensional objects, and has subclass LineString, with\nsub-subclasses Line and LinearRing.\n* Surface is designed for two-dimensional objects and has subclass Polygon.\n* GeometryCollection has specialized zero-, one-, and two-dimensional\ncollection classes named MultiPoint, MultiLineString, and MultiPolygon for\nmodeling geometries corresponding to collections of Points, LineStrings, and\nPolygons, respectively. MultiCurve and MultiSurface are introduced as abstract\nsuperclasses that generalize the collection interfaces to handle Curves and\nSurfaces.\n\nGeometry, Curve, Surface, MultiCurve, and MultiSurface are defined as\nnon-instantiable classes. They define a common set of methods for their\nsubclasses and are included for extensibility.\n\nPoint, LineString, Polygon, GeometryCollection, MultiPoint, MultiLineString,\nand MultiPolygon are instantiable classes.\n\nURL: https://mariadb.com/kb/en/geometry-hierarchy/','','https://mariadb.com/kb/en/geometry-hierarchy/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (600,34,'SPATIAL INDEX','Description\n-----------\n\nOn MyISAM, Aria and InnoDB tables, MariaDB can create spatial indexes (an\nR-tree index) using syntax similar to that for creating regular indexes, but\nextended with the SPATIAL keyword. Currently, columns in spatial indexes must\nbe declared NOT NULL.\n\nSpatial indexes can be created when the table is created, or added after the\nfact like so:\n\n* with CREATE TABLE: CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));\n\n* with ALTER TABLE: ALTER TABLE geom ADD SPATIAL INDEX(g);\n\n* with CREATE INDEX: CREATE SPATIAL INDEX sp_index ON geom (g);\n\nSPATIAL INDEX creates an R-tree index. For storage engines that support\nnon-spatial indexing of spatial columns, the engine creates a B-tree index. A\nB-tree index on spatial values is useful for exact-value lookups, but not for\nrange scans.\n\nFor more information on indexing spatial columns, see CREATE INDEX.\n\nTo drop spatial indexes, use ALTER TABLE or DROP INDEX:\n\n* with ALTER TABLE: ALTER TABLE geom DROP INDEX g;\n\n* with DROP INDEX: DROP INDEX sp_index ON geom;\n\nData-at-Rest Encyption\n----------------------\n\nBefore MariaDB 10.4.3, InnoDB\'s spatial indexes could not be encrypted. If an\nInnoDB table was encrypted and if it contained spatial indexes, then those\nindexes would be unencrypted.\n\nIn MariaDB 10.4.3 and later, if innodb_checksum_algorithm is set to full_crc32\nor strict_full_crc32, and if the table does not use ROW_FORMAT=COMPRESSED,\nthen InnoDB spatial indexes will be encrypted if the table is encrypted.\n\nSee MDEV-12026 for more information.\n\nURL: https://mariadb.com/kb/en/spatial-index/','','https://mariadb.com/kb/en/spatial-index/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (601,35,'BOUNDARY','A synonym for ST_BOUNDARY.\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 (602,35,'DIMENSION','A synonym for ST_DIMENSION.\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 (603,35,'ENVELOPE','A synonym for ST_ENVELOPE.\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 (604,35,'GeometryN','A synonym for ST_GeometryN.\n\nURL: https://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 (605,35,'GeometryType','A synonym for ST_GeometryType.\n\nURL: https://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 (606,35,'IsClosed','A synonym for ST_IsClosed.\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 (607,35,'IsEmpty','A synonym for ST_IsEmpty.\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 (608,35,'IsRing','A synonym for ST_IsRing.\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 (609,35,'IsSimple','A synonym for ST_IsSImple.\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 (610,35,'NumGeometries','A synonym for ST_NumGeometries.\n\nURL: https://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 (611,35,'SRID','A synonym for ST_SRID.\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 (612,35,'ST_BOUNDARY','MariaDB starting with 10.1.2\n----------------------------\nThe ST_BOUNDARY function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_BOUNDARY(g)\nBOUNDARY(g)\n\nDescription\n-----------\n\nReturns a geometry that is the closure of the combinatorial boundary of the\ngeometry value g.\n\nBOUNDARY() is a synonym.\n\nExamples\n--------\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0 0, -3 3)\')));\n+----------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'LINESTRING(3 3,0 0, -3 3)\'))) |\n+----------------------------------------------------------------------+\n| MULTIPOINT(3 3,-3 3) |\n+----------------------------------------------------------------------+\n\nSELECT ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0, -3 3, 3\n3))\')));\n+--------------------------------------------------------------------------+\n| ST_AsText(ST_Boundary(ST_GeomFromText(\'POLYGON((3 3,0 0, -3 3, 3 3))\'))) |\n+--------------------------------------------------------------------------+\n| LINESTRING(3 3,0 0,-3 3,3 3) |\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 (613,35,'ST_DIMENSION','Syntax\n------\n\nST_Dimension(g)\nDimension(g)\n\nDescription\n-----------\n\nReturns the inherent dimension of the geometry value g. The result can be\n\n+------------------------------------+---------------------------------------+\n| Dimension | Definition |\n+------------------------------------+---------------------------------------+\n| -1 | empty geometry |\n+------------------------------------+---------------------------------------+\n| 0 | geometry with no length or area |\n+------------------------------------+---------------------------------------+\n| 1 | geometry with no area but nonzero |\n| | length |\n+------------------------------------+---------------------------------------+\n| 2 | geometry with nonzero area |\n+------------------------------------+---------------------------------------+\n\nST_Dimension() and Dimension() are synonyms.\n\nExamples\n--------\n\nSELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\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 (614,35,'ST_ENVELOPE','Syntax\n------\n\nST_ENVELOPE(g)\nENVELOPE(g)\n\nDescription\n-----------\n\nReturns the Minimum Bounding Rectangle (MBR) for the geometry value g. The\nresult is returned as a Polygon value.\n\nThe polygon is defined by the corner points of the bounding box:\n\nPOLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))\n\nST_ENVELOPE() and ENVELOPE() are synonyms.\n\nExamples\n--------\n\nSELECT AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\')));\n+----------------------------------------------------------+\n| AsText(ST_ENVELOPE(GeomFromText(\'LineString(1 1,4 4)\'))) |\n+----------------------------------------------------------+\n| POLYGON((1 1,4 1,4 4,1 4,1 1)) |\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 (615,35,'ST_GEOMETRYN','Syntax\n------\n\nST_GeometryN(gc,N)\nGeometryN(gc,N)\n\nDescription\n-----------\n\nReturns the N-th geometry in the GeometryCollection gc. Geometries are\nnumbered beginning with 1.\n\nST_GeometryN() and GeometryN() are synonyms.\n\nExample\n-------\n\nSET @gc = \'GeometryCollection(Point(1 1),LineString(12 14, 9 11))\';\n\nSELECT AsText(GeometryN(GeomFromText(@gc),1));\n+----------------------------------------+\n| AsText(GeometryN(GeomFromText(@gc),1)) |\n+----------------------------------------+\n| POINT(1 1) |\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 (616,35,'ST_GEOMETRYTYPE','Syntax\n------\n\nST_GeometryType(g)\nGeometryType(g)\n\nDescription\n-----------\n\nReturns as a string the name of the geometry type of which the geometry\ninstance g is a member. The name corresponds to one of the instantiable\nGeometry subclasses.\n\nST_GeometryType() and GeometryType() are synonyms.\n\nExamples\n--------\n\nSELECT GeometryType(GeomFromText(\'POINT(1 1)\'));\n+------------------------------------------+\n| GeometryType(GeomFromText(\'POINT(1 1)\')) |\n+------------------------------------------+\n| POINT |\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 (617,35,'ST_ISCLOSED','Syntax\n------\n\nST_IsClosed(g)\nIsClosed(g)\n\nDescription\n-----------\n\nReturns 1 if a given LINESTRING\'s start and end points are the same, or 0 if\nthey are not the same. Before MariaDB 10.1.5, returns NULL if not given a\nLINESTRING. After MariaDB 10.1.5, returns -1.\n\nST_IsClosed() and IsClosed() are synonyms.\n\nExamples\n--------\n\nSET @ls = \'LineString(0 0, 0 4, 4 4, 0 0)\';\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)\';\nSELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));\n+--------------------------------+\n| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |\n+--------------------------------+\n| 0 |\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 (618,35,'ST_ISEMPTY','Syntax\n------\n\nST_IsEmpty(g)\nIsEmpty(g)\n\nDescription\n-----------\n\nIsEmpty is a function defined by the OpenGIS specification, but is not fully\nimplemented by MariaDB or MySQL.\n\nSince MariaDB and MySQL do not support GIS EMPTY values such as POINT EMPTY,\nas implemented it simply returns 1 if the geometry value g is invalid, 0 if it\nis valid, and NULL if the argument is NULL.\n\nST_IsEmpty() and IsEmpty() are synonyms.\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 (619,35,'ST_IsRing','MariaDB starting with 10.1.2\n----------------------------\nThe ST_IsRing function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_IsRing(g)\nIsRing(g)\n\nDescription\n-----------\n\nReturns true if a given LINESTRING is a ring, that is, both ST_IsClosed and\nST_IsSimple. A simple curve does not pass through the same point more than\nonce. However, see MDEV-7510.\n\nSt_IsRing() and IsRing() are synonyms.\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 (620,35,'ST_IsSimple','Syntax\n------\n\nST_IsSimple(g)\nIsSimple(g)\n\nDescription\n-----------\n\nReturns true if the given Geometry has no anomalous geometric points, false if\nit does, or NULL if given a NULL value.\n\nST_IsSimple() and IsSimple() are synonyms.\n\nExamples\n--------\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\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 (621,35,'ST_NUMGEOMETRIES','Syntax\n------\n\nST_NumGeometries(gc)\nNumGeometries(gc)\n\nDescription\n-----------\n\nReturns the number of geometries in the GeometryCollection gc.\n\nST_NumGeometries() and NumGeometries() are synonyms.\n\nExample\n-------\n\nSET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\n\nSELECT NUMGEOMETRIES(GeomFromText(@gc));\n+----------------------------------+\n| NUMGEOMETRIES(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\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 (622,35,'ST_RELATE','MariaDB starting with 10.1.2\n----------------------------\nThe ST_RELATE() function was introduced in MariaDB 10.1.2\n\nSyntax\n------\n\nST_Relate(g1, g2, i)\n\nDescription\n-----------\n\nReturns true if Geometry g1 is spatially related to Geometryg2 by testing for\nintersections between the interior, boundary and exterior of the two\ngeometries as specified by the values in intersection matrix pattern i.\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 (623,35,'ST_SRID','Syntax\n------\n\nST_SRID(g)\nSRID(g)\n\nDescription\n-----------\n\nReturns an integer indicating the Spatial Reference System ID for the geometry\nvalue g.\n\nIn MariaDB, the SRID value is just an integer associated with the geometry\nvalue. All calculations are done assuming Euclidean (planar) geometry.\n\nST_SRID() and SRID() are synonyms.\n\nExamples\n--------\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\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 (624,36,'LOAD_FILE','Syntax\n------\n\nLOAD_FILE(file_name)\n\nDescription\n-----------\n\nReads the file and returns the file contents as a string. To use this\nfunction, the file must be located on the server host, you must specify the\nfull path name to the file, and you must have the FILE privilege. The file\nmust be readable by all and it must be less than the size, in bytes, of the\nmax_allowed_packet system variable. If the secure_file_priv system variable is\nset to a non-empty directory name, the file to be loaded must be located in\nthat directory.\n\nIf the file does not exist or cannot be read because one of the preceding\nconditions is not satisfied, the function returns NULL.\n\nSince MariaDB 5.1, the character_set_filesystem system variable has controlled\ninterpretation of file names that are given as literal strings.\n\nStatements using the LOAD_FILE() function are not safe for statement based\nreplication. This is because the slave will execute the LOAD_FILE() command\nitself. If the file doesn\'t exist on the slave, the function will return NULL.\n\nExamples\n--------\n\nUPDATE t SET blob_col=LOAD_FILE(\'/tmp/picture\') WHERE id=1;\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 (625,36,'NOT REGEXP','Syntax\n------\n\nexpr NOT REGEXP pat, expr NOT RLIKE pat\n\nDescription\n-----------\n\nThis is the same as NOT (expr REGEXP pat).\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 (626,36,'REGEXP','Syntax\n------\n\nexpr REGEXP pat, expr RLIKE pat\n\nDescription\n-----------\n\nPerforms a pattern match of a string expression expr against a pattern pat.\nThe pattern can be an extended regular expression. See Regular Expressions\nOverview for details on the syntax for regular expressions (see also PCRE\nRegular Expressions).\n\nReturns 1 if expr matches pat or 0 if it doesn\'t match. If either expr or pat\nare NULL, the result is NULL.\n\nThe negative form NOT REGEXP also exists, as an alias for NOT (string REGEXP\npattern). RLIKE and NOT RLIKE are synonyms for REGEXP and NOT REGEXP,\noriginally provided for mSQL compatibility.\n\nThe pattern need not be a literal string. For example, it can be specified as\na string expression or table column.\n\nNote: Because MariaDB uses the C escape syntax in strings (for example, \"\\n\"\nto represent the newline character), you must double any \"\\\" that you use in\nyour REGEXP strings.\n\nREGEXP is not case sensitive, except when used with binary strings.\n\nMariaDB 10.0.5 moved to the PCRE regex library - see PCRE Regular Expressions\nfor enhancements to REGEXP introduced in MariaDB 10.0.5.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT \'Monty!\' REGEXP \'m%y%%\';\n+-------------------------+\n| \'Monty!\' REGEXP \'m%y%%\' |\n+-------------------------+\n| 0 |\n+-------------------------+\n\nSELECT \'Monty!\' REGEXP \'.*\';\n+----------------------+\n| \'Monty!\' REGEXP \'.*\' |\n+----------------------+\n| 1 |\n+----------------------+\n\nSELECT \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\';\n+---------------------------------------+\n| \'new*\\n*line\' REGEXP \'new\\\\*.\\\\*line\' |\n+---------------------------------------+\n| 1 |\n+---------------------------------------+\n\nSELECT \'a\' REGEXP \'A\', \'a\' REGEXP BINARY \'A\';\n+----------------+-----------------------+\n| \'a\' REGEXP \'A\' | \'a\' REGEXP BINARY \'A\' |\n+----------------+-----------------------+\n| 1 | 0 |\n+----------------+-----------------------+\n\nSELECT \'a\' REGEXP \'^[a-d]\';\n+---------------------+\n| \'a\' REGEXP \'^[a-d]\' |\n+---------------------+\n| 1 |\n+---------------------+\n\ndefault_regex_flags examples\n----------------------------\n\nMariaDB 10.0.11 introduced the default_regex_flags variable to address the\nremaining compatibilities between PCRE and the old regex library.\n\nThe default behaviour (multiline match is off)\n\nSELECT \'a\\nb\\nc\' RLIKE \'^b$\';\n+---------------------------+\n| \'(?m)a\\nb\\nc\' RLIKE \'^b$\' |\n+---------------------------+\n| 0 |\n+---------------------------+\n\nEnabling the multiline option using the PCRE option syntax:\n\nSELECT \'a\\nb\\nc\' RLIKE \'(?m)^b$\';\n+---------------------------+\n| \'a\\nb\\nc\' RLIKE \'(?m)^b$\' |\n+---------------------------+\n| 1 |\n+---------------------------+\n\nEnabling the multiline option using default_regex_flags\n\nSET default_regex_flags=\'MULTILINE\';\nSELECT \'a\\nb\\nc\' RLIKE \'^b$\';\n+-----------------------+\n| \'a\\nb\\nc\' RLIKE \'^b$\' |\n+-----------------------+\n| 1 |\n+-----------------------+\n\nURL: https://mariadb.com/kb/en/regexp/','','https://mariadb.com/kb/en/regexp/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (627,36,'REGEXP_INSTR','Syntax\n------\n\nREGEXP_INSTR(subject, pattern)\n\nReturns the position of the first occurrence of the regular expression pattern\nin the string subject, or 0 if pattern was not found.\n\nThe positions start with 1 and are measured in characters (i.e. not in bytes),\nwhich is important for multi-byte character sets. You can cast a multi-byte\ncharacter set to BINARY to get offsets in bytes.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_INSTR was introduced as part of this\nenhancement.\n\nExamples\n--------\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 in bytes:\n\nSELECT REGEXP_INSTR(BINARY \'BJÖRN\',\'N\') AS cast_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\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 (628,36,'REGEXP_REPLACE','Syntax\n------\n\nREGEXP_REPLACE(subject, pattern, replace)\n\nDescription\n-----------\n\nREGEXP_REPLACE returns the string subject with all occurrences of the regular\nexpression pattern replaced by the string replace. If no occurrences are\nfound, then subject is returned as is.\n\nThe replace string can have backreferences to the subexpressions in the form\n\\N, where N is a number from 1 to 9.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_REPLACE was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\n\nSELECT REGEXP_REPLACE(\'ab12cd\',\'[0-9]\',\'\') AS remove_digits;\n-> abcd\n\nSELECT\nREGEXP_REPLACE(\'<html><head><title>title</title><body>body</body></htm>\',\n\'<.+?>\',\' \')\nAS strip_html;\n-> title body\n\nBackreferences to the subexpressions in the form \\N, where N is a number from\n1 to 9:\n\nSELECT REGEXP_REPLACE(\'James Bond\',\'^(.*) (.*)$\',\'\\\\2, \\\\1\') AS reorder_name;\n-> Bond, James\n\nCase insensitive and case sensitive matches:\n\nSELECT REGEXP_REPLACE(\'ABC\',\'b\',\'-\') AS case_insensitive;\n-> A-C\n\nSELECT REGEXP_REPLACE(\'ABC\' COLLATE utf8_bin,\'b\',\'-\') AS case_sensitive;\n-> ABC\n\nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'b\',\'-\') AS binary_data;\n-> ABC\n\nOverwriting the collation case sensitivity using the (?i) and (?-i) PCRE flags.\n\nSELECT REGEXP_REPLACE(\'ABC\',\'(?-i)b\',\'-\') AS force_case_sensitive;\n-> ABC\n\nSELECT REGEXP_REPLACE(BINARY \'ABC\',\'(?i)b\',\'-\') AS force_case_insensitive;\n-> A-C\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 (629,36,'REGEXP_SUBSTR','Syntax\n------\n\nREGEXP_SUBSTR(subject,pattern)\n\nDescription\n-----------\n\nReturns the part of the string subject that matches the regular expression\npattern, or an empty string if pattern was not found.\n\nThe function follows the case sensitivity rules of the effective collation.\nMatching is performed case insensitively for case insensitive collations, and\ncase sensitively for case sensitive collations and for binary data.\n\nThe collation case sensitivity can be overwritten using the (?i) and (?-i)\nPCRE flags.\n\nMariaDB uses the PCRE regular expression library for enhanced regular\nexpression performance, and REGEXP_SUBSTR was introduced as part of this\nenhancement.\n\nThe default_regex_flags variable addresses the remaining compatibilities\nbetween PCRE and the old regex library.\n\nExamples\n--------\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\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 (630,36,'ASCII','Syntax\n------\n\nASCII(str)\n\nDescription\n-----------\n\nReturns the numeric ASCII value of the leftmost character of the string\nargument. Returns 0 if the given string is empty and NULL if it is NULL.\n\nASCII() works for 8-bit characters.\n\nExamples\n--------\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\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 (631,36,'BIN','Syntax\n------\n\nBIN(N)\n\nDescription\n-----------\n\nReturns a string representation of the binary value of the given longlong\n(that is, BIGINT) number. This is equivalent to CONV(N,10,2). The argument\nshould be positive. If it is a FLOAT, it will be truncated. Returns NULL if\nthe argument is NULL.\n\nExamples\n--------\n\nSELECT BIN(12);\n+---------+\n| BIN(12) |\n+---------+\n| 1100 |\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 (632,36,'BINARY Operator','This page describes the BINARY operator. For details about the data type, see\nBinary Data Type.\n\nSyntax\n------\n\nBINARY\n\nDescription\n-----------\n\nThe BINARY operator casts the string following it to a binary string. This is\nan easy way to force a column comparison to be done byte by byte rather than\ncharacter by character. This causes the comparison to be case sensitive even\nif the column isn\'t defined as BINARY or BLOB.\n\nBINARY also causes trailing spaces to be significant.\n\nExamples\n--------\n\nSELECT \'a\' = \'A\';\n+-----------+\n| \'a\' = \'A\' |\n+-----------+\n| 1 |\n+-----------+\n\nSELECT BINARY \'a\' = \'A\';\n+------------------+\n| BINARY \'a\' = \'A\' |\n+------------------+\n| 0 |\n+------------------+\n\nSELECT \'a\' = \'a \';\n+------------+\n| \'a\' = \'a \' |\n+------------+\n| 1 |\n+------------+\n\nSELECT BINARY \'a\' = \'a \';\n+-------------------+\n| BINARY \'a\' = \'a \' |\n+-------------------+\n| 0 |\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 (633,36,'BIT_LENGTH','Syntax\n------\n\nBIT_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument in bits. If the argument is\nnot a string, it will be converted to string. If the argument is NULL, it\nreturns NULL.\n\nExamples\n--------\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-------------\n\nPostgreSQL and Sybase support BIT_LENGTH().\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 (634,36,'CAST','Syntax\n------\n\nCAST(expr AS type)\n\nDescription\n-----------\n\nThe CAST() function takes a value of one type and produces a value of another\ntype, similar to the CONVERT() function.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nThe main difference between CAST and CONVERT() is that CONVERT(expr,type) is\nODBC syntax while CAST(expr as type) and CONVERT(... USING ...) are SQL92\nsyntax.\n\nIn MariaDB 10.4 and later, you can use the CAST() function with the INTERVAL\nkeyword.\n\nUntil MariaDB 5.5.31, X\'HHHH\', the standard SQL syntax for binary string\nliterals, erroneously worked in the same way as 0xHHHH. In 5.5.31 it was\nintentionally changed to behave as a string in all contexts (and never as a\nnumber).\n\nThis introduced an incompatibility with previous versions of MariaDB, and all\nversions of MySQL (see the example below).\n\nExamples\n--------\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 character set, the\ncollation_connection character set collation will be used. When used with CHAR\nCHARACTER SET, the 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 the 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 utf8_unicode_ci) |\n+-------------------------------------------------------------------------+\n| utf8_unicode_ci |\n+-------------------------------------------------------------------------+\n\nUsing CAST() to order an ENUM field as a CHAR rather than the internal\nnumerical 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| 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, since x\'aa\' and\n\'X\'aa\' no longer behave as a number. Previously, and in all versions of MySQL,\nno warnings are triggered since they did erroneously behave as a number:\n\nSELECT CAST(0xAA AS UNSIGNED), CAST(x\'aa\' AS UNSIGNED), CAST(X\'aa\' AS\nUNSIGNED);\n+------------------------+-------------------------+-------------------------+\n| CAST(0xAA AS UNSIGNED) | CAST(x\'aa\' AS UNSIGNED) | CAST(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: \'\\xAA\'\nWarning (Code 1292): Truncated incorrect INTEGER value: \'\\xAA\'\n\nCasting to intervals:\n\nSELECT CAST(2019-01-04 INTERVAL AS DAY_SECOND(2)) AS \"Cast\";\n\n+-------------+\n| Cast |\n+-------------+\n| 00:20:17.00 |\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 (635,36,'CHAR Function','Syntax\n------\n\nCHAR(N,... [USING charset_name])\n\nDescription\n-----------\n\nCHAR() interprets each argument as an INT and returns a string consisting of\nthe characters given by the code values of those integers. NULL values are\nskipped. By default, CHAR() 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 given character\nset, a warning is issued. Also, if strict SQL mode is enabled, the result from\nCHAR() becomes NULL.\n\nExamples\n--------\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: \'77.3\'\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 (636,36,'CHAR_LENGTH','Syntax\n------\n\nCHAR_LENGTH(str)\nCHARACTER_LENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the given string argument, measured in characters. A\nmulti-byte character counts as a single character. This means that for a\nstring containing five two-byte characters, LENGTH() (or OCTET_LENGTH() in\nOracle mode) returns 10, whereas CHAR_LENGTH() returns 5. If the argument is\nNULL, it returns NULL.\n\nIf the argument is not a string value, it is converted into a string.\n\nIt is synonymous with the CHARACTER_LENGTH() function.\n\nExamples\n--------\n\nSELECT CHAR_LENGTH(\'MariaDB\');\n+------------------------+\n| CHAR_LENGTH(\'MariaDB\') |\n+------------------------+\n| 7 |\n+------------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (637,36,'CHR','MariaDB starting with 10.3.1\n----------------------------\nThe CHR() function was introduced in MariaDB 10.3.1 to provide Oracle\ncompatibility\n\nSyntax\n------\n\nCHR(N)\n\nDescription\n-----------\n\nCHR() interprets each argument N as an integer and returns a VARCHAR(1) string\nconsisting of the character given by the code values of the integer. The\ncharacter set and collation of the string are set according to the values of\nthe character_set_database and collation_database system variables.\n\nCHR() is similar to the CHAR() function, but only accepts a single argument.\n\nCHR() is available in all sql_modes.\n\nExamples\n--------\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| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect INTEGER value: \'C\' |\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 (638,36,'CONCAT','Syntax\n------\n\nCONCAT(str1,str2,...)\n\nDescription\n-----------\n\nReturns the string that results from concatenating the arguments. May have one\nor more arguments. If all arguments are non-binary strings, the result is a\nnon-binary string. If the arguments include any binary strings, the result is\na binary string. A numeric argument is converted to its equivalent binary\nstring form; if you want to avoid that, you can use an explicit type cast, as\nin 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 parameters from the\nresult. Sometimes this is not desirable; to avoid this, you can:\n\n* Use the CONCAT_WS() function with an empty separator, because that function\nis NULL-safe.\n* Use IFNULL() to turn NULLs into empty strings.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, CONCAT ignores NULL.\n\nExamples\n--------\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\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 (639,36,'CONCAT_WS','Syntax\n------\n\nCONCAT_WS(separator,str1,str2,...)\n\nDescription\n-----------\n\nCONCAT_WS() stands for Concatenate With Separator and is a special form of\nCONCAT(). The first argument is the separator for the rest of the arguments.\nThe separator is added 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 values are\nskipped. This makes CONCAT_WS() suitable when you want to concatenate some\nvalues and avoid losing all information if one of them is NULL.\n\nExamples\n--------\n\nSELECT CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\');\n+-------------------------------------------------------+\n| CONCAT_WS(\',\',\'First name\',\'Second name\',\'Last Name\') |\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 string:\n\nSET @a = \'gnu\', @b = \'penguin\', @c = \'sea lion\';\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\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 (640,36,'CONVERT','Syntax\n------\n\nCONVERT(expr,type), CONVERT(expr USING transcoding_name)\n\nDescription\n-----------\n\nThe CONVERT() and CAST() functions take a value of one type and produce a\nvalue of another type.\n\nThe type can be one of the following values:\n\n* BINARY\n* CHAR\n* DATE\n* DATETIME\n* DECIMAL[(M[,D])]\n* DOUBLE\n* FLOAT (from MariaDB 10.4.5)\n* INTEGER\nShort for SIGNED INTEGER\n\n* SIGNED [INTEGER]\n* UNSIGNED [INTEGER]\n* TIME\n* VARCHAR (in Oracle mode, from MariaDB 10.3)\n\nNote that in MariaDB, INT and INTEGER are the same thing.\n\nBINARY produces a string with the BINARY data type. If the optional length is\ngiven, BINARY(N) causes the cast to use no more than N bytes of the argument.\nValues shorter than the given number in bytes are padded with 0x00 bytes to\nmake them equal the length value.\n\nCHAR(N) causes the cast to use no more than the number of characters given in\nthe argument.\n\nThe main difference between the CAST() and CONVERT() is that\nCONVERT(expr,type) is ODBC syntax while CAST(expr as type) and CONVERT(...\nUSING ...) are SQL92 syntax.\n\nCONVERT() with USING is used to convert data between different character sets.\nIn MariaDB, transcoding names are the same as the corresponding character set\nnames. For example, this statement converts the string \'abc\' in the default\ncharacter set to the corresponding string in the utf8 character set:\n\nSELECT CONVERT(\'abc\' USING utf8);\n\nExamples\n--------\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 to 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\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 (641,36,'ELT','Syntax\n------\n\nELT(N, str1[, str2, str3,...])\n\nDescription\n-----------\n\nTakes a numeric argument and a series of string arguments. Returns the string\nthat corresponds to the given numeric position. For instance, it returns str1\nif N is 1, str2 if N is 2, and so on. If the numeric argument is a FLOAT,\nMariaDB rounds it to the nearest INTEGER. If the numeric argument is less than\n1, greater than the total number of arguments, or not a number, ELT() returns\nNULL. It must have at least two arguments.\n\nIt is complementary to the FIELD() function.\n\nExamples\n--------\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\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 (642,36,'EXPORT_SET','Syntax\n------\n\nEXPORT_SET(bits, on, off[, separator[, number_of_bits]])\n\nDescription\n-----------\n\nTakes a minimum of three arguments. Returns a string where each bit in the\ngiven bits argument is returned, with the string values given for on and off.\n\nBits are examined from right to left, (from low-order to high-order bits).\nStrings are added to the result from left to right, separated by a separator\nstring (defaults as \',\'). You can optionally limit the number of bits the\nEXPORT_SET() function examines using the number_of_bits option.\n\nIf any of the arguments are set as NULL, the function returns NULL.\n\nExamples\n--------\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\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 (643,36,'EXTRACTVALUE','Syntax\n------\n\nEXTRACTVALUE(xml_frag, xpath_expr)\n\nDescription\n-----------\n\nThe EXTRACTVALUE() function takes two string arguments: a fragment of XML\nmarkup and an XPath expression, (also known as a locator). It returns the text\n(That is, CDDATA), of the first text node which is a child of the element or\nelements matching the XPath expression.\n\nIn cases where a valid XPath expression does not match any text nodes in a\nvalid XML fragment, (including the implicit /text() expression), the\nEXTRACTVALUE() function returns an empty string.\n\nInvalid Arguments\n-----------------\n\nWhen either the XML fragment or the XPath expression is NULL, the\nEXTRACTVALUE() function returns NULL. When the XML fragment is invalid, it\nraises a warning Code 1525:\n\nWarning (Code 1525): Incorrect XML value: \'parse error at line 1 pos 11:\nunexpected 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---------------------------\n\nThis function is the equivalent of performing a match using the XPath\nexpression after appending /text(). In other words:\n\nSELECT\n EXTRACTVALUE(\'<cases><case>example</case></cases>\', \'/cases/case\')\n AS \'Base Example\',\n EXTRACTVALUE(\'<cases><case>example</case></cases>\', \'/cases/case/text()\')\n AS \'text() Example\';\n+--------------+----------------+\n| Base Example | text() Example |\n+--------------+----------------+\n| example | example |\n+--------------+----------------+\n\nCount Matches\n-------------\n\nWhen EXTRACTVALUE() returns multiple matches, it returns the content of the\nfirst child text node of each matching element, in the matched order, as a\nsingle, space-delimited string.\n\nBy design, the EXTRACTVALUE() function makes no distinction between a match on\nan empty element and no match at all. If you need to determine whether no\nmatching element was found in the XML fragment or if an element was found that\ncontained no child text nodes, use the XPath count() function.\n\nFor instance, when looking for a value that exists, but contains no child text\nnodes, you would get a count of the number of matching instances:\n\nSELECT\n EXTRACTVALUE(\'<cases><case/></cases>\', \'/cases/case\')\n AS \'Empty Example\',\n EXTRACTVALUE(\'<cases><case/></cases>\', \'count(/cases/case)\')\n AS \'count() Example\';\n+---------------+-----------------+\n| Empty Example | count() Example |\n+---------------+-----------------+\n| | 1 |\n+---------------+-----------------+\n\nAlternatively, when looking for a value that doesn\'t exist, count() returns 0.\n\nSELECT\n EXTRACTVALUE(\'<cases><case/></cases>\', \'/cases/person\')\n AS \'No Match Example\',\n EXTRACTVALUE(\'<cases><case/></cases>\', \'count(/cases/person)\')\n AS \'count() Example\';\n+------------------+-----------------+\n| No Match Example | count() Example |\n+------------------+-----------------+\n| | 0|\n+------------------+-----------------+\n\nMatches\n-------\n\nImportant: The EXTRACTVALUE() function only returns CDDATA. It does not return\ntags that the element might contain or the text that these child elements\ncontain.\n\nSELECT\n\nEXTRACTVALUE(\'<cases><case>Person<email>x@example.com</email></case></cases>\',\n\'/cases\')\n AS Case;\n+--------+\n| Case |\n+--------+\n| Person |\n+--------+\n\nNote, in the above example, while the XPath expression matches to the parent\n<case> instance, it does not return the contained <email> tag or its content.\n\nExamples\n--------\n\nSELECT\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\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 (644,36,'FIELD','Syntax\n------\n\nFIELD(pattern, str1[,str2,...])\n\nDescription\n-----------\n\nReturns the index position of the string or number matching the given pattern.\nReturns 0 in the event that none of the arguments match the pattern. Raises an\nError 1582 if not given at least two arguments.\n\nWhen all arguments given to the FIELD() function are strings, they are treated\nas case-insensitive. When all the arguments are numbers, they are treated as\nnumbers. Otherwise, they are treated as doubles.\n\nIf the given pattern occurs more than once, the FIELD() function only returns\nthe index of the first instance. If the given pattern is NULL, the function\nreturns 0, as a NULL pattern always fails to match.\n\nThis function is complementary to the ELT() function.\n\nExamples\n--------\n\nSELECT FIELD(\'ej\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\') \n AS \'Field Results\';\n+---------------+\n| Field Results | \n+---------------+\n| 2 |\n+---------------+\n\nSELECT FIELD(\'fo\', \'Hej\', \'ej\', \'Heja\', \'hej\', \'foo\')\n AS \'Field Results\';\n+---------------+\n| Field Results | \n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD(1, 2, 3, 4, 5, 1) AS \'Field Results\';\n+---------------+\n| Field Results |\n+---------------+\n| 5 |\n+---------------+\n\nSELECT FIELD(NULL, 2, 3) AS \'Field Results\';\n+---------------+\n| Field Results |\n+---------------+\n| 0 |\n+---------------+\n\nSELECT FIELD(\'fail\') AS \'Field Results\';\nError 1582 (42000): Incorrect parameter count in call\nto native function \'field\'\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 (645,36,'FIND_IN_SET','Syntax\n------\n\nFIND_IN_SET(pattern, strlist)\n\nDescription\n-----------\n\nReturns the index position where the given pattern occurs in a string list.\nThe first argument is the pattern you want to search for. The second argument\nis a string containing comma-separated variables. If the second argument is of\nthe SET data-type, the function is optimized to use bit arithmetic.\n\nIf the pattern does not occur in the string list or if the string list is an\nempty string, the function returns 0. If either argument is NULL, the function\nreturns NULL. The function does not return the correct result if the pattern\ncontains a comma (\",\") character.\n\nExamples\n--------\n\nSELECT FIND_IN_SET(\'b\',\'a,b,c,d\') AS \"Found Results\";\n+---------------+\n| Found Results |\n+---------------+\n| 2 |\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 (646,36,'FORMAT','Syntax\n------\n\nFORMAT(num, decimal_position[, locale])\n\nDescription\n-----------\n\nFormats the given number for display as a string, adding separators to\nappropriate position and rounding the results to the given decimal position.\nFor instance, it would format 15233.345 to 15,233.35.\n\nIf the given decimal position is 0, it rounds to return no decimal point or\nfractional part. You can optionally specify a locale value to format numbers\nto the pattern appropriate for the given region.\n\nExamples\n--------\n\nSELECT FORMAT(1234567890.09876543210, 4) AS \'Format\';\n+--------------------+\n| Format |\n+--------------------+\n| 1,234,567,890.0988 |\n+--------------------+\n\nSELECT FORMAT(1234567.89, 4) AS \'Format\';\n+----------------+\n| Format |\n+----------------+\n| 1,234,567.8900 |\n+----------------+\n\nSELECT FORMAT(1234567.89, 0) AS \'Format\';\n+-----------+\n| Format |\n+-----------+\n| 1,234,568 |\n+-----------+\n\nSELECT FORMAT(123456789,2,\'rm_CH\') AS \'Format\';\n+----------------+\n| Format |\n+----------------+\n| 123\'456\'789,00 |\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 (647,36,'FROM_BASE64','Syntax\n------\n\nFROM_BASE64(str)\n\nDescription\n-----------\n\nDecodes the given base-64 encode string, returning the result as a binary\nstring. Returns NULL if the given string is 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. MariaDB uses the\nfollowing:\n\n* It encodes alphabet value 64 as \'+\'.\n* It encodes alphabet value 63 as \'/\'.\n* It codes output in groups of four printable characters. Each three byte of\ndata encoded uses four characters. If the final group is incomplete, it pads\nthe difference with the \'=\' character.\n* It divides long output, adding a new line very 76 characters.\n* In decoding, it recognizes and ignores newlines, carriage returns, tabs and\nspace whitespace characters.\n\nSELECT TO_BASE64(\'Maria\') AS \'Input\';\n+-----------+\n| Input |\n+-----------+\n| TWFyaWE= |\n+-----------+\n\nSELECT FROM_BASE64(\'TWFyaWE=\') AS \'Output\';\n+--------+\n| Output |\n+--------+\n| Maria |\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 (648,36,'HEX','Syntax\n------\n\nHEX(N_or_S)\n\nDescription\n-----------\n\nIf N_or_S is a number, returns a string representation of the hexadecimal\nvalue of N, where N is a longlong (BIGINT) number. This is equivalent to\nCONV(N,10,16).\n\nIf N_or_S is a string, returns a hexadecimal string representation of N_or_S\nwhere each byte of each character in N_or_S is converted to two hexadecimal\ndigits. If N_or_S is NULL, returns NULL. The inverse of this operation is\nperformed by the UNHEX() function.\n\nMariaDB starting with 10.5.0\n----------------------------\nHEX() with an INET6 argument returns a hexadecimal representation of the\nunderlying 16-byte binary string.\n\nExamples\n--------\n\nSELECT HEX(255);\n+----------+\n| HEX(255) |\n+----------+\n| FF |\n+----------+\n\nSELECT 0x4D617269614442;\n+------------------+\n| 0x4D617269614442 |\n+------------------+\n| MariaDB |\n+------------------+\n\nSELECT HEX(\'MariaDB\');\n+----------------+\n| HEX(\'MariaDB\') |\n+----------------+\n| 4D617269614442 |\n+----------------+\n\nFrom MariaDB 10.5.0:\n\nSELECT HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6));\n+----------------------------------------------+\n| HEX(CAST(\'2001:db8::ff00:42:8329\' AS INET6)) |\n+----------------------------------------------+\n| 20010DB8000000000000FF0000428329 |\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 (649,36,'INSTR','Syntax\n------\n\nINSTR(str,substr)\n\nDescription\n-----------\n\nReturns the position of the first occurrence of substring substr in string\nstr. This is the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nINSTR() performs a case-insensitive search.\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\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\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 (650,36,'LCASE','Syntax\n------\n\nLCASE(str)\n\nDescription\n-----------\n\nLCASE() is a synonym for LOWER().\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 (651,36,'LEFT','Syntax\n------\n\nLEFT(str,len)\n\nDescription\n-----------\n\nReturns the leftmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT LEFT(\'MariaDB\', 5);\n+--------------------+\n| LEFT(\'MariaDB\', 5) |\n+--------------------+\n| Maria |\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 (652,36,'INSERT Function','Syntax\n------\n\nINSERT(str,pos,len,newstr)\n\nDescription\n-----------\n\nReturns the string str, with the substring beginning at position pos and len\ncharacters long replaced by the string newstr. Returns the original string if\npos is not within the length of the string. Replaces the rest of the string\nfrom position pos if len is not within the length of the rest of the string.\nReturns NULL if any argument is NULL.\n\nExamples\n--------\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\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 (653,36,'LENGTH','Syntax\n------\n\nLENGTH(str)\n\nDescription\n-----------\n\nReturns the length of the string str.\n\nIn the default mode, when Oracle mode from MariaDB 10.3 is not set, the length\nis measured in bytes. In this case, a multi-byte character counts as multiple\nbytes. This means that for a string containing five two-byte characters,\nLENGTH() returns 10, whereas CHAR_LENGTH() returns 5.\n\nWhen running Oracle mode from MariaDB 10.3, the length is measured in\ncharacters, and LENGTH is a synonym for CHAR_LENGTH().\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nSELECT LENGTH(\'MariaDB\');\n+-------------------+\n| LENGTH(\'MariaDB\') |\n+-------------------+\n| 7 |\n+-------------------+\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (654,36,'LENGTHB','MariaDB starting with 10.3.1\n----------------------------\nIntroduced in MariaDB 10.3.1 as part of the Oracle compatibility enhancements.\n\nSyntax\n------\n\nLENGTHB(str)\n\nDescription\n-----------\n\nLENGTHB() returns the length of the given string, in bytes. When Oracle mode\nis not set, this is a synonym for LENGTH.\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, LENGTHB() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (655,36,'LIKE','Syntax\n------\n\nexpr LIKE pat [ESCAPE \'escape_char\']\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nDescription\n-----------\n\nTests whether expr matches the pattern pat. Returns either 1 (TRUE) or 0\n(FALSE). Both expr and pat may be any valid expression and are evaluated to\nstrings. Patterns may use the following wildcard characters:\n\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. This is equivalent\nto using the NOT operator on the entire LIKE expression.\n\nIf either the expression or the pattern is NULL, the result is NULL.\n\nLIKE performs case-insensitive substring matches if the collation for the\nexpression and pattern is case-insensitive. For case-sensitive matches,\ndeclare either argument to use a binary collation using COLLATE, or coerce\neither of them to a BINARY string using CAST. Use SHOW COLLATION to get a list\nof available collations. Collations ending in _bin are case-sensitive.\n\nNumeric arguments are coerced to binary strings.\n\nThe _ wildcard matches a single character, not byte. It will only match a\nmulti-byte character if it is valid in the expression\'s character set. For\nexample, _ will match _utf8\"€\", but it will not match _latin1\"€\" because the\nEuro sign is not a valid latin1 character. If necessary, use CONVERT to use\nthe expression in a different character set.\n\nIf you need to match the characters _ or %, you must escape them. By default,\nyou can prefix the wildcard characters the backslash character \\ to escape\nthem. The backslash is used both to encode special characters like newlines\nwhen a string is parsed as well as to escape wildcards in a pattern after\nparsing. Thus, to match an actual backslash, you sometimes need to\ndouble-escape it as \"\\\\\\\\\".\n\nTo avoid difficulties with the backslash character, you can change the\nwildcard escape character using ESCAPE in a LIKE expression. The argument to\nESCAPE must be a single-character string.\n\nExamples\n--------\n\nSelect the days that begin with \"T\":\n\nCREATE TABLE t1 (d VARCHAR(16));\nINSERT INTO t1 VALUES \n (\"Monday\"), (\"Tuesday\"), (\"Wednesday\"),\n (\"Thursday\"), (\"Friday\"), (\"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 case-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 match. Select\ndates based 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---------------\n\n* MariaDB can use indexes for LIKE on string columns in the case where the\nLIKE doesn\'t start with % or _.\n* Starting from MariaDB 10.0, one can set the\noptimizer_use_condition_selectivity variable to 5. If this is done, then the\noptimizer will read optimizer_selectivity_sampling_limit rows to calculate the\nselectivity of the LIKE expression before starting to calculate the query\nplan. This can help speed up some LIKE queries by providing the optimizer with\nmore information about your data.\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 (656,36,'LOCATE','Syntax\n------\n\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nDescription\n-----------\n\nThe first syntax returns the position of the first occurrence of substring\nsubstr in string str. The second syntax returns the position of the first\noccurrence of substring substr in string str, starting at position pos.\nReturns 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 the same as the two-argument form of LOCATE(), except that the\norder of the arguments is reversed.\n\nExamples\n--------\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\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 (657,36,'LOWER','Syntax\n------\n\nLOWER(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to lowercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nExamples\n--------\n\nSELECT LOWER(\'QUADRATICALLY\');\n+------------------------+\n| LOWER(\'QUADRATICALLY\') |\n+------------------------+\n| quadratically |\n+------------------------+\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings (BINARY,\nVARBINARY, BLOB). To 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\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 (658,36,'LPAD','Syntax\n------\n\nLPAD(str, len [,padstr])\n\nDescription\n-----------\n\nReturns the string str, left-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the LPAD 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 empty (zero length),\nreturns either an empty string or, from MariaDB 10.3.6 with SQL_MODE=Oracle,\nNULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LPAD_ORACLE as the function name.\n\nExamples\n--------\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 space.\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\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 (659,36,'LTRIM','Syntax\n------\n\nLTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with leading space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using LTRIM_ORACLE as the function name.\n\nExamples\n--------\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\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 (660,36,'MAKE_SET','Syntax\n------\n\nMAKE_SET(bits,str1,str2,...)\n\nDescription\n-----------\n\nReturns a set value (a string containing substrings separated by \",\"\ncharacters) consisting of the strings that have the corresponding bit in bits\nset. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL values in str1,\nstr2, ... are not appended to the result.\n\nExamples\n--------\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\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 (661,36,'MATCH AGAINST','Syntax\n------\n\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nDescription\n-----------\n\nA special construct used to perform a fulltext search on a fulltext index.\n\nSee Fulltext Index Overview for a full description, and Full-text Indexes for\nmore articles on the topic.\n\nExamples\n--------\n\nCREATE TABLE ft_myisam(copy TEXT,FULLTEXT(copy)) ENGINE=MyISAM;\n\nINSERT INTO ft_myisam(copy) VALUES (\'Once upon a time\'), (\'There was a wicked\nwitch\'), \n (\'Who ate everybody up\');\n\nSELECT * FROM ft_myisam WHERE MATCH(copy) AGAINST(\'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| 6 | When configured properly, MySQL ... | 1.3114095926285 |\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 (662,36,'MID','Syntax\n------\n\nMID(str,pos,len)\n\nDescription\n-----------\n\nMID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).\n\nExamples\n--------\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\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 (663,36,'NATURAL_SORT_KEY','MariaDB starting with 10.7.0\n----------------------------\nNATURAL_SORT_KEY was added in MariaDB 10.7.0.\n\nSyntax\n------\n\nNATURAL_SORT_KEY(str)\n\nDescription\n-----------\n\nThe NATURAL_SORT_KEY function is used for sorting that is closer to natural\nsorting. Strings are sorted in alphabetical order, while numbers are treated\nin a way such that, for example, 10 is greater than 2, whereas in other forms\nof sorting, 2 would be greater than 10, just like z is greater than ya.\n\nThere are multiple natural sort implementations, differing in the way they\nhandle leading zeroes, fractions, i18n, negatives, decimals and so on.\n\nMariaDB\'s implementation ignores leading zeroes when performing the sort.\n\nYou can use also use NATURAL_SORT_KEY with generated columns. The value is not\nstored permanently in the table. When using a generated column, the virtual\ncolumn must be longer than the base column to cater for embedded numbers in\nthe string and MDEV-24582.\n\nExamples\n--------\n\nStrings and Numbers\n-------------------\n\nCREATE TABLE t1 (c TEXT);\n\nINSERT INTO t1 VALUES (\'b1\'),(\'a2\'),(\'a11\'),(\'a1\');\n\nSELECT c FROM t1;\n+------+\n| c |\n+------+\n| b1 |\n| a2 |\n| a11 |\n| a1 |\n+------+\n\nSELECT c FROM t1 ORDER BY c;\n+------+\n| c |\n+------+\n| a1 |\n| a11 |\n| a2 |\n| b1 |\n+------+\n\nUnsorted, regular sort and natural sort:\n\nTRUNCATE t1;\n\nINSERT INTO t1 VALUES \n (\'5.5.31\'),(\'10.7.0\'),(\'10.2.1\'),\n (\'10.1.22\'),(\'10.3.32\'),(\'10.2.12\');\n\nSELECT c FROM t1;\n+---------+\n| c |\n+---------+\n| 5.5.31 |\n| 10.7.0 |\n| 10.2.1 |\n| 10.1.22 |\n| 10.3.32 |\n| 10.2.12 |\n+---------+\n\nSELECT c FROM t1 ORDER BY c;\n+---------+\n| c |\n+---------+\n| 10.1.22 |\n| 10.2.1 |\n| 10.2.12 |\n| 10.3.32 |\n| 10.7.0 |\n| 5.5.31 |\n+---------+\n\nSELECT c FROM t1 ORDER BY NATURAL_SORT_KEY(c);\n+---------+\n| c |\n+---------+\n| 5.5.31 |\n| 10.1.22 |\n| 10.2.1 |\n| 10.2.12 |\n| 10.3.32 |\n| 10.7.0 |\n+---------+\n\nIPs\n---\n\nSorting IPs, unsorted, regular sort and natural sort::\n\nTRUNCATE t1;\n\nINSERT INTO t1 VALUES \n (\'192.167.3.1\'),(\'192.167.1.12\'),(\'100.200.300.400\'),\n (\'100.50.60.70\'),(\'100.8.9.9\'),(\'127.0.0.1\'),(\'0.0.0.0\');\n\nSELECT c FROM t1;\n+-----------------+\n| c |\n+-----------------+\n| 192.167.3.1 |\n| 192.167.1.12 |\n| 100.200.300.400 |\n| 100.50.60.70 |\n| 100.8.9.9 |\n| 127.0.0.1 |\n| 0.0.0.0 |\n+-----------------+\n\nSELECT c FROM t1 ORDER BY c;\n+-----------------+\n| c |\n+-----------------+\n| 0.0.0.0 |\n| 100.200.300.400 |\n| 100.50.60.70 |\n| 100.8.9.9 |\n| 127.0.0.1 |\n| 192.167.1.12 |\n| 192.167.3.1 |\n+-----------------+\n\nSELECT c FROM t1 ORDER BY NATURAL_SORT_KEY(c);\n+-----------------+\n| c |\n+-----------------+\n| 0.0.0.0 |\n| 100.8.9.9 |\n| 100.50.60.70 |\n| 100.200.300.400 |\n| 127.0.0.1 |\n| 192.167.1.12 |\n| 192.167.3.1 |\n+-----------------+\n\nGenerated Columns\n-----------------\n\nUsing with a generated column:\n\nCREATE TABLE t(c VARCHAR(3), k VARCHAR(4) AS (NATURAL_SORT_KEY(c)) INVISIBLE);\n\nINSERT INTO t(c) VALUES (\'b1\'),(\'a2\'),(\'a11\'),(\'a10\');\n\nSELECT * FROM t ORDER by k;\n+------+\n| c |\n+------+\n| a2 |\n| a10 |\n| a11 |\n| b1 |\n+------+\n\nNote that if the virtual column is not longer, results may not be as expected:\n\nCREATE TABLE t2(c VARCHAR(3), k VARCHAR(3) AS (NATURAL_SORT_KEY(c)) INVISIBLE);\n\nINSERT INTO t2(c) VALUES (\'b1\'),(\'a2\'),(\'a11\'),(\'a10\');\n\nSELECT * FROM t2 ORDER by k;\n+------+\n| c |\n+------+\n| a2 |\n| a11 |\n| a10 |\n| b1 |\n+------+\n\nLeading Zeroes\n--------------\n\nIgnoring leading zeroes can lead to undesirable results in certain contexts.\nFor example:\n\nCREATE TABLE t3 (a VARCHAR(4));\n\nINSERT INTO t3 VALUES \n (\'a1\'), (\'a001\'), (\'a10\'), (\'a001\'), (\'a10\'),\n (\'a01\'), (\'a01\'), (\'a01b\'), (\'a01b\'), (\'a1\');\n\nSELECT a FROM t3 ORDER BY a;\n+------+\n| a |\n+------+\n| a001 |\n| a001 |\n| a01 |\n| a01 |\n| a01b |\n| a01b |\n| a1 |\n| a1 |\n| a10 |\n| a10 |\n+------+\n10 rows in set (0.000 sec)\n\nSELECT a FROM t3 ORDER BY NATURAL_SORT_KEY(a);\n+------+\n| a |\n+------+\n| a1 |\n| a01 |\n| a01 |\n| a001 |\n| a001 |\n| a1 |\n| a01b |\n| a01b |\n| a10 |\n| a10 |\n+------+\n\nThis may not be what we were hoping for in a \'natural\' sort. A workaround is\nto sort by both NATURAL_SORT_KEY and regular sort.\n\nSELECT a FROM t3 ORDER BY NATURAL_SORT_KEY(a), a;\n+------+\n| a |\n+------+\n| a001 |\n| a001 |\n| a01 |\n| a01 |\n| a1 |\n| a1 |\n| a01b |\n| a01b |\n| a10 |\n| a10 |\n+------+\n\nURL: https://mariadb.com/kb/en/natural_sort_key/','','https://mariadb.com/kb/en/natural_sort_key/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (664,36,'NOT LIKE','Syntax\n------\n\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nDescription\n-----------\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\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 (665,36,'OCTET_LENGTH','Syntax\n------\n\nOCTET_LENGTH(str)\n\nDescription\n-----------\n\nOCTET_LENGTH() returns the length of the given string, in octets (bytes). This\nis a synonym for LENGTHB(), and, when Oracle mode from MariaDB 10.3 is not\nset, a synonym for LENGTH().\n\nA multi-byte character counts as multiple bytes. This means that for a string\ncontaining five two-byte characters, OCTET_LENGTH() returns 10, whereas\nCHAR_LENGTH() returns 5.\n\nIf str is not a string value, it is converted into a string. If str is NULL,\nthe function returns NULL.\n\nExamples\n--------\n\nWhen Oracle mode from MariaDB 10.3 is not set:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 2 | 2 | 2 |\n+-------------------+--------------+---------------+--------------------+\n\nIn Oracle mode from MariaDB 10.3:\n\nSELECT CHAR_LENGTH(\'Ï€\'), LENGTH(\'Ï€\'), LENGTHB(\'Ï€\'), OCTET_LENGTH(\'Ï€\');\n+-------------------+--------------+---------------+--------------------+\n| CHAR_LENGTH(\'Ï€\') | LENGTH(\'Ï€\') | LENGTHB(\'Ï€\') | OCTET_LENGTH(\'Ï€\') |\n+-------------------+--------------+---------------+--------------------+\n| 1 | 1 | 2 | 2 |\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 (666,36,'ORD','Syntax\n------\n\nORD(str)\n\nDescription\n-----------\n\nIf the leftmost character of the string str is a multi-byte character, returns\nthe code for that character, calculated from the numeric values of its\nconstituent 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, ORD() returns the\nsame value as the ASCII() function.\n\nExamples\n--------\n\nSELECT ORD(\'2\');\n+----------+\n| ORD(\'2\') |\n+----------+\n| 50 |\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 (667,36,'POSITION','Syntax\n------\n\nPOSITION(substr IN str)\n\nDescription\n-----------\n\nPOSITION(substr IN str) is a synonym for LOCATE(substr,str).\n\nIt\'s part of ODBC 3.0.\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 (668,36,'QUOTE','Syntax\n------\n\nQUOTE(str)\n\nDescription\n-----------\n\nQuotes a string to produce a result that can be used as a properly escaped\ndata value in an SQL statement. The string is returned enclosed by single\nquotes and with each instance of single quote (\"\'\"), backslash (\"\\\"), ASCII\nNUL, and Control-Z preceded by a backslash. If the argument is NULL, the\nreturn value is the word \"NULL\" without enclosing single quotes.\n\nExamples\n--------\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\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 (669,36,'REPEAT Function','Syntax\n------\n\nREPEAT(str,count)\n\nDescription\n-----------\n\nReturns a string consisting of the string str repeated count times. If count\nis less than 1, returns an empty string. Returns NULL if str or count are NULL.\n\nExamples\n--------\n\nSELECT QUOTE(REPEAT(\'MariaDB \',4));\n+------------------------------------+\n| QUOTE(REPEAT(\'MariaDB \',4)) |\n+------------------------------------+\n| \'MariaDB MariaDB MariaDB MariaDB \' |\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 (670,36,'REPLACE Function','Syntax\n------\n\nREPLACE(str,from_str,to_str)\n\nDescription\n-----------\n\nReturns the string str with all occurrences of the string from_str replaced by\nthe string to_str. REPLACE() performs a case-sensitive match when searching\nfor from_str.\n\nExamples\n--------\n\nSELECT REPLACE(\'www.mariadb.org\', \'w\', \'Ww\');\n+---------------------------------------+\n| REPLACE(\'www.mariadb.org\', \'w\', \'Ww\') |\n+---------------------------------------+\n| WwWwWw.mariadb.org |\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 (671,36,'REVERSE','Syntax\n------\n\nREVERSE(str)\n\nDescription\n-----------\n\nReturns the string str with the order of the characters reversed.\n\nExamples\n--------\n\nSELECT REVERSE(\'desserts\');\n+---------------------+\n| REVERSE(\'desserts\') |\n+---------------------+\n| stressed |\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 (672,36,'RIGHT','Syntax\n------\n\nRIGHT(str,len)\n\nDescription\n-----------\n\nReturns the rightmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\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 (673,36,'RPAD','Syntax\n------\n\nRPAD(str, len [, padstr])\n\nDescription\n-----------\n\nReturns the string str, right-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the RPAD 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 empty (a length of\nzero), returns either an empty string, or, from MariaDB 10.3.6 with\nSQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RPAD_ORACLE as the function name.\n\nExamples\n--------\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 space.\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\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 (674,36,'RTRIM','Syntax\n------\n\nRTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with trailing space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RTRIM_ORACLE as the function name.\n\nExamples\n--------\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\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 (675,36,'SFORMAT','MariaDB starting with 10.7.0\n----------------------------\nSFORMAT was added in MariaDB 10.7.0.\n\nDescription\n-----------\n\nThe SFORMAT function takes an input string and a formatting specification and\nreturns the string formatted using the rules the user passed in the\nspecification.\n\nIt use the fmtlib library for Python-like (as well as Rust, C++20, etc) string\nformatting.\n\nOnly fmtlib 7.0.0+ is supported.\n\nThere is no native support for temporal and decimal values:\n\n* TIME_RESULT is handled as STRING_RESULT\n* DECIMAL_RESULT as REAL_RESULT\n\nExamples\n--------\n\nSELECT SFORMAT(\"The answer is {}.\", 42);\n+----------------------------------+\n| SFORMAT(\"The answer is {}.\", 42) |\n+----------------------------------+\n| The answer is 42. |\n+----------------------------------+\n\nCREATE TABLE test_sformat(mdb_release char(6), mdev int, feature char(20));\n\nINSERT INTO test_sformat VALUES(\'10.7.0\', 25015, \'Python style sformat\'), \n (\'10.7.0\', 4958, \'UUID\');\n\nSELECT * FROM test_sformat;\n+-------------+-------+----------------------+\n| mdb_release | mdev | feature |\n+-------------+-------+----------------------+\n| 10.7.0 | 25015 | Python style sformat |\n| 10.7.0 | 4958 | UUID |\n+-------------+-------+----------------------+\n\nSELECT SFORMAT(\'MariaDB Server {} has a preview for MDEV-{} which is about\n{}\', \n mdb_release, mdev, feature) AS \'Preview Release Examples\'\n FROM test_sformat;\n+------------------------------------------------------------------------------\n---------+\n| Preview Release Examples \n |\n+------------------------------------------------------------------------------\n---------+\n| MariaDB Server 10.7.0 has a preview for MDEV-25015 which is about Python\nstyle sformat |\n| MariaDB Server 10.7.0 has a preview for MDEV-4958 which is about UUID \n |\n+------------------------------------------------------------------------------\n---------+\n\nURL: https://mariadb.com/kb/en/sformat/','','https://mariadb.com/kb/en/sformat/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (676,36,'SOUNDEX','Syntax\n------\n\nSOUNDEX(str)\n\nDescription\n-----------\n\nReturns a soundex string from str. Two strings that sound almost the same\nshould have identical soundex strings. A standard soundex string is four\ncharacters long, but the SOUNDEX() function returns an arbitrarily long\nstring. You can use SUBSTRING() on the result to get a standard soundex\nstring. All non-alphabetic characters in str are ignored. All international\nalphabetic characters outside the A-Z range are treated as vowels.\n\nImportant: When using SOUNDEX(), you should be aware of the following details:\n\n* This function, as currently implemented, is intended to work well with\n strings that are in the English language only. Strings in other languages may\n not produce reasonable results.\n\n* This function implements the original Soundex algorithm, not the more\npopular enhanced version (also described by D. Knuth). The difference is that\noriginal version discards vowels first and duplicates second, whereas the\nenhanced version discards duplicates first and vowels second.\n\nExamples\n--------\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 SOUNDEX(givenname) =\nSOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\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 (677,36,'SOUNDS LIKE','Syntax\n------\n\nexpr1 SOUNDS LIKE expr2\n\nDescription\n-----------\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nExample\n-------\n\nSELECT givenname, surname FROM users WHERE givenname SOUNDS LIKE \"robert\";\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\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 (678,36,'SPACE','Syntax\n------\n\nSPACE(N)\n\nDescription\n-----------\n\nReturns a string consisting of N space characters. If N is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\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 (679,36,'STRCMP','Syntax\n------\n\nSTRCMP(expr1,expr2)\n\nDescription\n-----------\n\nSTRCMP() returns 0 if the strings are the same, -1 if the first argument is\nsmaller than the second according to the current sort order, and 1 if the\nstrings are otherwise not the same. Returns NULL is either argument is NULL.\n\nExamples\n--------\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\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 (680,36,'SUBSTR','Description\n-----------\n\nSUBSTR() is a synonym for SUBSTRING().\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 (681,36,'SUBSTRING','Syntax\n------\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-----------\n\nThe forms without a len argument return a substring from string str starting\nat position pos.\n\nThe forms with a len argument return a substring len characters long from\nstring 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 case, the\nbeginning of the substring is pos characters from the end of the string,\nrather than the beginning. A negative value may be used for pos in any of the\nforms of this function.\n\nBy default, the position of the first character in the string from which the\nsubstring is to be extracted is reckoned as 1. For Oracle-compatibility, from\nMariaDB 10.3.3, when sql_mode is set to \'oracle\', position zero is treated as\nposition 1 (although the first character is still reckoned as 1).\n\nIf any argument is NULL, returns NULL.\n\nExamples\n--------\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\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 (682,36,'SUBSTRING_INDEX','Syntax\n------\n\nSUBSTRING_INDEX(str,delim,count)\n\nDescription\n-----------\n\nReturns the substring from string str before count occurrences of the\ndelimiter delim. If count is positive, everything to the left of the final\ndelimiter (counting from the left) is returned. If count is negative,\neverything to the right of the final delimiter (counting from the right) is\nreturned. SUBSTRING_INDEX() performs a case-sensitive match when searching for\ndelim.\n\nIf any argument is NULL, returns NULL.\n\nFor example\n\nSUBSTRING_INDEX(\'www.mariadb.org\', \'.\', 2)\n\nmeans \"Return all of the characters up to the 2nd occurrence of .\"\n\nExamples\n--------\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\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 (683,36,'TO_BASE64','Syntax\n------\n\nTO_BASE64(str)\n\nDescription\n-----------\n\nConverts the string argument str to its base-64 encoded form, returning the\nresult as a character string in the connection character set and collation.\n\nThe argument str will be converted to string first if it is not a string. A\nNULL argument will return a NULL result.\n\nThe reverse function, FROM_BASE64(), decodes an encoded base-64 string.\n\nThere are a numerous different methods to base-64 encode a string. The\nfollowing are used by MariaDB and MySQL:\n\n* Alphabet value 64 is encoded as \'+\'.\n* Alphabet value 63 is encoded as \'/\'.\n* Encoding output is made up of groups of four printable characters, with each\nthree bytes of data encoded using four characters. If the final group is not\ncomplete, it is padded with \'=\' characters to make up a length of four.\n* To divide long output, a newline is added after every 76 characters.\n* Decoding will recognize and ignore newlines, carriage returns, tabs, and\nspaces.\n\nExamples\n--------\n\nSELECT TO_BASE64(\'Maria\');\n+--------------------+\n| TO_BASE64(\'Maria\') |\n+--------------------+\n| TWFyaWE= |\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 (684,36,'TO_CHAR','MariaDB starting with 10.6.1\n----------------------------\nThe TO_CHAR function was introduced in MariaDB 10.6.1 to enhance Oracle\ncompatibility.\n\nSyntax\n------\n\nTO_CHAR(expr[, fmt])\n\nDescription\n-----------\n\nThe TO_CHAR function converts an expr of type date, datetime, time or\ntimestamp to a string. The optional fmt argument supports\nYYYY/YYY/YY/RRRR/RR/MM/MON/MONTH/MI/DD/DY/HH/HH12/HH24/SS and special\ncharacters. The default value is \"YYYY-MM-DD HH24:MI:SS\".\n\nIn Oracle, TO_CHAR can also be used to convert numbers to strings, but this is\nnot supported in MariaDB and will give an error.\n\nExamples\n--------\n\nSELECT TO_CHAR(\'1980-01-11 04:50:39\', \'YYYY-MM-DD\');\n+----------------------------------------------+\n| TO_CHAR(\'1980-01-11 04:50:39\', \'YYYY-MM-DD\') |\n+----------------------------------------------+\n| 1980-01-11 |\n+----------------------------------------------+\n\nSELECT TO_CHAR(\'1980-01-11 04:50:39\', \'HH24-MI-SS\');\n+----------------------------------------------+\n| TO_CHAR(\'1980-01-11 04:50:39\', \'HH24-MI-SS\') |\n+----------------------------------------------+\n| 04-50-39 |\n+----------------------------------------------+\n\nSELECT TO_CHAR(\'00-01-01 00:00:00\', \'YY-MM-DD HH24:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'00-01-01 00:00:00\', \'YY-MM-DD HH24:MI:SS\') |\n+-----------------------------------------------------+\n| 00-01-01 00:00:00 |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(\'99-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'99-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\') |\n+-----------------------------------------------------+\n| 99-12-31 23:59:59 |\n+-----------------------------------------------------+\n\nSELECT TO_CHAR(\'9999-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\');\n+-------------------------------------------------------+\n| TO_CHAR(\'9999-12-31 23:59:59\', \'YY-MM-DD HH24:MI:SS\') |\n+-------------------------------------------------------+\n| 99-12-31 23:59:59 |\n+-------------------------------------------------------+\n\nSELECT TO_CHAR(\'21-01-03 08:30:00\', \'Y-MONTH-DY HH:MI:SS\');\n+-----------------------------------------------------+\n| TO_CHAR(\'21-01-03 08:30:00\', \'Y-MONTH-DY HH:MI:SS\') |\n+-----------------------------------------------------+\n| 1-January -Sun 08:30:00 |\n+-----------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/to_char/','','https://mariadb.com/kb/en/to_char/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (685,36,'TRIM','Syntax\n------\n\nTRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str)\n\nFrom MariaDB 10.3.6\n\nTRIM_ORACLE([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr\nFROM] str)\n\nDescription\n-----------\n\nReturns the string str with all remstr prefixes or suffixes removed. If none\nof the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. remstr\nis optional and, if not specified, spaces are removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\nSQL_MODE=Oracle is not set by default.\n\nThe Oracle mode version of the function can be accessed in any mode by using\nTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT TRIM(\' bar \')\\G\n*************************** 1. row ***************************\nTRIM(\' bar \'): bar\n\nSELECT TRIM(LEADING \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row ***************************\nTRIM(LEADING \'x\' FROM \'xxxbarxxx\'): barxxx\n\nSELECT TRIM(BOTH \'x\' FROM \'xxxbarxxx\')\\G\n*************************** 1. row ***************************\nTRIM(BOTH \'x\' FROM \'xxxbarxxx\'): bar\n\nSELECT TRIM(TRAILING \'xyz\' FROM \'barxxyz\')\\G\n*************************** 1. row ***************************\nTRIM(TRAILING \'xyz\' FROM \'barxxyz\'): barx\n\nFrom MariaDB 10.3.6, with SQL_MODE=Oracle not set:\n\nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| | NULL |\n+----------+-----------------+\n\nFrom MariaDB 10.3.6, with SQL_MODE=Oracle set:\n\nSELECT TRIM(\'\'),TRIM_ORACLE(\'\');\n+----------+-----------------+\n| TRIM(\'\') | TRIM_ORACLE(\'\') |\n+----------+-----------------+\n| NULL | NULL |\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 (686,36,'UCASE','Syntax\n------\n\nUCASE(str)\n\nDescription\n-----------\n\nUCASE() is a synonym for UPPER().\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 (687,36,'UNCOMPRESSED_LENGTH','Syntax\n------\n\nUNCOMPRESSED_LENGTH(compressed_string)\n\nDescription\n-----------\n\nReturns the length that the compressed string had before being compressed with\nCOMPRESS().\n\nUNCOMPRESSED_LENGTH() returns NULL or an incorrect result if the string is not\ncompressed.\n\nUntil MariaDB 10.3.1, returns MYSQL_TYPE_LONGLONG, or bigint(10), in all\ncases. From MariaDB 10.3.1, returns MYSQL_TYPE_LONG, or int(10), when the\nresult would fit within 32-bits.\n\nExamples\n--------\n\nSELECT UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30)));\n+-----------------------------------------------+\n| UNCOMPRESSED_LENGTH(COMPRESS(REPEAT(\'a\',30))) |\n+-----------------------------------------------+\n| 30 |\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 (688,36,'UNHEX','Syntax\n------\n\nUNHEX(str)\n\nDescription\n-----------\n\nPerforms the inverse operation of HEX(str). That is, it interprets each pair\nof hexadecimal digits in the argument as a number and converts it to the\ncharacter represented by the number. The resulting characters are returned as\na binary string.\n\nIf str is NULL, UNHEX() returns NULL.\n\nExamples\n--------\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| 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\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 (689,36,'UPDATEXML','Syntax\n------\n\nUpdateXML(xml_target, xpath_expr, new_xml)\n\nDescription\n-----------\n\nThis function replaces a single portion of a given fragment of XML markup\nxml_target with a new XML fragment new_xml, and then returns the changed XML.\nThe portion of xml_target that is replaced matches an XPath expression\nxpath_expr supplied by the user. If no expression matching xpath_expr is\nfound, or if multiple matches are found, the function returns the original\nxml_target XML fragment. All three arguments should be strings.\n\nExamples\n--------\n\nSELECT\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a\', \'<e>fff</e>\') AS val1,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/b\', \'<e>fff</e>\') AS val2,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'//b\', \'<e>fff</e>\') AS val3,\n UpdateXML(\'<a><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val4,\n UpdateXML(\'<a><d></d><b>ccc</b><d></d></a>\', \'/a/d\', \'<e>fff</e>\') AS val5\n \\G\n*************************** 1. row ***************************\nval1: <e>fff</e>\nval2: <a><b>ccc</b><d></d></a>\nval3: <a><e>fff</e><d></d></a>\nval4: <a><b>ccc</b><e>fff</e></a>\nval5: <a><d></d><b>ccc</b><d></d></a>\n1 row in set (0.00 sec)\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 (690,36,'UPPER','Syntax\n------\n\nUPPER(str)\n\nDescription\n-----------\n\nReturns the string str with all characters changed to uppercase according to\nthe current character set mapping. The default is latin1 (cp1252 West\nEuropean).\n\nSELECT UPPER(surname), givenname FROM users ORDER BY surname;\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 (BINARY, VARBINARY,\nBLOB). The description of LOWER() shows how to perform lettercase conversion\nof binary strings.\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 (691,36,'WEIGHT_STRING','Syntax\n------\n\nWEIGHT_STRING(str [AS {CHAR|BINARY}(N)] [LEVEL levels] [flags])\n levels: N [ASC|DESC|REVERSE] [, N [ASC|DESC|REVERSE]] ...\n\nDescription\n-----------\n\nReturns a binary string representing the string\'s sorting and comparison\nvalue. A string with a lower result means that for sorting purposes the string\nappears before a string with a higher result.\n\nWEIGHT_STRING() is particularly useful when adding new collations, for testing\npurposes.\n\nIf str is a non-binary string (CHAR, VARCHAR or TEXT), WEIGHT_STRING returns\nthe string\'s collation weight. If str is a binary string (BINARY, VARBINARY or\nBLOB), the return value 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 binary or\nnon-binary string, as well as to a particular length.\n\nAS BINARY(N) measures the length in bytes rather than characters, and right\npads with 0x00 bytes to the desired length.\n\nAS CHAR(N) measures the length in characters, and right pads with spaces to\nthe desired length.\n\nN has a minimum value of 1, and if it is less than the length of the input\nstring, the string is truncated without warning.\n\nThe optional LEVEL clause specifies that the return value should contain\nweights for specific collation levels. The levels specifier can either be a\nsingle integer, a comma-separated list of integers, or a range of integers\nseparated by a dash (whitespace is ignored). Integers can range from 1 to a\nmaximum of 6, dependent on the collation, and need to be listed in ascending\norder.\n\nIf the LEVEL clause is no provided, a default of 1 to the maximum for the\ncollation is assumed.\n\nIf the LEVEL is specified without using a range, an optional modifier is\npermitted.\n\nASC, the default, returns the weights without any modification.\n\nDESC returns bitwise-inverted weights.\n\nREVERSE returns the weights in reverse order.\n\nExamples\n--------\n\nThe examples below use the HEX() function to represent non-printable results\nin 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\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 (692,36,'Type Conversion','Implicit type conversion takes place when MariaDB is using operands or\ndifferent types, in order to make the operands compatible.\n\nIt is best practice not to rely upon implicit conversion; rather use CAST to\nexplicitly convert types.\n\nRules for Conversion on Comparison\n----------------------------------\n\n* If either argument is NULL, the result of the comparison is NULL unless the\nNULL-safe <=> equality comparison operator is used.\n* If both arguments are integers, they are compared as integers.\n* If both arguments are strings, they are compared as strings.\n* If one argument is decimal and the other argument is decimal or integer,\nthey are compared as decimals.\n* If one argument is decimal and the other argument is a floating point, they\nare compared as floating point values.\n* If one argument is string and the other argument is integer, they are\ncompared as decimals. This conversion was added in MariaDB 10.3.36. Prior to\n10.3.36, this combination was compared as floating point values, which did not\nalways work well for huge 64-bit integers because of a possible precision loss\non conversion to double.\n* If a hexadecimal argument is not compared to a number, it is treated as a\nbinary string.\n* If a constant is compared to a TIMESTAMP or DATETIME, the constant is\nconverted to a timestamp, unless used as an argument to the IN function.\n* In other cases, arguments are compared as floating point, or real, numbers.\n\nNote that if a string column is being compared with a numeric value, MariaDB\nwill not use the index on the column, as there are numerous alternatives that\nmay evaluate as equal (see examples below).\n\nComparison Examples\n-------------------\n\nConverting a string to a number:\n\nSELECT 15+\'15\';\n+---------+\n| 15+\'15\' |\n+---------+\n| 30 |\n+---------+\n\nConverting a number to a string:\n\nSELECT CONCAT(15,\'15\');\n+-----------------+\n| CONCAT(15,\'15\') |\n+-----------------+\n| 1515 |\n+-----------------+\n\nFloating point number errors:\n\nSELECT \'9746718491924563214\' = 9746718491924563213;\n+---------------------------------------------+\n| \'9746718491924563214\' = 9746718491924563213 |\n+---------------------------------------------+\n| 1 |\n+---------------------------------------------+\n\nNumeric equivalence with strings:\n\nSELECT \'5\' = 5;\n+---------+\n| \'5\' = 5 |\n+---------+\n| 1 |\n+---------+\n\nSELECT \' 5\' = 5;\n+------------+\n| \' 5\' = 5 |\n+------------+\n| 1 |\n+------------+\n\nSELECT \' 5 \' = 5;\n+--------------+\n| \' 5 \' = 5 |\n+--------------+\n| 1 |\n+--------------+\n1 row in set, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+--------------------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------------------+\n| Note | 1292 | Truncated incorrect DOUBLE value: \' 5 \' |\n+-------+------+--------------------------------------------+\n\nAs a result of the above, MariaDB cannot use the index when comparing a string\nwith a numeric value in the example below:\n\nCREATE TABLE t (a VARCHAR(10), b VARCHAR(10), INDEX idx_a (a));\n\nINSERT INTO t VALUES \n (\'1\', \'1\'), (\'2\', \'2\'), (\'3\', \'3\'),\n (\'4\', \'4\'), (\'5\', \'5\'), (\'1\', \'5\');\n\nEXPLAIN SELECT * FROM t WHERE a = \'3\' \\G\n*************************** 1. row ***************************\n id: 1\n select_type: SIMPLE\n table: t\n type: ref\npossible_keys: idx_a\n key: idx_a\n key_len: 13\n ref: const\n rows: 1\n Extra: Using index condition\n\nEXPLAIN SELECT * FROM t WHERE a = 3 \\G\n*************************** 1. row ***************************\n id: 1\n select_type: SIMPLE\n table: t\n type: ALL\npossible_keys: idx_a\n key: NULL\n key_len: NULL\n ref: NULL\n rows: 6\n Extra: Using where\n\nRules for Conversion on Dyadic Arithmetic Operations\n----------------------------------------------------\n\nImplicit type conversion also takes place on dyadic arithmetic operations\n(+,-,*,/). MariaDB chooses the minimum data type that is guaranteed to fit the\nresult and converts both arguments to the result data type.\n\nFor addition (+), subtraction (-) and multiplication (*), the result data type\nis chosen as follows:\n\n* If either of the arguments is an approximate number (float, double), the\nresult is double.\n* If either of the arguments is a string (char, varchar, text), the result is\ndouble.\n* If either of the arguments is a decimal number, the result is decimal.\n* If either of the arguments is of a temporal type with a non-zero fractional\nsecond precision (time(N), datetime(N), timestamp(N)), the result is decimal.\n* If either of the arguments is of a temporal type with a zero fractional\nsecond precision (time(0), date, datetime(0), timestamp(0)), the result may\nvary between int, int unsigned, bigint or bigint unsigned, depending on the\nexact data type combination.\n* If both arguments are integer numbers (tinyint, smallint, mediumint,\nbigint), the result may vary between int, int unsigned, bigint or bigint\nunsigned, depending of the exact data types and their signs.\n\nFor division (/), the result data type is chosen as follows:\n\n* If either of the arguments is an approximate number (float, double), the\nresult is double.\n* If either of the arguments is a string (char, varchar, text), the result is\ndouble.\n* Otherwise, the result is decimal.\n\nArithmetic Examples\n-------------------\n\nNote, the above rules mean that when an argument of a temporal data type\nappears in addition or subtraction, it\'s treated as a number by default.\n\nSELECT TIME\'10:20:30\' + 1;\n+--------------------+\n| TIME\'10:20:30\' + 1 |\n+--------------------+\n| 102031 |\n+--------------------+\n\nIn order to do temporal addition or subtraction instead, use the DATE_ADD() or\nDATE_SUB() functions, or an INTERVAL expression as the second argument:\n\nSELECT TIME\'10:20:30\' + INTERVAL 1 SECOND;\n+------------------------------------+\n| TIME\'10:20:30\' + INTERVAL 1 SECOND |\n+------------------------------------+\n| 10:20:31 |\n+------------------------------------+\n\nSELECT \"2.2\" + 3;\n+-----------+\n| \"2.2\" + 3 |\n+-----------+\n| 5.2 |\n+-----------+\n\nSELECT 2.2 + 3;\n+---------+\n| 2.2 + 3 |\n+---------+\n| 5.2 |\n+---------+\n\nSELECT 2.2 / 3;\n+---------+\n| 2.2 / 3 |\n+---------+\n| 0.73333 |\n+---------+\n\nSELECT \"2.2\" / 3;\n+--------------------+\n| \"2.2\" / 3 |\n+--------------------+\n| 0.7333333333333334 |\n+--------------------+\n\nURL: https://mariadb.com/kb/en/type-conversion/','','https://mariadb.com/kb/en/type-conversion/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (693,37,'_rowid','Syntax\n------\n\n_rowid\n\nDescription\n-----------\n\nThe _rowid pseudo column is mapped to the primary key in the related table.\nThis can be used as a replacement of the rowid pseudo column in other\ndatabases. Another usage is to simplify sql queries as one doesn\'t have to\nknow the name of the primary key.\n\nExamples\n--------\n\ncreate table t1 (a int primary key, b varchar(80));\ninsert into t1 values (1,\"one\"),(2,\"two\");\nselect * from t1 where _rowid=1;\n\n+---+------+\n| a | b |\n+---+------+\n| 1 | one |\n+---+------+\n\nupdate t1 set b=\"three\" where _rowid=2;\nselect * from t1 where _rowid>=1 and _rowid<=10;\n\n+---+-------+\n| a | b |\n+---+-------+\n| 1 | one |\n| 2 | three |\n+---+-------+\n\nURL: https://mariadb.com/kb/en/_rowid/','','https://mariadb.com/kb/en/_rowid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (694,38,'ALTER TABLE','Syntax\n------\n\nALTER [ONLINE] [IGNORE] TABLE [IF EXISTS] tbl_name\n [WAIT n | NOWAIT]\n alter_specification [, alter_specification] ...\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 column_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] (index_col_name,...)\n reference_definition\n | ADD PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\n | ALTER [COLUMN] col_name SET DEFAULT literal | (expression)\n | ALTER [COLUMN] col_name DROP DEFAULT\n | ALTER {INDEX|KEY} index_name [NOT] INVISIBLE\n | CHANGE [COLUMN] [IF EXISTS] old_col_name new_col_name column_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 | RENAME COLUMN old_col_name TO new_col_name\n | RENAME {INDEX|KEY} old_index_name TO new_index_name\n | CONVERT TO CHARACTER SET charset_name [COLLATE collation_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 [IF NOT EXISTS] (partition_definition)\n | DROP PARTITION [IF EXISTS] partition_names\n | COALESCE PARTITION number\n | REORGANIZE PARTITION [partition_names INTO (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\nindex_col_name:\n col_name [(length)] [ASC | DESC]\nindex_type:\n USING {BTREE | HASH | RTREE}\nindex_option:\n [ KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n | COMMENT \'string\'\n | CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\ntable_options:\n table_option [[,] table_option] ...\n\nDescription\n-----------\n\nALTER TABLE enables you to change the structure of an existing table. For\nexample, you can add or delete columns, create or destroy indexes, change the\ntype of existing columns, or rename columns or the table itself. You can also\nchange the comment for the table and the storage engine of the table.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nWhen adding a UNIQUE index on a column (or a set of columns) which have\nduplicated values, an error will be produced and the statement will be\nstopped. To suppress the error and force the creation of UNIQUE indexes,\ndiscarding duplicates, the IGNORE option can be specified. This can be useful\nif a column (or a set of columns) should be UNIQUE but it contains duplicate\nvalues; however, this technique provides no control on which rows are\npreserved and which are deleted. Also, note that IGNORE is accepted but\nignored in ALTER TABLE ... EXCHANGE PARTITION statements.\n\nThis statement can also be used to rename a table. For details see RENAME\nTABLE.\n\nWhen an index is created, the storage engine may use a configurable buffer in\nthe process. Incrementing the buffer speeds up the index creation. Aria and\nMyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or\nmyisam_sort_buffer_size, also used for REPAIR TABLE. InnoDB allocates three\nbuffers whose size is defined by innodb_sort_buffer_size.\n\nPrivileges\n----------\n\nExecuting the ALTER TABLE statement generally requires at least the ALTER\nprivilege for the table or the database..\n\nIf you are renaming a table, then it also requires the DROP, CREATE and INSERT\nprivileges for the table or the database as well.\n\nOnline DDL\n----------\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nALTER ONLINE TABLE\n------------------\n\nALTER ONLINE TABLE also works for partitioned tables.\n\nOnline ALTER TABLE is available by executing the following:\n\nALTER ONLINE TABLE ...;\n\nThis statement has the following semantics:\n\nThis statement is equivalent to the following:\n\nALTER TABLE ... LOCK=NONE;\n\nSee the LOCK alter specification for more information.\n\nThis statement is equivalent to the following:\n\nALTER TABLE ... ALGORITHM=INPLACE;\n\nSee the ALGORITHM alter specification for more information.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nIF EXISTS\n---------\n\nThe IF EXISTS and IF NOT EXISTS clauses are available 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]\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, queries will not report\nerrors when the condition is triggered for that clause. A warning with the\nsame message text will be issued and the ALTER will move on to the next clause\nin the statement (or end if finished).\n\nMariaDB starting with 10.5.2\n----------------------------\nIf this is directive is used after ALTER ... TABLE, one will not get an error\nif the table doesn\'t exist.\n\nColumn Definitions\n------------------\n\nSee CREATE TABLE: Column Definitions for information about column definitions.\n\nIndex Definitions\n-----------------\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nThe CREATE INDEX and DROP INDEX statements can also be used to add or remove\nan index.\n\nCharacter Sets and Collations\n-----------------------------\n\nCONVERT TO CHARACTER SET charset_name [COLLATE collation_name]\n[DEFAULT] CHARACTER SET [=] charset_name\n[DEFAULT] COLLATE [=] collation_name\nSee Setting Character Sets and Collations for details on setting the character\nsets and collations.\n\nAlter Specifications\n--------------------\n\nTable Options\n-------------\n\nSee CREATE TABLE: Table Options for information about table options.\n\nADD COLUMN\n----------\n\n... ADD COLUMN [IF NOT EXISTS] (col_name column_definition,...)\nAdds a column to the table. The syntax is the same as in CREATE TABLE. If you\nare using IF NOT_EXISTS the column will not be added if it was not there\nalready. This is very useful when doing scripts to modify tables.\n\nThe FIRST and AFTER clauses affect the physical order of columns in the\ndatafile. Use FIRST to add a column in the first (leftmost) position, or AFTER\nfollowed by a column name to add the new column in any other position. Note\nthat, nowadays, the physical position of a column is usually irrelevant.\n\nSee also Instant ADD COLUMN for InnoDB.\n\nDROP COLUMN\n-----------\n\n... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]\nDrops the column from the table. If you are using IF EXISTS you will not get\nan error if the column didn\'t exist. If the column is part of any index, the\ncolumn will be dropped from them, except if you add a new column with\nidentical name at the same time. The index will be dropped if all columns from\nthe index were dropped. If the column was used in a view or trigger, you will\nget an error next time the view or trigger is accessed.\n\nMariaDB starting with 10.2.8\n----------------------------\nDropping a column that is part of a multi-column UNIQUE constraint is not\npermitted. 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 constraint that\nall values in column b be unique. In order to drop the column, an explicit\nDROP PRIMARY KEY and ADD PRIMARY KEY would be required. Up until MariaDB\n10.2.7, the column 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 starting with 10.4.0\n----------------------------\nMariaDB 10.4.0 supports instant DROP COLUMN. DROP COLUMN of an indexed column\nwould imply DROP INDEX (and in the case of a non-UNIQUE multi-column index,\npossibly ADD INDEX). These will not be allowed with ALGORITHM=INSTANT, but\nunlike before, they can be allowed with ALGORITHM=NOCOPY\n\nRESTRICT and CASCADE are allowed to make porting from other database systems\neasier. In MariaDB, they do nothing.\n\nMODIFY COLUMN\n-------------\n\nAllows you to modify the type of a column. The column will be at the same\nplace as the original column and all indexes on the column will be kept. Note\nthat when modifying column, you should specify all attributes for the new\ncolumn.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY((a));\nALTER TABLE t1 MODIFY a BIGINT UNSIGNED AUTO_INCREMENT;\n\nCHANGE COLUMN\n-------------\n\nWorks like MODIFY COLUMN except that you can also change the name of the\ncolumn. The column will be at the same place as the original column and all\nindex on the column will be kept.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a));\nALTER TABLE t1 CHANGE a b BIGINT UNSIGNED AUTO_INCREMENT;\n\nALTER COLUMN\n------------\n\nThis lets you change column options.\n\nCREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT, b varchar(50), PRIMARY KEY(a));\nALTER TABLE t1 ALTER b SET DEFAULT \'hello\';\n\nRENAME INDEX/KEY\n----------------\n\nMariaDB starting with 10.5.2\n----------------------------\nFrom MariaDB 10.5.2, it is possible to rename an index using the RENAME INDEX\n(or RENAME KEY) syntax, for example:\n\nALTER TABLE t1 RENAME INDEX i_old TO i_new;\n\nRENAME COLUMN\n-------------\n\nMariaDB starting with 10.5.2\n----------------------------\nFrom MariaDB 10.5.2, it is possible to rename a column using the RENAME COLUMN\nsyntax, for example:\n\nALTER TABLE t1 RENAME COLUMN c_old TO c_new;\n\nADD PRIMARY KEY\n---------------\n\nAdd a primary key.\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nsilently ignored, and the name of the index is always PRIMARY.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nDROP PRIMARY KEY\n----------------\n\nDrop a primary key.\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nsilently ignored, and the name of the index is always PRIMARY.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nADD FOREIGN KEY\n---------------\n\nAdd a foreign key.\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is implemented only for the legacy PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nDROP FOREIGN KEY\n----------------\n\nDrop a foreign key.\n\nSee Foreign Keys for more information.\n\nADD INDEX\n---------\n\nAdd a plain index.\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nDROP INDEX\n----------\n\nDrop a plain index.\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nADD UNIQUE INDEX\n----------------\n\nAdd a unique index.\n\nThe UNIQUE keyword means that the index will not accept duplicated values,','','https://mariadb.com/kb/en/alter-table/');
+update help_topic set description = CONCAT(description, '\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nDROP UNIQUE INDEX\n-----------------\n\nDrop a unique index.\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nADD FULLTEXT INDEX\n------------------\n\nAdd a FULLTEXT index.\n\nSee Full-Text Indexes for more information.\n\nDROP FULLTEXT INDEX\n-------------------\n\nDrop a FULLTEXT index.\n\nSee Full-Text Indexes for more information.\n\nADD SPATIAL INDEX\n-----------------\n\nAdd a SPATIAL index.\n\nSee SPATIAL INDEX for more information.\n\nDROP SPATIAL INDEX\n------------------\n\nDrop a SPATIAL index.\n\nSee SPATIAL INDEX for more information.\n\nENABLE/ DISABLE KEYS\n--------------------\n\nDISABLE KEYS will disable all non unique keys for the table for storage\nengines that support this (at least MyISAM and Aria). This can be used to\nspeed up inserts into empty tables.\n\nENABLE KEYS will enable all disabled keys.\n\nRENAME TO\n---------\n\nRenames the table. See also RENAME TABLE.\n\nADD CONSTRAINT\n--------------\n\nModifies the table adding a constraint on a particular column or columns.\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 introduced new ways to define a constraint.\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in syntax,\nbut ignored.\n\nALTER TABLE table_name \nADD CONSTRAINT [constraint_name] CHECK(expression);\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraint fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDF\'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 in the ALTER TABLE\nstatement, MariaDB auto-generates a name for you. This is done so that you can\nremove it later using DROP CONSTRAINT clause.\n\nYou can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. You may find this useful when loading a table\nthat violates some constraints that you want to later find and fix in SQL.\n\nTo view constraints on a table, query information_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---------------\n\nMariaDB starting with 10.2.22\n-----------------------------\nDROP CONSTRAINT for UNIQUE and FOREIGN KEY constraints was introduced in\nMariaDB 10.2.22 and MariaDB 10.3.13.\n\nMariaDB starting with 10.2.1\n----------------------------\nDROP CONSTRAINT for CHECK constraints was introduced in MariaDB 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 CREATE TABLE or ALTER\nTABLE...ADD CONSTRAINT statement, you can either set a constraint_name\nyourself, or allow MariaDB to auto-generate one for you. To view constraints\non a table, query information_schema.TABLE_CONSTRAINTS. For instance,\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 TABLE...DROP CONSTRAINT\nstatement. For example,\n\nALTER TABLE t DROP CONSTRAINT is_unique;\n\nADD SYSTEM VERSIONING\n---------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nAdd system versioning.\n\nDROP SYSTEM VERSIONING\n----------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nDrop system versioning.\n\nADD PERIOD FOR SYSTEM_TIME\n--------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSystem-versioned tables was added in MariaDB 10.3.4.\n\nFORCE\n-----\n\nALTER TABLE ... FORCE can force MariaDB to re-build the table.\n\nIn MariaDB 5.5 and before, this could only be done by setting the ENGINE table\noption to its old value. For example, for an InnoDB table, one could execute\nthe following:\n\nALTER TABLE tab_name ENGINE = InnoDB;\n\nThe FORCE option can be used instead. For example, :\n\nALTER TABLE tab_name FORCE;\n\nWith InnoDB, the table rebuild will only reclaim unused space (i.e. the space\npreviously used for deleted rows) if the innodb_file_per_table system variable\nis set to ON. If the system variable is OFF, then the space will not be\nreclaimed, but it will be-re-used for new data that\'s later added.\n\nEXCHANGE PARTITION\n------------------\n\nThis is used to exchange the tablespace files between a partition and another\ntable.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nDISCARD TABLESPACE\n------------------\n\nThis is used to discard an InnoDB table\'s tablespace.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nIMPORT TABLESPACE\n-----------------\n\nThis is used to import an InnoDB table\'s tablespace. The tablespace should\nhave been copied from its original server after executing FLUSH TABLES FOR\nEXPORT.\n\nSee copying InnoDB\'s transportable tablespaces for more information.\n\nALTER TABLE ... IMPORT only applies to InnoDB tables. Most other popular\nstorage engines, such as Aria and MyISAM, will recognize their data files as\nsoon as they\'ve been placed in the proper directory under the datadir, and no\nspecial DDL is required to import them.\n\nALGORITHM\n---------\n\nThe ALTER TABLE statement supports the ALGORITHM clause. This clause is one of\nthe clauses that is used to implement online DDL. ALTER TABLE supports several\ndifferent algorithms. An algorithm can be explicitly chosen for an ALTER TABLE\noperation by setting the ALGORITHM clause. The supported values are:\n\n* ALGORITHM=DEFAULT - This implies the default behavior for the specific\nstatement, such as if no ALGORITHM clause is specified.\n* ALGORITHM=COPY\n* ALGORITHM=INPLACE\n* ALGORITHM=NOCOPY - This was added in MariaDB 10.3.7.\n* ALGORITHM=INSTANT - This was added in MariaDB 10.3.7.\n\nSee InnoDB Online DDL Overview: ALGORITHM for information on how the ALGORITHM\nclause affects InnoDB.\n\nALGORITHM=DEFAULT\n-----------------\n\nThe default behavior, which occurs if ALGORITHM=DEFAULT is specified, or if\nALGORITHM is not specified at all, usually only makes a copy if the operation\ndoesn\'t support being done 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 old_alter_table\nsystem variable is set to ON, then the default behavior is to perform ALTER\nTABLE operations by making a copy of the table using the old algorithm.\n\nIn MariaDB 10.3.7 and later, the old_alter_table system variable is\ndeprecated. Instead, the alter_algorithm system variable defines the default\nalgorithm for ALTER TABLE operations.\n\nALGORITHM=COPY\n--------------\n\nALGORITHM=COPY is the name for the original ALTER TABLE algorithm from early\nMariaDB versions.\n\nWhen ALGORITHM=COPY is set, MariaDB essentially does the following 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 original one\nRENAME TABLE tmp_tab TO original_tab;\n\nThis algorithm is very inefficient, but it is generic, so it works for all\nstorage engines.\n\nIf ALGORITHM=COPY is specified, then the copy algorithm will be used even if\nit is not necessary. This can result in a lengthy table copy. If multiple\nALTER TABLE operations are required that each require the table to be rebuilt,\nthen it is best to specify all operations in a single ALTER TABLE statement,\nso that the table is only rebuilt once.\n\nALGORITHM=INPLACE\n-----------------\n\nALGORITHM=COPY can be incredibly slow, because the whole table has to be\ncopied and rebuilt. ALGORITHM=INPLACE was introduced as a way to avoid this by\nperforming operations in-place and avoiding the table copy and rebuild, when\npossible.\n\nWhen ALGORITHM=INPLACE is set, the underlying storage engine uses\noptimizations to perform the operation while avoiding the table copy and\nrebuild. However, INPLACE is a bit of a misnomer, since some operations may\nstill require the table to be rebuilt for some storage engines. Regardless,\nseveral operations can be performed without a full copy of the table for some\nstorage engines.\n\nA more accurate name would have been ALGORITHM=ENGINE, where ENGINE refers to\nan \"engine-specific\" algorithm.\n\nIf an ALTER TABLE operation supports ALGORITHM=INPLACE, then it can be\nperformed using optimizations by the underlying storage engine, but it may\nrebuilt.\n\nSee InnoDB Online DDL Operations with ALGORITHM=INPLACE for more.\n\nALGORITHM=NOCOPY\n----------------\n\nALGORITHM=NOCOPY was introduced in MariaDB 10.3.7.\n\nALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has\nto rebuild the clustered index, because when the clustered index has to be\nrebuilt, the whole table has to be rebuilt. ALGORITHM=NOCOPY was introduced as\na way to avoid this.\n\nIf an ALTER TABLE operation supports ALGORITHM=NOCOPY, then it can be\nperformed without rebuilding the clustered index.\n\nIf ALGORITHM=NOCOPY is specified for an ALTER TABLE operation that does not\nsupport ALGORITHM=NOCOPY, then an error will be raised. In this case, raising\nan error is preferable, if the alternative is for the operation to rebuild the\nclustered index, and perform unexpectedly slowly.\n\nSee InnoDB Online DDL Operations with ALGORITHM=NOCOPY for more.\n\nALGORITHM=INSTANT\n-----------------\n\nALGORITHM=INSTANT was introduced in MariaDB 10.3.7.\n\nALGORITHM=INPLACE can sometimes be surprisingly slow in instances where it has\nto modify data files. ALGORITHM=INSTANT was introduced as a way to avoid this.\n\nIf an ALTER TABLE operation supports ALGORITHM=INSTANT, then it can be\nperformed without modifying any data files.\n\nIf ALGORITHM=INSTANT is specified for an ALTER TABLE operation that does not\nsupport ALGORITHM=INSTANT, then an error will be raised. In this case, raising\nan error is preferable, if the alternative is for the operation to modify data\nfiles, and perform unexpectedly slowly.\n\nSee InnoDB Online DDL Operations with ALGORITHM=INSTANT for more.\n\nLOCK\n----\n\nThe ALTER TABLE statement supports the LOCK clause. This clause is one of the\nclauses that is used to implement online DDL. ALTER TABLE supports several\ndifferent locking strategies. A locking strategy can be explicitly chosen for\nan ALTER TABLE operation by setting the LOCK clause. The supported values are:\n\n* DEFAULT: Acquire the least restrictive lock on the table that is supported\nfor the specific operation. Permit the maximum amount of concurrency that is\nsupported for the specific operation.\n* NONE: Acquire no lock on the table. Permit all concurrent DML. If this\nlocking strategy is not permitted for an operation, then an error is raised.\n* SHARED: Acquire a read lock on the table. Permit read-only concurrent DML.\nIf this locking strategy is not permitted for an operation, then an error is\nraised.\n* EXCLUSIVE: Acquire a write lock on the table. Do not permit concurrent DML.\n\nDifferent storage engines support different locking strategies for different\noperations. If a specific locking strategy is chosen for an ALTER TABLE\noperation, and that table\'s storage engine does not support that locking\nstrategy for that specific operation, then an error will be raised.\n\nIf the LOCK clause is not explicitly set, then the operation uses LOCK=DEFAULT.\n\nALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore, the ALTER ONLINE\nTABLE statement can be used to ensure that your ALTER TABLE operation allows\nall concurrent DML.\n\nSee InnoDB Online DDL Overview: LOCK for information on how the LOCK clause\naffects InnoDB.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for ALTER TABLE statement for clients that\nsupport the new progress reporting protocol. For example, if you were using\nthe mysql client, then the progress 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 PROCESSLIST\nstatement and in the contents of the information_schema.PROCESSLIST table.\n\nSee Progress Reporting for more information.\n\nAborting ALTER TABLE Operations\n-------------------------------\n\nIf an ALTER TABLE operation is being performed and the connection is killed,\nthe changes will be rolled back in a controlled manner. The rollback can be a') WHERE help_topic_id = 694;
+update help_topic set description = CONCAT(description, '\nslow operation as the time it takes is relative to how far the operation has\nprogressed.\n\nMariaDB starting with 10.2.13\n-----------------------------\nAborting ALTER TABLE ... ALGORITHM=COPY was made faster by removing excessive\nundo logging (MDEV-11415). This significantly shortens the time it takes to\nabort a running ALTER TABLE operation.\n\nAtomic ALTER TABLE\n------------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, ALTER TABLE is atomic for most engines, including InnoDB,\nMyRocks, MyISAM and Aria (MDEV-25180). This means that if there is a crash\n(server down or power outage) during an ALTER TABLE operation, after recovery,\neither the old table and associated triggers and status will be intact, or the\nnew table will be active.\n\nIn older MariaDB versions one could get leftover #sql-alter..\',\n\'#sql-backup..\' or \'table_name.frmË\' files if the system crashed during the\nALTER TABLE operation.\n\nSee Atomic DDL for more information.\n\nReplication\n-----------\n\nMariaDB starting with 10.8.0\n----------------------------\nBefore MariaDB 10.8.0, ALTER TABLE got fully executed on the primary first,\nand only then was it replicated and started executing on replicas. From\nMariaDB 10.8.0, ALTER TABLE gets replicated and starts executing on replicas\nwhen it starts executing on the primary, not when it finishes. This way the\nreplication lag caused by a heavy ALTER TABLE can be completely eliminated\n(MDEV-11675).\n\nExamples\n--------\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 statement, separated by\ncommas:\n\nALTER TABLE t1 DROP x, ADD x2 INT, CHANGE y y2 INT;\n\nChanging the storage engine and adding a comment:\n\nALTER TABLE t1 \n ENGINE = InnoDB\n COMMENT = \'First of three tables containing usage info\';\n\nRebuilding the table (the previous example will also rebuild the table if it\nwas already InnoDB):\n\nALTER TABLE t1 FORCE;\n\nDropping an index:\n\nALTER TABLE rooms DROP INDEX u;\n\nAdding a unique index:\n\nALTER TABLE rooms ADD UNIQUE INDEX u(room_number);\n\nFrom MariaDB 10.5.3, adding a primary key for an application-time period table\nwith a WITHOUT OVERLAPS constraint:\n\nALTER TABLE rooms ADD PRIMARY KEY(room_number, p WITHOUT OVERLAPS);\n\nURL: https://mariadb.com/kb/en/alter-table/') WHERE help_topic_id = 694;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (695,38,'ALTER DATABASE','Modifies a database, changing its overall characteristics.\n\nSyntax\n------\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 | COMMENT [=] \'comment\'\n\nDescription\n-----------\n\nALTER DATABASE enables you to change the overall characteristics of a\ndatabase. These characteristics are stored in the db.opt file in the database\ndirectory. To use ALTER DATABASE, you need the ALTER privilege on the\ndatabase. ALTER SCHEMA is a synonym for ALTER DATABASE.\n\nThe CHARACTER SET clause changes the default database character set. The\nCOLLATE clause changes the default database collation. See Character Sets and\nCollations for more.\n\nYou can see what character sets and collations are available using,\nrespectively, the SHOW CHARACTER SET and SHOW COLLATION statements.\n\nChanging the default character set/collation of a database does not change the\ncharacter set/collation of any stored procedures or stored functions that were\npreviously created, and relied on the defaults. These need to be dropped and\nrecreated in order to apply the character set/collation changes.\n\nThe database name can be omitted from the first syntax, in which case the\nstatement applies to the default database.\n\nThe syntax that includes the UPGRADE DATA DIRECTORY NAME clause was added in\nMySQL 5.1.23. It updates the name of the directory associated with the\ndatabase to use the encoding implemented in MySQL 5.1 for mapping database\nnames to database directory names (see Identifier to File Name Mapping). This\nclause is for use under these conditions:\n\n* It is intended when upgrading MySQL to 5.1 or later from older versions.\n* It is intended to update a database directory name to the current encoding\nformat if the name contains special characters that need encoding.\n* The statement is used by mysqlcheck (as invoked by mysql_upgrade).\n\nFor example,if a database in MySQL 5.0 has a name of a-b-c, the name contains\ninstance of the `-\' character. In 5.0, the database directory is also named\na-b-c, which is not necessarily safe for all file systems. In MySQL 5.1 and\nup, the same database name is encoded as a@002db@002dc to produce a file\nsystem-neutral directory name.\n\nWhen a MySQL installation is upgraded to MySQL 5.1 or later from an older\nversion,the server displays a name such as a-b-c (which is in the old format)\nas #mysql50#a-b-c, and you must refer to the name using the #mysql50# prefix.\nUse UPGRADE DATA DIRECTORY NAME in this case to explicitly tell the server to\nre-encode the database directory name 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 database as a-b-c without\nthe special #mysql50# prefix.\n\nCOMMENT\n-------\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024\nbytes. If the comment length exceeds this length, a error/warning code 4144 is\nthrown. The database comment is also added to the db.opt file, as well as to\nthe information_schema.schemata table.\n\nExamples\n--------\n\nALTER DATABASE test CHARACTER SET=\'utf8\' COLLATE=\'utf8_bin\';\n\nFrom MariaDB 10.5.0:\n\nALTER DATABASE p COMMENT=\'Presentations\';\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 (696,38,'ALTER EVENT','Modifies one or more characteristics of an existing event.\n\nSyntax\n------\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-----------\n\nThe ALTER EVENT statement is used to change one or more of the characteristics\nof an existing event without the need to drop and recreate it. The syntax for\neach of the DEFINER, ON SCHEDULE, ON COMPLETION, COMMENT, ENABLE / DISABLE,\nand DO clauses is exactly the same as when used with CREATE EVENT.\n\nThis statement requires the EVENT privilege. When a user executes a successful\nALTER EVENT statement, that user becomes the definer for the affected event.\n\n(In MySQL 5.1.11 and earlier, an event could be altered only by its definer,\nor by 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\' DAY_HOUR;\nERROR 1539 (HY000): Unknown event \'no_such_event\'\n\nExamples\n--------\n\nALTER EVENT myevent \n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\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 (697,38,'ALTER FUNCTION','Syntax\n------\n\nALTER FUNCTION func_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nDescription\n-----------\n\nThis statement can be used to change the characteristics of a stored function.\nMore than one change may be specified in an ALTER FUNCTION statement. However,\nyou cannot change the parameters or body of a stored function using this\nstatement; to make such changes, you must drop and re-create the function\nusing DROP FUNCTION and CREATE FUNCTION.\n\nYou must have the ALTER ROUTINE privilege for the function. (That privilege is\ngranted automatically to the function creator.) If binary logging is enabled,\nthe ALTER FUNCTION statement might also require the SUPER privilege, as\ndescribed in Binary Logging of Stored Routines.\n\nExample\n-------\n\nALTER FUNCTION hello SQL SECURITY INVOKER;\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 (698,38,'ALTER LOGFILE GROUP','Syntax\n------\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 MariaDB. It was\noriginally inherited from MySQL NDB Cluster. See MDEV-19295 for more\ninformation.\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 (699,38,'ALTER PROCEDURE','Syntax\n------\n\nALTER PROCEDURE proc_name [characteristic ...]\n\ncharacteristic:\n { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nDescription\n-----------\n\nThis statement can be used to change the characteristics of a stored\nprocedure. More than one change may be specified in an ALTER PROCEDURE\nstatement. However, you cannot change the parameters or body of a stored\nprocedure using this statement. To make such changes, you must drop and\nre-create the procedure using either CREATE OR REPLACE PROCEDURE (since\nMariaDB 10.1.3) or DROP PROCEDURE and CREATE PROCEDURE (MariaDB 10.1.2 and\nbefore).\n\nYou must have the ALTER ROUTINE privilege for the procedure. By default, that\nprivilege is granted automatically to the procedure creator. See Stored\nRoutine Privileges.\n\nExample\n-------\n\nALTER PROCEDURE simpleproc SQL SECURITY INVOKER;\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 (700,38,'ALTER SERVER','Syntax\n------\n\nALTER SERVER server_name\n OPTIONS (option [, option] ...)\n\nDescription\n-----------\n\nAlters the server information for server_name, adjusting the specified options\nas per the CREATE SERVER command. The corresponding fields in the\nmysql.servers table are updated accordingly. This statement requires the SUPER\nprivilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.\n\nALTER SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nExamples\n--------\n\nALTER SERVER s OPTIONS (USER \'sally\');\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 (701,38,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (702,38,'ALTER VIEW','Syntax\n------\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-----------\n\nThis statement changes the definition of a view, which must exist. The syntax\nis similar to that for CREATE VIEW and the effect is the same as for CREATE OR\nREPLACE VIEW if the view exists. This statement requires the CREATE VIEW and\nDROP privileges for the view, and some privilege for each column referred to\nin the SELECT statement. ALTER VIEW is allowed only to the definer or users\nwith the SUPER privilege.\n\nExample\n-------\n\nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\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 (703,38,'CREATE TABLE','Syntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...) [table_options ]... [partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)] [table_options ]... [partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nDescription\n-----------\n\nUse the CREATE TABLE statement to create a table with the given name.\n\nIn its most basic form, the CREATE TABLE statement provides a table name\nfollowed by a list of columns, indexes, and constraints. By default, the table\nis created in the default database. Specify a database with db_name.tbl_name.\nIf you quote the table name, you must quote the database name and table name\nseparately as `db_name`.`tbl_name`. This is particularly useful for CREATE\nTABLE ... SELECT, because it allows to create a table into a database, which\ncontains data from other databases. See Identifier Qualifiers.\n\nIf a table with the same name exists, error 1050 results. Use IF NOT EXISTS to\nsuppress this error and issue a note instead. Use SHOW WARNINGS to see notes.\n\nThe CREATE TABLE statement automatically commits the current transaction,\nexcept when using the TEMPORARY keyword.\n\nFor valid identifiers to use as table names, see Identifier Names.\n\nNote: if the default_storage_engine is set to ColumnStore then it needs\nsetting on all UMs. Otherwise when the tables using the default engine are\nreplicated across UMs they will use the wrong engine. You should therefore not\nuse this option as a session variable with ColumnStore.\n\nMicrosecond precision can be between 0-6. If no precision is specified it is\nassumed to be 0, for backward compatibility reasons.\n\nPrivileges\n----------\n\nExecuting the CREATE TABLE statement requires the CREATE privilege for the\ntable or the database.\n\nCREATE OR REPLACE\n-----------------\n\nIf the OR REPLACE clause is used and the table already exists, then instead of\nreturning an error, the server will drop the existing table and replace it\nwith the newly defined table.\n\nThis syntax was originally added to make replication more robust if it has to\nrollback and repeat statements such as CREATE ... SELECT on replicas.\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:\n\n* If table_name was locked with LOCK TABLES it will continue to be locked\nafter the statement.\n* Temporary tables are only dropped if the TEMPORARY keyword was used. (With\nDROP TABLE, temporary tables are preferred to be dropped before normal\ntables).\n\nThings to be Aware of With CREATE OR REPLACE\n--------------------------------------------\n\n* The table is dropped first (if it existed), after that the CREATE is done.\nBecause of this, if the CREATE fails, then the table will not exist anymore\nafter the statement. If the table was used with LOCK TABLES it will be\nunlocked.\n* One can\'t use OR REPLACE together with IF EXISTS.\n* Slaves in replication will by default use CREATE OR REPLACE when replicating\nCREATE statements that don\'\'t use IF EXISTS. This can be changed by setting\nthe variable slave-ddl-exec-mode to STRICT.\n\nCREATE TABLE IF NOT EXISTS\n--------------------------\n\nIf the IF NOT EXISTS clause is used, then the table will only be created if a\ntable with the same name does not already exist. If the table already exists,\nthen a warning will be triggered by default.\n\nCREATE TEMPORARY TABLE\n----------------------\n\nUse the TEMPORARY keyword to create a temporary table that is only available\nto the current session. Temporary tables are dropped when the session ends.\nTemporary table names are specific to the session. They will not conflict with\nother temporary tables from other sessions even if they share the same name.\nThey will shadow names of non-temporary tables or views, if they are\nidentical. A temporary table can have the same name as a non-temporary table\nwhich is located in the same database. In that case, their name will reference\nthe temporary table when used in SQL statements. You must have the CREATE\nTEMPORARY TABLES privilege on the database to create temporary tables. If no\nstorage engine is specified, the default_tmp_storage_engine setting will\ndetermine the engine.\n\nROCKSDB temporary tables cannot be created by setting the\ndefault_tmp_storage_engine system variable, or using CREATE TEMPORARY TABLE\nLIKE. Before MariaDB 10.7, they could be specified, but would silently fail,\nand a MyISAM table would be created instead. From MariaDB 10.7 an error is\nreturned. Explicitly creating a temporary table with ENGINE=ROCKSDB has never\nbeen permitted.\n\nCREATE TABLE ... LIKE\n---------------------\n\nUse the LIKE clause instead of a full table definition to create a table with\nthe same definition as another table, including columns, indexes, and table\noptions. Foreign key definitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table, will not be created.\n\nCREATE TABLE ... SELECT\n-----------------------\n\nYou can create a table containing data from other tables using the CREATE ...\nSELECT statement. Columns will be created in the table for each field returned\nby the SELECT query.\n\nYou can also define some columns normally and add other columns from a SELECT.\nYou can also create columns in the normal way and assign them some values\nusing the query, this is done to force a certain type or other field\ncharacteristics. The columns that are not named in the query will be placed\nbefore 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 use the same\nindexes, or the same columns attributes ([NOT] NULL, DEFAULT, AUTO_INCREMENT)\nin the new table, you need to specify them manually. Types and sizes are not\nautomatically preserved if no data returned by the SELECT requires the full\nsize, and VARCHAR could be converted into CHAR. The CAST() function can be\nused to forcee the new table to use certain types.\n\nAliases (AS) are taken into account, and they should always be used when you\nSELECT an expression (function, arithmetical operation, etc).\n\nIf an error occurs during the query, the table will not be created at all.\n\nIf the new table has a primary key or UNIQUE indexes, you can use the IGNORE\nor REPLACE keywords to handle duplicate key errors during the query. IGNORE\nmeans that the newer values must not be inserted an identical value exists in\nthe index. REPLACE means that older values must be overwritten.\n\nIf the columns in the new table are more than the rows returned by the query,\nthe columns populated by the query will be placed after other columns. Note\nthat if the strict SQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and no rows will be\ncopied.\n\nConcurrent inserts are not used during the execution of a CREATE ... SELECT.\n\nIf the table already exists, an error similar to the following will be\nreturned:\n\nERROR 1050 (42S01): Table \'t\' already exists\n\nIf the IF NOT EXISTS clause is used and the table exists, a note will be\nproduced instead of an error.\n\nTo insert rows from a query into an existing table, INSERT ... SELECT can be\nused.\n\nColumn Definitions\n------------------\n\ncreate_definition:\n { col_name column_definition | index_definition | period_definition | CHECK\n(expr) }\ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [ON UPDATE [NOW | CURRENT_TIMESTAMP] [(precision)]]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\'] [REF_SYSTEM_ID = value]\n [reference_definition]\n | data_type [GENERATED ALWAYS]\n AS { { ROW {START|END} } | { (expression) [VIRTUAL | PERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: Until MariaDB 10.4, MariaDB accepts the shortcut format with a\nREFERENCES clause only in ALTER TABLE and CREATE TABLE statements, but that\nsyntax does nothing. For example:\n\nCREATE TABLE b(for_key INT REFERENCES a(not_key));\n\nMariaDB simply parses it without returning any error or warning, for\ncompatibility with other DBMS\'s. Before MariaDB 10.2.1 this was also true for\nCHECK constraints. However, only the syntax described below creates foreign\nkeys.\n\nFrom MariaDB 10.5, MariaDB will attempt to apply the constraint. See Foreign\nKeys examples.\n\nEach definition either creates a column in the table or specifies and index or\nconstraint on one or more columns. See Indexes below for details on creating\nindexes.\n\nCreate a column by specifying a column name and a data type, optionally\nfollowed by column options. See Data Types for a full list of data types\nallowed in MariaDB.\n\nNULL and NOT NULL\n-----------------\n\nUse the NULL or NOT NULL options to specify that values in the column may or\nmay not be NULL, respectively. By default, values may be NULL. See also NULL\nValues in MariaDB.\n\nDEFAULT Column Option\n---------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some enhancements include\n\n* BLOB and TEXT columns now support DEFAULT.\n* The DEFAULT clause can now be used with an expression or function.\n\nSpecify a default value using the DEFAULT clause. If you don\'t specify DEFAULT\nthen the following rules apply:\n\n* If the column is not defined with NOT NULL, AUTO_INCREMENT or TIMESTAMP, an\nexplicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get an explicit\nDEFAULT for primary key parts, if not specified with NOT NULL.\n\nThe default value will be used if you INSERT a row without specifying a value\nfor that column, or if you specify DEFAULT for that column. Before MariaDB\n10.2.1 you couldn\'t usually provide an expression or function to evaluate at\ninsertion time. You had to provide a constant default value instead. The one\nexception is that you may use CURRENT_TIMESTAMP as the default value for a\nTIMESTAMP column to use the current timestamp at insertion time.\n\nCURRENT_TIMESTAMP may also be used as the default value for a DATETIME\n\nFrom MariaDB 10.2.1 you can use most functions in DEFAULT. Expressions should\nhave parentheses around them. If you use a non deterministic function in\nDEFAULT then all inserts to the table will be replicated in row mode. You can\neven refer to earlier columns in the DEFAULT expression (excluding\nAUTO_INCREMENT columns):\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 subqueries, and a\ncolumn used in the clause must already have been defined earlier in the\nstatement.\n\nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT columns a DEFAULT\nvalue. In earlier versions, assigning a default to these columns was not\npossible.\n\nMariaDB starting with 10.3.3\n----------------------------\nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE FOR sequence)\n\nAUTO_INCREMENT Column Option\n----------------------------\n\nUse AUTO_INCREMENT to create a column whose value can can be set automatically\nfrom a simple counter. You can only use AUTO_INCREMENT on a column with an\ninteger type. The column must be a key, and there can only be one\nAUTO_INCREMENT column in a table. If you insert a row without specifying a\nvalue for that column (or if you specify 0, NULL, or DEFAULT as the value),\nthe actual value will be taken from the counter, with each insertion\nincrementing the counter by one. You can still insert a value explicitly. If\nyou insert a value that is greater than the current counter value, the counter\nis set based on the new value. An AUTO_INCREMENT column is implicitly NOT\nNULL. Use LAST_INSERT_ID to get the AUTO_INCREMENT value most recently used by\nan INSERT statement.\n\nZEROFILL Column Option\n----------------------\n\nIf the ZEROFILL column option is specified for a column using a numeric data\ntype, then the column will be set to UNSIGNED and the spaces used by default\nto pad the field are replaced with zeros. ZEROFILL is ignored in expressions\nor as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n\nPRIMARY KEY Column Option\n-------------------------\n\nUse PRIMARY KEY to make a column a primary key. A primary key is a special\ntype of a unique key. There can be at most one primary key per table, and it\nis implicitly NOT NULL.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nUNIQUE KEY Column Option\n------------------------\n\nUse UNIQUE KEY (or just UNIQUE) to specify that all values in the column must\nbe distinct from each other. Unless the column is NOT NULL, there may be\nmultiple rows with NULL in the column.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nCOMMENT Column Option\n---------------------\n\nYou can provide a comment for each column using the COMMENT clause. The\nmaximum length is 1024 characters. Use the SHOW FULL COLUMNS statement to see\ncolumn comments.\n\nREF_SYSTEM_ID\n-------------\n\nREF_SYSTEM_ID can be used to specify Spatial Reference System IDs for spatial\ndata type columns.\n\nGenerated Columns\n-----------------\n\nA generated column is a column in a table that cannot explicitly be set to a\nspecific value in a DML query. Instead, its value is automatically generated\nbased on an expression. This expression might generate the value based on the\nvalues of other columns in the table, or it might generate the value by\ncalling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n* PERSISTENT or STORED: This type\'s value is actually stored in the table.\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is','','https://mariadb.com/kb/en/create-table/');
+update help_topic set description = CONCAT(description, '\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nFor a complete description about generated columns and their limitations, see\nGenerated (Virtual and Persistent/Stored) Columns.\n\nCOMPRESSED\n----------\n\nMariaDB starting with 10.3.3\n----------------------------\nCertain columns may be compressed. See Storage-Engine Independent Column\nCompression.\n\nINVISIBLE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nColumns may be made invisible, and hidden in certain contexts. See Invisible\nColumns.\n\nWITH SYSTEM VERSIONING Column Option\n------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as included from system versioning. See\nSystem-versioned tables for details.\n\nWITHOUT SYSTEM VERSIONING Column Option\n---------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as excluded from system versioning. See\nSystem-versioned tables for details.\n\nIndex Definitions\n-----------------\n\nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option]\n...\n {{{|}}} {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type]\n(index_col_name,...) [index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...)\nreference_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 [ IGNORED | NOT IGNORED ]\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nINDEX and KEY are synonyms.\n\nIndex names are optional, if not specified an automatic name will be assigned.\nIndex name are needed to drop indexes and appear in error messages when a\nconstraint is violated.\n\nIndex Categories\n----------------\n\nPlain Indexes\n-------------\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nPRIMARY KEY\n-----------\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nignored, and the name of the index is always PRIMARY. From MariaDB 10.3.18 and\nMariaDB 10.4.8, a warning is explicitly issued if a name is specified. Before\nthen, the name was silently ignored.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nUNIQUE\n------\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nFOREIGN KEY\n-----------\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is currently implemented only for the PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nFULLTEXT\n--------\n\nUse the FULLTEXT keyword to create full-text indexes.\n\nSee Full-Text Indexes for more information.\n\nSPATIAL\n-------\n\nUse the SPATIAL keyword to create geometric indexes.\n\nSee SPATIAL INDEX for more information.\n\nIndex Options\n-------------\n\nKEY_BLOCK_SIZE Index Option\n---------------------------\n\nThe KEY_BLOCK_SIZE index option is similar to the KEY_BLOCK_SIZE table option.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\nHowever, this does not happen if you just set the KEY_BLOCK_SIZE index option\nfor one or more indexes in the table. The InnoDB storage engine ignores the\nKEY_BLOCK_SIZE index option. However, the SHOW CREATE TABLE statement may\nstill report it for the index.\n\nFor information about the KEY_BLOCK_SIZE index option, see the KEY_BLOCK_SIZE\ntable option below.\n\nIndex Types\n-----------\n\nEach storage engine supports some or all index types. See Storage Engine Index\nTypes for details on permitted index types for each storage engine.\n\nDifferent index types are optimized for different kind of operations:\n\n* BTREE is the default type, and normally is the best choice. It is supported\nby all storage engines. It can be used to compare a column\'s value with a\nvalue using the =, >, >=, <, <=, BETWEEN, and LIKE operators. BTREE can also\nbe used to find NULL values. Searches against an index prefix are possible.\n* HASH is only supported by the MEMORY storage engine. HASH indexes can only\nbe used for =, <=, and >= comparisons. It can not be used for the ORDER BY\nclause. Searches against an index prefix are not possible.\n* RTREE is the default for SPATIAL indexes, but if the storage engine does not\nsupport it BTREE can be used.\n\nIndex columns names are listed between parenthesis. After each column, a\nprefix length can be specified. If no length is specified, the whole column\nwill be indexed. ASC and DESC can be specified for compatibility with are\nDBMS\'s, but have no meaning in MariaDB.\n\nWITH PARSER Index Option\n------------------------\n\nThe WITH PARSER index option only applies to FULLTEXT indexes and contains the\nfulltext parser name. The fulltext parser must be an installed plugin.\n\nCOMMENT Index Option\n--------------------\n\nA comment of up to 1024 characters is permitted with the COMMENT index option.\n\nThe COMMENT index option allows you to specify a comment with user-readable\ntext describing what the index is for. This information is not used by the\nserver itself.\n\nCLUSTERING Index Option\n-----------------------\n\nThe CLUSTERING index option is only valid for tables using the TokuDB storage\nengine.\n\nIGNORED / NOT IGNORED\n---------------------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, indexes can be specified to be ignored by the optimizer.\nSee Ignored Indexes.\n\nPeriods\n-------\n\nMariaDB starting with 10.3.4\n----------------------------\n\nperiod_definition:\n PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\nMariaDB supports a subset of the standard syntax for periods. At the moment\nit\'s only used for creating System-versioned tables. Both columns must be\ncreated, must be either of a TIMESTAMP(6) or BIGINT UNSIGNED type, and be\ngenerated as ROW START and ROW END accordingly. See System-versioned tables\nfor details.\n\nThe table must also have the WITH SYSTEM VERSIONING clause.\n\nConstraint Expressions\n----------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 introduced new ways to define a constraint.\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in the\nsyntax but ignored.\n\nMariaDB 10.2.1 introduced two ways to define a constraint:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraints fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDFs.\n\ncreate table t1 (a int check(a>0) ,b int check (b> 0), constraint abc check\n(a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get a auto generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. This is useful for example when loading a\ntable that violates some constraints that you want to later find and fix in\nSQL.\n\nSee CONSTRAINT for more information.\n\nTable Options\n-------------\n\nFor each individual table you create (or alter), you can set some table\noptions. The general syntax for setting options is:\n\n<OPTION_NAME> = <option_value>, [<OPTION_NAME> = <option_value> ...]\n\nThe equal sign is optional.\n\nSome options are supported by the server and can be used for all tables, no\nmatter what storage engine they use; other options can be specified for all\nstorage engines, but have a meaning only for some engines. Also, engines can\nextend CREATE TABLE with new options.\n\nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong table options\ngenerate a warning; otherwise, they generate an 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 [=] {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\n[STORAGE] ENGINE specifies a storage engine for the table. If this option is\nnot used, the default storage engine is used instead. That is, the\ndefault_storage_engine session option value if it is set, or the value\nspecified for the --default-storage-engine mysqld startup option, or the\ndefault storage engine, InnoDB. If the specified storage engine is not\ninstalled and active, the default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default). This is only true for CREATE\nTABLE, not for ALTER TABLE. For a list of storage engines that are present in\nyour server, issue a SHOW ENGINES.\n\nAUTO_INCREMENT\n--------------\n\nAUTO_INCREMENT specifies the initial value for the AUTO_INCREMENT primary key.\nThis works for MyISAM, Aria, InnoDB, MEMORY, and ARCHIVE tables. You can\nchange this option with ALTER TABLE, but in that case the new value must be\nhigher than the highest value which is present in the AUTO_INCREMENT column.\nIf the storage engine does not support this option, you can insert (and then\ndelete) a row having the wanted value - 1 in the AUTO_INCREMENT column.\n\nAVG_ROW_LENGTH\n--------------\n\nAVG_ROW_LENGTH is the average rows size. It only applies to tables using\nMyISAM and Aria storage engines that have the ROW_FORMAT table option set to\nFIXED format.\n\nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the maximum size of a table\n(default: 256TB, or the maximum file size allowed by the system).\n\n[DEFAULT] CHARACTER SET/CHARSET\n-------------------------------\n\n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to set a default\ncharacter set for the table. This is the character set used for all columns\nwhere an explicit character set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will be used. See\nSetting Character Sets and Collations for details on setting the character\nsets.\n\nCHECKSUM/TABLE_CHECKSUM\n-----------------------\n\nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a live checksum for\nall table\'s rows. This makes write operations slower, but CHECKSUM TABLE will\nbe very fast. This option is only supported for MyISAM and Aria tables.\n\n[DEFAULT] COLLATE\n-----------------\n\n[DEFAULT] COLLATE is used to set a default collation for the table. This is\nthe collation used for all columns where an explicit character set is not\nspecified. If this option is omitted or DEFAULT is specified, database\'s\ndefault option will be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n\nCOMMENT\n-------\n') WHERE help_topic_id = 703;
+update help_topic set description = CONCAT(description, '\nCOMMENT is a comment for the table. The maximum length is 2048 characters.\nAlso used to define table parameters when creating a Spider table.\n\nCONNECTION\n----------\n\nCONNECTION is used to specify a server name or a connection string for a\nSpider, CONNECT, Federated or FederatedX table.\n\nDATA DIRECTORY/INDEX DIRECTORY\n------------------------------\n\nDATA DIRECTORY and INDEX DIRECTORY are supported for MyISAM and Aria, and DATA\nDIRECTORY is also supported by InnoDB if the innodb_file_per_table server\nsystem variable is enabled, but only in CREATE TABLE, not in ALTER TABLE. So,\ncarefully choose a path for InnoDB tables at creation time, because it cannot\nbe changed without dropping and re-creating the table. These options specify\nthe paths for data files and index files, respectively. If these options are\nomitted, the database\'s directory will be used to store data files and index\nfiles. Note that these table options do not work for partitioned tables (use\nthe partition options instead), or if the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the overwriting of old files\nwith the same name that could be present in the directories, you can use the\n--keep_files_on_create option (an error will be issued if files already\nexist). These options are ignored if the NO_DIR_IN_CREATE SQL_MODE is enabled\n(useful for replication slaves). Also note that symbolic links cannot be used\nfor InnoDB tables.\n\nDATA DIRECTORY works by creating symlinks from where the table would normally\nhave been (inside the datadir) to where the option specifies. For security\nreasons, to avoid bypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY cannot be used to\nspecify a location inside the datadir. An attempt to do so will result in an\nerror 1210 (HY000) Incorrect arguments to DATA DIRECTORY.\n\nDELAY_KEY_WRITE\n---------------\n\nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be set to 1 to speed\nup write operations. In that case, when data are modified, the indexes are not\nupdated until the table is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this option is applied only\nif the delay_key_write server variable is set to \'ON\'. If it is \'OFF\' the\ndelayed index writes are always disabled, and if it is \'ALL\' the delayed index\nwrites are always used, disregarding the value of DELAY_KEY_WRITE.\n\nENCRYPTED\n---------\n\nThe ENCRYPTED table option can be used to manually set the encryption status\nof an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTED table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nENCRYPTION_KEY_ID\n-----------------\n\nThe ENCRYPTION_KEY_ID table option can be used to manually set the encryption\nkey of an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTION_KEY_ID table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nIETF_QUOTES\n-----------\n\nFor the CSV storage engine, the IETF_QUOTES option, when set to YES, enables\nIETF-compatible parsing of embedded quote and comma characters. Enabling this\noption for a table improves compatibility with other tools that use CSV, but\nis not compatible with MySQL CSV tables, or MariaDB CSV tables created without\nthis option. Disabled by default.\n\nINSERT_METHOD\n-------------\n\nINSERT_METHOD is only used with MERGE tables. This option determines in which\nunderlying table the new rows should be inserted. If you set it to \'NO\' (which\nis the default) no new rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying tables). FIRST means\nthat the rows are inserted into the first table, and LAST means that thet are\ninserted into the last table.\n\nKEY_BLOCK_SIZE\n--------------\n\nKEY_BLOCK_SIZE is used to determine the size of key blocks, in bytes or\nkilobytes. However, this value is just a hint, and the storage engine could\nmodify or ignore it. If KEY_BLOCK_SIZE is set to 0, the storage engine\'s\ndefault value will be used.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\n\nMIN_ROWS/MAX_ROWS\n-----------------\n\nMIN_ROWS and MAX_ROWS let the storage engine know how many rows you are\nplanning to store as a minimum and as a maximum. These values will not be used\nas real limits, but they help the storage engine to optimize the table.\nMIN_ROWS is only used by MEMORY storage engine to decide the minimum memory\nthat is always allocated. MAX_ROWS is used to decide the minimum size for\nindexes.\n\nPACK_KEYS\n---------\n\nPACK_KEYS can be used to determine whether the indexes will be compressed. Set\nit to 1 to compress all keys. With a value of 0, compression will not be used.\nWith the DEFAULT value, only long strings will be compressed. Uncompressed\nkeys are faster.\n\nPAGE_CHECKSUM\n-------------\n\nPAGE_CHECKSUM is only applicable to Aria tables, and determines whether\nindexes and data should use page checksums for extra safety.\n\nPAGE_COMPRESSED\n---------------\n\nPAGE_COMPRESSED is used to enable InnoDB page compression for InnoDB tables.\n\nPAGE_COMPRESSION_LEVEL\n----------------------\n\nPAGE_COMPRESSION_LEVEL is used to set the compression level for InnoDB page\ncompression for InnoDB tables. The table must also have the PAGE_COMPRESSED\ntable option set to 1.\n\nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best speed) through 9 (the\nbest compression), .\n\nPASSWORD\n--------\n\nPASSWORD is unused.\n\nRAID_TYPE\n---------\n\nRAID_TYPE is an obsolete option, as the raid support has been disabled since\nMySQL 5.0.\n\nROW_FORMAT\n----------\n\nThe ROW_FORMAT table option specifies the row format for the data file.\nPossible values are engine-dependent.\n\nSupported MyISAM Row Formats\n----------------------------\n\nFor MyISAM, the supported row formats are:\n\n* FIXED\n* DYNAMIC\n* COMPRESSED\n\nThe COMPRESSED row format can only be set by the myisampack command line tool.\n\nSee MyISAM Storage Formats for more information.\n\nSupported Aria Row Formats\n--------------------------\n\nFor Aria, the supported row formats are:\n\n* PAGE\n* FIXED\n* DYNAMIC.\n\nSee Aria Storage Formats for more information.\n\nSupported InnoDB Row Formats\n----------------------------\n\nFor InnoDB, the supported row formats are:\n\n* COMPACT\n* REDUNDANT\n* COMPRESSED\n* DYNAMIC.\n\nIf the ROW_FORMAT table option is set to FIXED for an InnoDB table, then the\nserver will either return an error or a warning depending on the value of the\ninnodb_strict_mode system variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will create the table\nusing the default row format for the specific MariaDB server version. If the\ninnodb_strict_mode system variable is set to ON, then an error will be raised.\n\nSee InnoDB Storage Formats for more information.\n\nOther Storage Engines and ROW_FORMAT\n------------------------------------\n\nOther storage engines do not support the ROW_FORMAT table option.\n\nSEQUENCE\n--------\n\nMariaDB starting with 10.3\n--------------------------\nIf the table is a sequence, then it will have the SEQUENCE set to 1.\n\nSTATS_AUTO_RECALC\n-----------------\n\nSTATS_AUTO_RECALC indicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB table. If set to 1,\nstatistics will be recalculated when more than 10% of the data has changed.\nWhen set to 0, stats will be recalculated only when an ANALYZE TABLE is run.\nIf set to DEFAULT, or left out, the value set by the innodb_stats_auto_recalc\nsystem variable applies. See InnoDB Persistent Statistics.\n\nSTATS_PERSISTENT\n----------------\n\nSTATS_PERSISTENT indicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on disk), 0 (not on\ndisk, the pre-MariaDB 10 behavior), or DEFAULT (the same as leaving out the\noption), in which case the value set by the innodb_stats_persistent system\nvariable will apply. Persistent statistics stored on disk allow the statistics\nto survive server restarts, and provide better query plan stability. See\nInnoDB Persistent Statistics.\n\nSTATS_SAMPLE_PAGES\n------------------\n\nSTATS_SAMPLE_PAGES indicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the innodb_stats_sample_pages\nvalue is used. See InnoDB Persistent Statistics.\n\nTRANSACTIONAL\n-------------\n\nTRANSACTIONAL is only applicable for Aria tables. In future Aria tables\ncreated with this option will be fully transactional, but currently this\nprovides a form of crash protection. See Aria Storage Engine for more details.\n\nUNION\n-----\n\nUNION must be specified when you create a MERGE table. This option contains a\ncomma-separated list of MyISAM tables which are accessed by the new table. The\nlist is enclosed between parenthesis. Example: UNION = (t1,t2)\n\nWITH SYSTEM VERSIONING\n----------------------\n\nWITH SYSTEM VERSIONING is used for creating System-versioned tables.\n\nPartitions\n----------\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 num] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\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] ...)]\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 partitioned. A partition\nmethod must be explicitly indicated for partitions and subpartitions.\nPartition methods are:\n\n* [LINEAR] HASH creates a hash key which will be used to read and write rows.\nThe partition function can be any valid SQL expression which returns an\nINTEGER number. Thus, it is possible to use the HASH method on an integer\ncolumn, or on functions which accept integer columns as an argument. However,\nVALUES LESS THAN and VALUES IN clauses can not be used 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\n* [LINEAR] KEY is similar to HASH, but the index has an even distribution of\ndata. Also, the expression can only be a column or a list of columns. VALUES\nLESS THAN and VALUES IN clauses can not be used with KEY.\n* RANGE partitions the rows using on a range of values, using the VALUES LESS\nTHAN operator. VALUES IN is not allowed with RANGE. The partition function can\nbe any valid SQL expression which returns a single value.\n* LIST assigns partitions based on a table\'s column with a restricted set of\npossible values. It is similar to RANGE, but VALUES IN must be used for at\nleast 1 columns, and VALUES LESS THAN is disallowed.\n* SYSTEM_TIME partitioning is used for System-versioned tables to store\nhistorical data separately from current data.\n\nOnly HASH and KEY can be used for subpartitions, and they can be [LINEAR].\n\nIt is possible to define up to 1024 partitions and subpartitions.\n\nThe number of defined partitions can be optionally specified as PARTITION\ncount. This can be done to avoid specifying all partitions individually. But\nyou can also declare each individual partition and, additionally, specify a\nPARTITIONS count clause; in the case, the number of PARTITIONs must equal\ncount.\n\nAlso see Partitioning Types Overview.\n\nSequences\n---------\n\nMariaDB starting with 10.3\n--------------------------\nCREATE TABLE can also be used to create a SEQUENCE. See CREATE SEQUENCE and\nSequence Overview.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL. CREATE TABLE is atomic, except for CREATE\nOR REPLACE, which is only crash safe.\n\nExamples\n--------\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:\n\n* Usage of IF NOT EXISTS; If the table already existed, it will not be\ncreated. There will not be any error for the client, just a warning.\n* How to create a PRIMARY KEY that is automatically generated.\n* How to specify a table-specific character set and another for a column.\n* How to create an index (name) that is only partly indexed (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\nURL: https://mariadb.com/kb/en/create-table/') WHERE help_topic_id = 703;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (704,38,'DROP TABLE','Syntax\n------\n\nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP TABLE removes one or more tables. You must have the DROP privilege for\neach table. All table data and the table definition are removed, as well as\ntriggers associated to the table, so be careful with this statement! If any of\nthe tables named in the argument list do not exist, MariaDB returns an error\nindicating by name which non-existing tables it was unable to drop, but it\nalso drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not\nautomatically dropped. See GRANT.\n\nIf another thread is using the table in an explicit transaction or an\nautocommit transaction, then the thread acquires a metadata lock (MDL) on the\ntable. The DROP TABLE statement will wait in the \"Waiting for table metadata\nlock\" thread state until the MDL is released. MDLs are released in the\nfollowing cases:\n\n* If an MDL is acquired in an explicit transaction, then the MDL will be\nreleased when the transaction ends.\n* If an MDL is acquired in an autocommit transaction, then the MDL will be\nreleased when the statement ends.\n* Transactional and non-transactional tables are handled the same.\n\nNote that for a partitioned table, DROP TABLE permanently removes the table\ndefinition, all of its partitions, and all of the data which was stored in\nthose partitions. It also removes the partitioning definition (.par) file\nassociated with the dropped table.\n\nFor each referenced table, DROP TABLE drops a temporary table with that name,\nif it exists. If it does not exist, and the TEMPORARY keyword is not used, it\ndrops a non-temporary table with the same name, if it exists. The TEMPORARY\nkeyword ensures that a non-temporary table will not accidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not exist.\nA NOTE is generated for each non-existent table when using IF EXISTS. See SHOW\nWARNINGS.\n\nIf a foreign key references this table, the table cannot be dropped. In this\ncase, it is necessary to drop the foreign key first.\n\nRESTRICT and CASCADE are allowed to make porting from other database systems\neasier. In MariaDB, they do nothing.\n\nThe comment before the table names (/*COMMENT TO SAVE*/) is stored in the\nbinary log. That feature can be used by replication tools to send their\ninternal messages.\n\nIt is possible to specify table names as db_name.tab_name. This is useful to\ndelete tables from multiple databases with one statement. See Identifier\nQualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For\ntemporary tables, no privilege is required, because such tables are only\nvisible for the current session.\n\nNote: DROP TABLE automatically commits the current active transaction, unless\nyou use the TEMPORARY keyword.\n\nMariaDB starting with 10.5.4\n----------------------------\nFrom MariaDB 10.5.4, DROP TABLE reliably deletes table remnants inside a\nstorage engine even if the .frm file is missing. Before then, a missing .frm\nfile would result in the statement failing.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDROP TABLE in replication\n-------------------------\n\nDROP TABLE has the following characteristics in replication:\n\n* DROP TABLE IF EXISTS are always logged.\n* DROP TABLE without IF EXISTS for tables that don\'t exist are not written to\nthe binary log.\n* Dropping of TEMPORARY tables are prefixed in the log with TEMPORARY. These\ndrops are only logged when running statement or mixed mode replication.\n* One DROP TABLE statement can be logged with up to 3 different DROP\nstatements:\nDROP TEMPORARY TABLE list_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n\nDROP TABLE on the primary is treated on the replica as DROP TABLE IF EXISTS.\nYou can change that by setting slave-ddl-exec-mode to STRICT.\n\nDropping an Internal #sql-... Table\n-----------------------------------\n\nFrom MariaDB 10.6, DROP TABLE is atomic and the following does not apply.\nUntil MariaDB 10.5, if the mariadbd/mysqld process is killed during an ALTER\nTABLE you may find a table named #sql-... in your data directory. In MariaDB\n10.3, InnoDB tables with this prefix will be deleted automatically during\nstartup. From MariaDB 10.4, these temporary tables will always be deleted\nautomatically.\n\nIf you want to delete one of these tables explicitly you can do so by using\nthe following syntax:\n\nDROP TABLE `#mysql50##sql-...`;\n\nWhen running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB\nwill create an internal #sql-ib table. Until MariaDB 10.3.2, for these tables,\nthe .frm file will be called something else. In order to drop such a table\nafter a server crash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n\nFrom MariaDB 10.3.3, the same name as the .frm file is used for the\nintermediate copy of the table. The #sql-ib names are used by TRUNCATE and\ndelayed DROP.\n\nFrom MariaDB 10.2.19 and MariaDB 10.3.10, the #sql-ib tables will be deleted\nautomatically.\n\nDropping All Tables in a Database\n---------------------------------\n\nThe best way to drop all tables in a database is by executing DROP DATABASE,\nwhich will drop the database itself, and all tables in it.\n\nHowever, if you want to drop all tables in the database, but you also want to\nkeep the database itself and any other non-table objects in it, then you would\nneed to execute DROP TABLE to drop each individual table. You can construct\nthese DROP TABLE commands by querying the TABLES table in the\ninformation_schema database. For example:\n\nSELECT CONCAT(\'DROP TABLE IF EXISTS `\', TABLE_SCHEMA, \'`.`\', TABLE_NAME, \'`;\')\nFROM information_schema.TABLES\nWHERE TABLE_SCHEMA = \'mydb\';\n\nAtomic DROP TABLE\n-----------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, DROP TABLE for a single table is atomic (MDEV-25180) for\nmost engines, including InnoDB, MyRocks, MyISAM and Aria.\n\nThis means that if there is a crash (server down or power outage) during DROP\nTABLE, all tables that have been processed so far will be completely dropped,\nincluding related trigger files and status entries, and the binary log will\ninclude a DROP TABLE statement for the dropped tables. Tables for which the\ndrop had not started will be left intact.\n\nIn older MariaDB versions, there was a small chance that, during a server\ncrash happening in the middle of DROP TABLE, some storage engines that were\nusing multiple storage files, like MyISAM, could have only a part of its\ninternal files dropped.\n\nIn MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was\nonly partly dropped (MDEV-11412) as explained above. Atomic DROP TABLE is the\nfinal piece to make DROP TABLE fully reliable.\n\nDropping multiple tables is crash-safe.\n\nSee Atomic DDL for more information.\n\nExamples\n--------\n\nDROP TABLE Employees, Customers;\n\nNotes\n-----\n\nBeware that DROP TABLE can drop both tables and sequences. This is mainly done\nto allow old tools like mysqldump to work with sequences.\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 (705,38,'RENAME TABLE','Syntax\n------\n\nRENAME TABLE[S] [IF EXISTS] tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nDescription\n-----------\n\nThis statement renames one or more tables or views, but not the privileges\nassociated with them.\n\nIF EXISTS\n---------\n\nMariaDB starting with 10.5.2\n----------------------------\nIf this directive is used, one will not get an error if the table to be\nrenamed doesn\'t exist.\n\nThe rename operation is done atomically, which means that no other session can\naccess any of the tables while the rename is running. For example, if you have\nan existing table old_table, you can create another table new_table that has\nthe same structure but is empty, and then replace the existing table with the\nempty one as follows (assuming that backup_table does not already exist):\n\nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n\ntbl_name can optionally be specified as db_name.tbl_name. See Identifier\nQualifiers. This allows to use RENAME to move a table from a database to\nanother (as long as they are on the same filesystem):\n\nRENAME TABLE db1.t TO db2.t;\n\nNote that moving a table to another database is not possible if it has some\ntriggers. Trying to do so produces the following 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 \'new_db\' is not allowed.\n\nMultiple tables can be renamed in a single statement. The presence or absence\nof the optional S (RENAME TABLE or RENAME TABLES) has no impact, whether a\nsingle or multiple tables are being renamed.\n\nIf a RENAME TABLE renames more than one table and one renaming fails, all\nrenames executed by the same statement are rolled back.\n\nRenames are always executed in the specified order. Knowing this, it is also\npossible to swap two tables\' names:\n\nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nPrivileges\n----------\n\nExecuting the RENAME TABLE statement requires the DROP, CREATE and INSERT\nprivileges for the table or the database.\n\nAtomic RENAME TABLE\n-------------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, RENAME TABLE is atomic for most engines, including InnoDB,\nMyRocks, MyISAM and Aria (MDEV-23842). This means that if there is a crash\n(server down or power outage) during RENAME TABLE, all tables will revert to\ntheir original names and any changes to trigger files will be reverted.\n\nIn older MariaDB version there was a small chance that, during a server crash\nhappening in the middle of RENAME TABLE, some tables could have been renamed\n(in the worst case partly) while others would not be renamed.\n\nSee Atomic DDL for more information.\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 (706,38,'TRUNCATE TABLE','Syntax\n------\n\nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nTRUNCATE TABLE empties a table completely. It requires the DROP privilege. See\nGRANT.\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier\nQualifiers).\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that deletes all\nrows, but there are practical differences under some circumstances.\n\nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN KEY constraints\nfrom other tables reference the table, returning the error:\n\nERROR 1701 (42000): Cannot truncate a table referenced in a foreign key\nconstraint\n\nForeign Key constraints between columns in the same table are permitted.\n\nFor an InnoDB table, if there are no FOREIGN KEY constraints, InnoDB performs\nfast truncation by dropping the original table and creating an empty one with\nthe same definition, which is much faster than deleting rows one by one. The\nAUTO_INCREMENT counter is reset by TRUNCATE TABLE, regardless of whether there\nis a FOREIGN KEY constraint.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it is\nmapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the following\nways:\n\n* Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n* Truncate operations cause an implicit commit.\n* Truncation operations cannot be performed if the session holds an\n active table lock.\n* Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is \"0 rows affected,\" which should\n be interpreted as \"no information.\"\n* As 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 become\n corrupted.\n* The 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 InnoDB, which normally\n do not reuse sequence values.\n* When used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n* Since truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\n* TRUNCATE TABLE will only reset the values in the Performance Schema summary\ntables to zero or null, and will not remove the rows.\n\nFor the purposes of binary logging and replication, TRUNCATE TABLE is treated\nas DROP TABLE followed by CREATE TABLE (DDL rather than DML).\n\nTRUNCATE TABLE does not work on views. Currently, TRUNCATE TABLE drops all\nhistorical records from a system-versioned table.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nOracle-mode\n-----------\n\nOracle-mode from MariaDB 10.3 permits the optional keywords REUSE STORAGE or\nDROP STORAGE to be used.\n\nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE] [WAIT n | NOWAIT]\n\nThese have no effect on the operation.\n\nPerformance\n-----------\n\nTRUNCATE TABLE is faster than DELETE, because it drops and re-creates a table.\n\nWith InnoDB, TRUNCATE TABLE is slower if innodb_file_per_table=ON is set (the\ndefault). This is because TRUNCATE TABLE unlinks the underlying tablespace\nfile, which can be an expensive operation. See MDEV-8069 for more details.\n\nThe performance issues with innodb_file_per_table=ON can be exacerbated in\ncases where the InnoDB buffer pool is very large and\ninnodb_adaptive_hash_index=ON is set. In that case, using DROP TABLE followed\nby CREATE TABLE instead of TRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF (it defaults to ON before MariaDB 10.5) can\nalso help. In MariaDB 10.2 only, from MariaDB 10.2.19, this performance can\nalso be improved by setting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n\nSetting innodb_adaptive_hash_index=OFF can also improve TRUNCATE TABLE\nperformance in general. See MDEV-16796 for more details.\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 (707,38,'CREATE DATABASE','Syntax\n------\n\nCREATE [OR REPLACE] {DATABASE | SCHEMA} [IF NOT EXISTS] db_name\n [create_specification] ...\n\ncreate_specification:\n [DEFAULT] CHARACTER SET [=] charset_name\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'comment\'\n\nDescription\n-----------\n\nCREATE DATABASE creates a database with the given name. To use this statement,\nyou need the CREATE privilege for the database. CREATE SCHEMA is a synonym for\nCREATE DATABASE.\n\nFor valid identifiers to use as database names, see Identifier Names.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.3\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 shortcut for:\n\nDROP DATABASE IF EXISTS db_name;\nCREATE DATABASE db_name ...;\n\nIF NOT EXISTS\n-------------\n\nWhen the IF NOT EXISTS clause is used, MariaDB will return a warning instead\nof an error if the specified database already exists.\n\nCOMMENT\n-------\n\nMariaDB starting with 10.5.0\n----------------------------\nFrom MariaDB 10.5.0, it is possible to add a comment of a maximum of 1024\nbytes. If the comment length exceeds this length, a error/warning code 4144 is\nthrown. The database comment is also added to the db.opt file, as well as to\nthe information_schema.schemata table.\n\nExamples\n--------\n\nCREATE DATABASE db1;\nQuery OK, 1 row affected (0.18 sec)\n\nCREATE DATABASE db1;\nERROR 1007 (HY000): Can\'t create database \'db1\'; database exists\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\'; database exists |\n+-------+------+----------------------------------------------+\n\nSetting the character sets and collation. See Setting Character Sets and\nCollations for more details.\n\nCREATE DATABASE czech_slovak_names \n CHARACTER SET = \'keybcs2\'\n COLLATE = \'keybcs2_bin\';\n\nComments, from MariaDB 10.5.0:\n\nCREATE DATABASE presentations COMMENT \'Presentations for conferences\';\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 (708,38,'CREATE EVENT','Syntax\n------\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-----------\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as follows:\n\n* The keywords CREATE EVENT plus an event name, which uniquely identifies\n the event in the current schema. (Prior to MySQL 5.1.12, the event name\n needed to be unique only among events created by the same user on a given\n database.)\n* An ON SCHEDULE clause, which determines when and how often the event\n executes.\n* A DO clause, which contains the SQL statement to be executed by 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 event executes\nonce — one hour following its creation — by running an SQL statement that\nincrements the value of the myschema.mytable table\'s mycol column by 1.\n\nThe event_name must be a valid MariaDB identifier with a maximum length of 64\ncharacters. It may be delimited using back ticks, and may be qualified with\nthe name of a database schema. An event is associated with both a MariaDB user\n(the definer) and a schema, and its name must be unique among names of events\nwithin that schema. In general, the rules governing event names are the same\nas those for names of stored routines. See Identifier Names.\n\nIf no schema is indicated as part of event_name, the default (current) schema\nis assumed.\n\nFor valid identifiers to use as event names, see Identifier Names.\n\nOR REPLACE\n----------\n\nThe OR REPLACE clause was included in MariaDB 10.1.4. If used and the event\nalready exists, instead of an error being returned, the existing event will be\ndropped and replaced by the newly defined event.\n\nIF NOT EXISTS\n-------------\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the event already exists. Cannot be used together with OR REPLACE.\n\nON SCHEDULE\n-----------\n\nThe ON SCHEDULE clause can be used to specify when the event must be triggered.\n\nAT\n--\n\nIf you want to execute the event only once (one time event), you can use the\nAT keyword, followed by a timestamp. If you use CURRENT_TIMESTAMP, the event\nacts as soon as it is created. As a convenience, you can add one or more\nintervals to that timestamp. You can also specify a timestamp in the past, so\nthat the event is stored but not triggered, until you modify it via ALTER\nEVENT.\n\nThe following example shows how to create an event that will be triggered\ntomorrow at a certain time:\n\nCREATE EVENT example\nON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY + INTERVAL 3 HOUR\nDO something;\n\nYou can also specify that an event must be triggered at a regular interval\n(recurring event). In such cases, use the EVERY clause followed by the\ninterval.\n\nIf an event is recurring, you can specify when the first execution must happen\nvia the STARTS clause and a maximum time for the last execution via the ENDS\nclause. STARTS and ENDS clauses are followed by a timestamp and, optionally,\none or more intervals. The ENDS clause can specify a timestamp in the past, so\nthat the event is stored but not executed until you modify it via ALTER EVENT.\n\nIn the following example, next month a recurring event will be triggered\nhourly 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 units are the same\nused for other staments and time functions, except that you can\'t use\nmicroseconds for events. For simple time units, like HOUR or MINUTE, the\nquantity is an integer number, for example \'10 MINUTE\'. For composite time\nunits, like HOUR_MINUTE or HOUR_SECOND, the quantity must be a string with all\ninvolved simple values and their separators, for example \'2:30\' or \'2:30:30\'.\n\nON COMPLETION [NOT] PRESERVE\n----------------------------\n\nThe ON COMPLETION clause can be used to specify if the event must be deleted\nafter its last execution (that is, after its AT or ENDS timestamp is past). By\ndefault, events are dropped when they are expired. To explicitly state that\nthis is the desired behaviour, you can use ON COMPLETION NOT PRESERVE.\nInstead, if you want the event to be preserved, you can use ON COMPLETION\nPRESERVE.\n\nIn you specify ON COMPLETION NOT PRESERVE, and you specify a timestamp in the\npast for AT or ENDS clause, the event will be immediatly dropped. In such\ncases, you will get a Note 1558: \"Event execution time is in the past and ON\nCOMPLETION NOT PRESERVE is set. The event was dropped immediately after\ncreation\".\n\nENABLE/DISABLE/DISABLE ON SLAVE\n-------------------------------\n\nEvents are ENABLEd by default. If you want to stop MariaDB from executing an\nevent, you may specify DISABLE. When it is ready to be activated, you may\nenable it using ALTER EVENT. Another option is DISABLE ON SLAVE, which\nindicates that an event was created on a master and has been replicated to the\nslave, which is prevented from executing the event. If DISABLE ON SLAVE is\nspecifically set, the event will be disabled everywhere. It will not be\nexecuted on the mater or the slaves.\n\nCOMMENT\n-------\n\nThe COMMENT clause may be used to set a comment for the event. Maximum length\nfor comments is 64 characters. The comment is a string, so it must be quoted.\nTo see events comments, you can query the INFORMATION_SCHEMA.EVENTS table (the\ncolumn is named EVENT_COMMENT).\n\nExamples\n--------\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 3 HOUR\nDO something;\n\nNext month a recurring event will be 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\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;\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;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+--------------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------------+\n| Note | 1537 | Event \'myevent\' already exists |\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 (709,38,'CREATE FUNCTION','Syntax\n------\n\nCREATE [OR REPLACE]\n [DEFINER = {user | CURRENT_USER | role | CURRENT_ROLE }]\n [AGGREGATE] FUNCTION [IF NOT EXISTS] func_name ([func_parameter[,...]])\n RETURNS type\n [characteristic ...]\n RETURN func_body\nfunc_parameter:\n [ IN | OUT | INOUT | IN OUT ] param_name type\ntype:\n Any valid MariaDB data type\ncharacteristic:\n LANGUAGE SQL\n | [NOT] DETERMINISTIC\n | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\nfunc_body:\n Valid SQL procedure statement\n\nDescription\n-----------\n\nUse the CREATE FUNCTION statement to create a new stored function. You must\nhave the CREATE ROUTINE database privilege to use CREATE FUNCTION. A function\ntakes any number of arguments and returns a value from the function body. The\nfunction body can be any valid SQL expression as you would use, for example,\nin any select expression. If you have the appropriate privileges, you can call\nthe function exactly as you would any built-in function. See Security below\nfor details on privileges.\n\nYou can also use a variant of the CREATE FUNCTION statement to install a\nuser-defined function (UDF) defined by a plugin. See CREATE FUNCTION (UDF) for\ndetails.\n\nYou can use a SELECT statement for the function body by enclosing it in\nparentheses, exactly as you would to use a subselect for any other expression.\nThe SELECT statement must return a single value. If more than one column is\nreturned when the function is called, error 1241 results. If more than one row\nis returned when the function is called, error 1242 results. Use a LIMIT\nclause to ensure only one row is returned.\n\nYou can also replace the RETURN clause with a BEGIN...END compound statement.\nThe compound statement must contain a RETURN statement. When the function is\ncalled, the RETURN statement immediately returns its result, and any\nstatements after RETURN are effectively ignored.\n\nBy default, a function is associated with the current database. To associate\nthe function explicitly with a given database, specify the fully-qualified\nname as db_name.func_name when you create it. If the function name is the same\nas the name of a built-in function, you must use the fully qualified name when\nyou call it.\n\nThe parameter list enclosed within parentheses must always be present. If\nthere are no parameters, an empty parameter list of () should be used.\nParameter names are not case sensitive.\n\nEach parameter can be declared to use any valid data type, except that the\nCOLLATE attribute cannot be used.\n\nFor valid identifiers to use as function names, see Identifier Names.\n\nIN | OUT | INOUT | IN OUT\n-------------------------\n\nMariaDB starting with 10.8.0\n----------------------------\nThe function parameter qualifiers for IN, OUT, INOUT, and IN OUT were added in\na 10.8.0 preview release. Prior to 10.8.0 quantifiers were supported only in\nprocedures.\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and\nnot SELECT. These quantifiers are especially useful for creating functions\nwith more than one return value. This allows functions to be more complex and\nnested.\n\nDELIMITER $$\nCREATE FUNCTION add_func3(IN a INT, IN b INT, OUT c INT) RETURNS INT\nBEGIN\n SET c = 100;\n RETURN a + b;\nEND;\n$$\nDELIMITER ;\n\nSET @a = 2;\nSET @b = 3;\nSET @c = 0;\nSET @res= add_func3(@a, @b, @c);\n\nSELECT add_func3(@a, @b, @c);\nERROR 4186 (HY000): OUT or INOUT argument 3 for function add_func3 is not\nallowed here\n\nDELIMITER $$\nCREATE FUNCTION add_func4(IN a INT, IN b INT, d INT) RETURNS INT\nBEGIN\n DECLARE c, res INT;\n SET res = add_func3(a, b, c) + d;\n if (c > 99) then\n return 3;\n else\n return res;\n end if;\nEND;\n$$\n\nDELIMITER ;\n\nSELECT add_func4(1,2,3);\n+------------------+\n| add_func4(1,2,3) |\n+------------------+\n| 3 |\n+------------------+\n\nAGGREGATE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nFrom MariaDB 10.3.3, it is possible to create stored aggregate functions as\nwell. See Stored Aggregate Functions for details.\n\nRETURNS\n-------\n\nThe RETURNS clause specifies the return type of the function. NULL values are\npermitted with all return types.\n\nWhat happens if the RETURN clause returns a value of a different type? It\ndepends on the SQL_MODE in effect at the moment of the function creation.\n\nIf the SQL_MODE is strict (STRICT_ALL_TABLES or STRICT_TRANS_TABLES flags are\nspecified), a 1366 error will be produced.\n\nOtherwise, the value is coerced to the proper type. For example, if a function\nspecifies an ENUM or SET value in the RETURNS clause, but the RETURN clause\nreturns an integer, the value returned from the function is the string for the\ncorresponding ENUM member of set of SET members.\n\nMariaDB stores the SQL_MODE system variable setting that is in effect at the\ntime a routine is created, and always executes the routine with this setting\nin force, regardless of the server SQL mode in effect when the routine is\ninvoked.\n\nLANGUAGE SQL\n------------\n\nLANGUAGE SQL is a standard SQL clause, and it can be used in MariaDB for\nportability. However that clause has no meaning, because SQL is the only\nsupported language for stored functions.\n\nA function is deterministic if it can produce only one result for a given list\nof parameters. If the result may be affected by stored data, server variables,\nrandom numbers or any value that is not explicitly passed, then the function\nis not deterministic. Also, a function is non-deterministic if it uses\nnon-deterministic functions like NOW() or CURRENT_TIMESTAMP(). The optimizer\nmay choose a faster execution plan if it known that the function is\ndeterministic. In such cases, you should declare the routine using the\nDETERMINISTIC keyword. If you want to explicitly state that the function is\nnot deterministic (which is the default) you can use the NOT DETERMINISTIC\nkeywords.\n\nIf you declare a non-deterministic function as DETERMINISTIC, you may get\nincorrect results. If you declare a deterministic function as NOT\nDETERMINISTIC, in some cases the queries will be slower.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.3\n----------------------------\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP FUNCTION IF EXISTS function_name;\nCREATE FUNCTION function_name ...;\n\nwith the exception that any existing privileges for the function are not\ndropped.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.3\n----------------------------\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the function already exists. Cannot be used together with OR\nREPLACE.\n\n[NOT] DETERMINISTIC\n-------------------\n\nThe [NOT] DETERMINISTIC clause also affects binary logging, because the\nSTATEMENT format can not be used to store or replicate non-deterministic\nstatements.\n\nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA are informative\nclauses that tell the server what the function does. MariaDB does not check in\nany way whether the specified clause is correct. If none of these clauses are\nspecified, CONTAINS SQL is used by default.\n\nMODIFIES SQL DATA\n-----------------\n\nMODIFIES SQL DATA means that the function contains statements that may modify\ndata stored in databases. This happens if the function contains statements\nlike DELETE, UPDATE, INSERT, REPLACE or DDL.\n\nREADS SQL DATA\n--------------\n\nREADS SQL DATA means that the function reads data stored in databases, but\ndoes not modify any data. This happens if SELECT statements are used, but\nthere no write operations are executed.\n\nCONTAINS SQL\n------------\n\nCONTAINS SQL means that the function contains at least one SQL statement, but\nit does not read or write any data stored in a database. Examples include SET\nor DO.\n\nNO SQL\n------\n\nNO SQL means nothing, because MariaDB does not currently support any language\nother than SQL.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has been supported in\naddition to the traditional SQL/PSM-based MariaDB syntax. See Oracle mode from\nMariaDB 10.3 for details on changes when running Oracle mode.\n\nSecurity\n--------\n\nYou must have the EXECUTE privilege on a function to call it. MariaDB\nautomatically grants the EXECUTE and ALTER ROUTINE privileges to the account\nthat called CREATE FUNCTION, even if the DEFINER clause was used.\n\nEach function has an account associated as the definer. By default, the\ndefiner is the account that created the function. Use the DEFINER clause to\nspecify a different account as the definer. You must have the SUPER privilege,\nor, from MariaDB 10.5.2, the SET USER privilege, to use the DEFINER clause.\nSee Account Names for details on specifying accounts.\n\nThe SQL SECURITY clause specifies what privileges are used when a function is\ncalled. If SQL SECURITY is INVOKER, the function body will be evaluated using\nthe privileges of the user calling the function. If SQL SECURITY is DEFINER,\nthe function body is always evaluated using the privileges of the definer\naccount. DEFINER is the default.\n\nThis allows you to create functions that grant limited access to certain data.\nFor example, say you have a table that stores some employee information, and\nthat you\'ve granted SELECT privileges only on certain columns to the user\naccount roger.\n\nCREATE TABLE employees (name TINYTEXT, dept TINYTEXT, salary INT);\nGRANT SELECT (name, dept) ON employees TO roger;\n\nTo allow the user the get the maximum salary for a department, define a\nfunction and grant the EXECUTE privilege:\n\nCREATE FUNCTION max_salary (dept TINYTEXT) RETURNS INT RETURN\n (SELECT MAX(salary) FROM employees WHERE employees.dept = dept);\nGRANT EXECUTE ON FUNCTION max_salary TO roger;\n\nSince SQL SECURITY defaults to DEFINER, whenever the user roger calls this\nfunction, the subselect will execute with your privileges. As long as you have\nprivileges to select the salary of each employee, the caller of the function\nwill be able to get the maximum salary for each department without being able\nto see individual salaries.\n\nCharacter sets and collations\n-----------------------------\n\nFunction return types can be declared to use any valid character set and\ncollation. If used, the COLLATE attribute needs to be preceded by a CHARACTER\nSET attribute.\n\nIf the character set and collation are not specifically set in the statement,\nthe database defaults at the time of creation will be used. If the database\ndefaults change at a later stage, the stored function character set/collation\nwill not be changed at the same time; the stored function needs to be dropped\nand recreated to ensure the same character set/collation as the database is\nused.\n\nExamples\n--------\n\nThe following example function takes a parameter, performs an 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 data with\nstatements like INSERT and UPDATE. The following example creates a counter\nfunction that uses a temporary table to store the current value. Because the\ncompound statement contains statements terminated with semicolons, you have to\nfirst change the statement delimiter with the DELIMITER statement to allow the\nsemicolon to be used in the function body. See Delimiters in the mysql client\nfor 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 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 \'utf8_bin\' DETERMINISTIC\n RETURN CONCAT(\'Hello, \',s,\'!\');\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 (710,38,'CREATE INDEX','Syntax\n------\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 | CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\n\nalgorithm_option:\n ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}\n\nlock_option:\n LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}\n\nDescription\n-----------\n\nCREATE INDEX is mapped to an ALTER TABLE statement to create indexes. See\nALTER TABLE. CREATE INDEX cannot be used to create a PRIMARY KEY; use ALTER\nTABLE instead.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nAnother shortcut, DROP INDEX, allows the removal of an index.\n\nFor valid identifiers to use as index names, see Identifier Names.\n\nNote that KEY_BLOCK_SIZE is currently ignored in CREATE INDEX, although it is\nincluded in the output of SHOW CREATE TABLE.\n\nPrivileges\n----------\n\nExecuting the CREATE INDEX statement requires the INDEX privilege for the\ntable or the database.\n\nOnline DDL\n----------\n\nOnline DDL is supported with the ALGORITHM and LOCK clauses.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nCREATE OR REPLACE INDEX\n-----------------------\n\nMariaDB starting with 10.1.4\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 exists, then instead\nof returning an error, the server will drop the existing index and replace it\nwith the newly defined index.\n\nCREATE INDEX IF NOT EXISTS\n--------------------------\n\nIf the IF NOT EXISTS clause is used, then the index will only be created if an\nindex with the same name does not already exist. If the index already exists,\nthen a warning will be triggered by default.\n\nIndex Definitions\n-----------------\n\nSee CREATE TABLE: Index Definitions for information about index definitions.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nALGORITHM\n---------\n\nSee ALTER TABLE: ALGORITHM for more information.\n\nLOCK\n----\n\nSee ALTER TABLE: LOCK for more information.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for CREATE INDEX statement for clients\nthat support the new progress reporting protocol. For example, if you were\nusing the mysql client, then the progress 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 PROCESSLIST\nstatement and in the contents of the information_schema.PROCESSLIST table.\n\nSee Progress Reporting for more information.\n\nWITHOUT OVERLAPS\n----------------\n\nMariaDB starting with 10.5.3\n----------------------------\nThe WITHOUT OVERLAPS clause allows one to constrain a primary or unique index\nsuch that application-time periods cannot overlap.\n\nExamples\n--------\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| Level | Code | Message |\n+-------+------+-------------------------+\n| Note | 1061 | Duplicate key name \'xi\' |\n+-------+------+-------------------------+\n\nFrom MariaDB 10.5.3, creating a unique index for an application-time period\ntable with a WITHOUT OVERLAPS constraint:\n\nCREATE UNIQUE INDEX u ON rooms (room_number, p WITHOUT OVERLAPS);\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 (711,38,'CREATE PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\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 [ IN | OUT | INOUT | IN OUT ] 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 DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n\nDescription\n-----------\n\nThe CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nThe CREATE PACKAGE creates the specification for a stored package (a\ncollection of logically related stored objects). A stored package\nspecification declares public routines (procedures and functions) of the\npackage, but does not implement these routines.\n\nA package whose specification was created by the CREATE PACKAGE statement,\nshould later be implemented using the CREATE PACKAGE BODY statement.\n\nFunction parameter quantifiers IN | OUT | INOUT | IN OUT\n--------------------------------------------------------\n\nMariaDB starting with 10.8.0\n----------------------------\nThe function parameter quantifiers for IN, OUT, INOUT, and IN OUT where added\nin a 10.8.0 preview release. Prior to 10.8.0 quantifiers were supported only\nin procedures.\n\nOUT, INOUT and its equivalent IN OUT, are only valid if called from SET and\nnot SELECT. These quantifiers are especially useful for creating functions and\nprocedures with more than one return value. This allows functions and\nprocedures to be more complex and nested.\n\nExamples\n--------\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\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 (712,38,'CREATE PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\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 \';\' [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\nDescription\n-----------\n\nThe CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nThe CREATE PACKAGE BODY statement creates the package body for a stored\npackage. The package specification must be previously created using the CREATE\nPACKAGE statement.\n\nA package body provides implementations of the package public routines and can\noptionally have:\n\n* package-wide private variables\n* package private routines\n* forward declarations for private routines\n* an executable initialization section\n\nExamples\n--------\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, esalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n\nFUNCTION 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=\' || nSalary);\n RETURN nSalary;\n END;\n\nPROCEDURE 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=\' || amount);\n END;\n\nPROCEDURE 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() || \' \' || current_user || \' started\');\nEND;\n$$\n\nDELIMITER ;\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 (713,38,'CREATE PROCEDURE','Syntax\n------\n\nCREATE\n [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n PROCEDURE [IF NOT EXISTS] 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 DATA }\n | SQL SECURITY { DEFINER | INVOKER }\n | COMMENT \'string\'\n\nroutine_body:\n Valid SQL procedure statement\n\nDescription\n-----------\n\nCreates a stored procedure. By default, a routine is associated with the\ndefault database. To associate the routine explicitly with a given database,\nspecify the name as db_name.sp_name when you create it.\n\nWhen the routine is invoked, an implicit USE db_name is performed (and undone\nwhen the routine terminates). The causes the routine to have the given default\ndatabase while it executes. USE statements within stored routines are\ndisallowed.\n\nWhen a stored procedure has been created, you invoke it by using the CALL\nstatement (see CALL).\n\nTo execute the CREATE PROCEDURE statement, it is necessary to have the CREATE\nROUTINE privilege. By default, MariaDB automatically grants the ALTER ROUTINE\nand EXECUTE privileges to the routine creator. See also Stored Routine\nPrivileges.\n\nThe DEFINER and SQL SECURITY clauses specify the security context to be used\nwhen checking access privileges at routine execution time, as described here.\nRequires the SUPER privilege, or, from MariaDB 10.5.2, the SET USER privilege.\n\nIf the routine name is the same as the name of a built-in SQL function, you\nmust use a space between the name and the following parenthesis when defining\nthe routine, or a syntax error occurs. This is also true when you invoke the\nroutine later. For this reason, we suggest that it is better to avoid re-using\nthe names of existing SQL functions for your own stored routines.\n\nThe IGNORE_SPACE SQL mode applies to built-in functions, not to stored\nroutines. It is always allowable to have spaces after a routine name,\nregardless of whether IGNORE_SPACE is enabled.\n\nThe parameter list enclosed within parentheses must always be present. If\nthere are no parameters, an empty parameter list of () should be used.\nParameter names are not case sensitive.\n\nEach parameter can be declared to use any valid data type, except that the\nCOLLATE attribute cannot be used.\n\nFor valid identifiers to use as procedure names, see Identifier Names.\n\nThings to be Aware of With CREATE OR REPLACE\n--------------------------------------------\n\n* One can\'t use OR REPLACE together with IF EXISTS.\n\nCREATE PROCEDURE IF NOT EXISTS\n------------------------------\n\nIf the IF NOT EXISTS clause is used, then the procedure will only be created\nif a procedure with the same name does not already exist. If the procedure\nalready exists, then a warning will be triggered by default.\n\nIN/OUT/INOUT\n------------\n\nEach parameter is an IN parameter by default. To specify otherwise for a\nparameter, use the keyword OUT or INOUT before the parameter name.\n\nAn IN parameter passes a value into a procedure. The procedure might modify\nthe value, but the modification is not visible to the caller when the\nprocedure returns. An OUT parameter passes a value from the procedure back to\nthe caller. Its initial value is NULL within the procedure, and its value is\nvisible to the caller when the procedure returns. An INOUT parameter is\ninitialized by the caller, can be modified by the procedure, and any change\nmade by the procedure is visible to the caller when the procedure returns.\n\nFor each OUT or INOUT parameter, pass a user-defined variable in the CALL\nstatement that invokes the procedure so that you can obtain its value when the\nprocedure returns. If you are calling the procedure from within another stored\nprocedure or function, you can also pass a routine parameter or local routine\nvariable as an IN or INOUT parameter.\n\nDETERMINISTIC/NOT DETERMINISTIC\n-------------------------------\n\nDETERMINISTIC and NOT DETERMINISTIC apply only to functions. Specifying\nDETERMINISTC or NON-DETERMINISTIC in procedures has no effect. The default\nvalue is NOT DETERMINISTIC. Functions are DETERMINISTIC when they always\nreturn the same value for the same input. For example, a truncate or substring\nfunction. Any function involving data, therefore, is always NOT DETERMINISTIC.\n\nCONTAINS SQL/NO SQL/READS SQL DATA/MODIFIES SQL DATA\n----------------------------------------------------\n\nCONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA are informative\nclauses that tell the server what the function does. MariaDB does not check in\nany way whether the specified 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 statements that may modify\ndata stored in databases. This happens if the function contains statements\nlike DELETE, UPDATE, INSERT, REPLACE or DDL.\n\nREADS SQL DATA means that the function reads data stored in databases, but\ndoes not modify any data. This happens if SELECT statements are used, but\nthere no write operations are executed.\n\nCONTAINS SQL means that the function contains at least one SQL statement, but\nit does not read or write any data stored in a database. Examples include SET\nor DO.\n\nNO SQL means nothing, because MariaDB does not currently support any language\nother than SQL.\n\nThe routine_body consists of a valid SQL procedure statement. This can be a\nsimple statement such as SELECT or INSERT, or it can be a compound statement\nwritten using BEGIN and END. Compound statements can contain declarations,\nloops, and other control structure statements. See Programmatic and Compound\nStatements for syntax details.\n\nMariaDB allows routines to contain DDL statements, such as CREATE and DROP.\nMariaDB also allows stored procedures (but not stored functions) to contain\nSQL transaction statements such as COMMIT.\n\nFor additional information about statements that are not allowed in stored\nroutines, see Stored Routine Limitations.\n\nInvoking stored procedure from within programs\n----------------------------------------------\n\nFor information about invoking stored procedures from within programs written\nin a language that has a MariaDB/MySQL interface, see CALL.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP PROCEDURE IF EXISTS name;\nCREATE PROCEDURE name ...;\n\nwith the exception that any existing privileges for the procedure are not\ndropped.\n\nsql_mode\n--------\n\nMariaDB stores the sql_mode system variable setting that is in effect at the\ntime a routine is created, and always executes the routine with this setting\nin force, regardless of the server SQL mode in effect when the routine is\ninvoked.\n\nCharacter Sets and Collations\n-----------------------------\n\nProcedure parameters can be declared with any character set/collation. If the\ncharacter set and collation are not specifically set, the database defaults at\nthe time of creation will be used. If the database defaults change at a later\nstage, the stored procedure character set/collation will not be changed at the\nsame time; the stored procedure needs to be dropped and recreated to ensure\nthe same character set/collation as the database is used.\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nFrom MariaDB 10.3, a subset of Oracle\'s PL/SQL language has been supported in\naddition to the traditional SQL/PSM-based MariaDB syntax. See Oracle mode from\nMariaDB 10.3 for details on changes when running Oracle mode.\n\nExamples\n--------\n\nThe following example shows a simple stored procedure that uses an OUT\nparameter. It uses the DELIMITER command to set a new delimiter for the\nduration of the process — see Delimiters in 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 \'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 \'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\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 \'utf8_bin\'\n)\n BEGIN\n SELECT CONCAT(\'a\'),f1 INTO param1 FROM t;\n END;\n//\nERROR 1304 (42000): PROCEDURE simpleproc2 already exists\n\nDELIMITER ;\nQuery OK, 0 rows affected (0.03 sec)\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 (714,38,'CREATE SERVER','Syntax\n------\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-----------\n\nThis statement creates the definition of a server for use with the Spider,\nConnect, FEDERATED or FederatedX storage engine. The CREATE SERVER statement\ncreates a new row within the servers table within the mysql database. This\nstatement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED\nADMIN privilege.\n\nThe server_name should be a unique reference to the server. Server definitions\nare global within the scope of the server, it is not possible to qualify the\nserver definition to a specific database. server_name has a maximum length of\n64 characters (names longer than 64 characters are silently truncated), and is\ncase insensitive. You may specify the name as a quoted string.\n\nThe wrapper_name may be quoted with single quotes. Supported values are:\n\n* mysql\n* mariadb (in MariaDB 10.3 and later)\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are silently\ntruncated to 64 characters. Numeric literals must be a number between 0 and\n9999, default value is 0.\n\nNote: The OWNER option is currently not applied, and has no effect on the\nownership or operation of the server connection that is created.\n\nThe CREATE SERVER statement creates an entry in the mysql.servers table that\ncan later be used with the CREATE TABLE statement when creating a Spider,\nConnect, FederatedX or FEDERATED table. The options that you specify will be\nused to populate the columns in the mysql.servers table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nDROP SERVER removes a previously created server definition.\n\nCREATE SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nFor valid identifiers to use as server names, see Identifier Names.\n\nOR REPLACE\n----------\n\nIf the optional OR REPLACE clause is used, it acts as a shortcut for:\n\nDROP SERVER IF EXISTS name;\nCREATE SERVER server_name ...;\n\nIF NOT EXISTS\n-------------\n\nIf the IF NOT EXISTS clause is used, MariaDB will return a warning instead of\nan error if the server already exists. Cannot be used together with OR REPLACE.\n\nExamples\n--------\n\nCREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'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 \'test\');\nERROR 1476 (HY000): The foreign server, s, you are trying to create already\nexists\n\nCREATE OR REPLACE SERVER s \nFOREIGN DATA WRAPPER mysql \nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'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 \'test\');\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------------------------\n+\n| Level | Code | Message \n |\n+-------+------+---------------------------------------------------------------\n+\n| Note | 1476 | The foreign server, s, you are trying to create already\nexists |\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 (715,38,'CREATE TABLESPACE','The CREATE TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (716,38,'CREATE TRIGGER','Syntax\n------\n\nCREATE [OR REPLACE]\n [DEFINER = { user | CURRENT_USER | role | CURRENT_ROLE }]\n TRIGGER [IF NOT EXISTS] trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW\n [{ FOLLOWS | PRECEDES } other_trigger_name ]\n trigger_stmt;\n\nDescription\n-----------\n\nThis statement creates a new trigger. A trigger is a named database object\nthat is associated with a table, and that activates when a particular event\noccurs for the table. The trigger becomes associated with the table named\ntbl_name, which must refer to a permanent table. You cannot associate a\ntrigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated with\nthe trigger.\n\nMariaDB starting with 10.2.3\n----------------------------\nYou can have multiple triggers for the same trigger_time and trigger_event.\n\nFor valid identifiers to use as trigger names, see Identifier Names.\n\nOR REPLACE\n----------\n\nMariaDB starting with 10.1.4\n----------------------------\nIf used and the trigger already exists, instead of an error being returned,\nthe existing trigger will be dropped and replaced by the newly defined trigger.\n\nDEFINER\n-------\n\nThe DEFINER clause determines the security context to be used when checking\naccess privileges at trigger activation time. Usage requires the SUPER\nprivilege, or, from MariaDB 10.5.2, the SET USER privilege.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.4\n----------------------------\nIf the IF NOT EXISTS clause is used, the trigger will only be created if a\ntrigger of the same name does not exist. If the trigger already exists, by\ndefault a warning will be returned.\n\ntrigger_time\n------------\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to indicate\nthat the trigger activates before or after each row to be modified.\n\ntrigger_event\n-------------\n\ntrigger_event indicates the kind of statement that activates the trigger. The\ntrigger_event can be one of the following:\n\n* INSERT: The trigger is activated whenever a new row is inserted into the\ntable; for example, through INSERT, LOAD DATA, and REPLACE statements.\n* UPDATE: The trigger is activated whenever a row is modified; for example,\nthrough UPDATE statements.\n* DELETE: The trigger is activated whenever a row is deleted from the table;\nfor example, through DELETE and REPLACE statements. However, DROP TABLE and\nTRUNCATE statements on the table do not activate this trigger, because they do\nnot use DELETE. Dropping a partition does not activate DELETE triggers, either.\n\nFOLLOWS/PRECEDES other_trigger_name\n-----------------------------------\n\nMariaDB starting with 10.2.3\n----------------------------\nThe FOLLOWS other_trigger_name and PRECEDES other_trigger_name options were\nadded in MariaDB 10.2.3 as part of supporting multiple triggers per action\ntime. This is the same syntax used by MySQL 5.7, although MySQL 5.7 does not\nhave multi-trigger support.\n\nFOLLOWS adds the new trigger after another trigger while PRECEDES adds the new\ntrigger before another trigger. If neither option is used, the new trigger is\nadded last for the given action and time.\n\nFOLLOWS and PRECEDES are not stored in the trigger definition. However the\ntrigger order is guaranteed to not change over time. mariadb-dump/mysqldump\nand other backup methods will not change trigger order. You can verify the\ntrigger order from the ACTION_ORDER column in INFORMATION_SCHEMA.TRIGGERS\ntable.\n\nSELECT trigger_name, action_order FROM information_schema.triggers \n WHERE event_object_table=\'t1\';\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE TRIGGER is atomic.\n\nExamples\n--------\n\nCREATE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_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 = animal_count.animals+1;\nERROR 1359 (HY000): Trigger already exists\n\nCREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_count.animals+1;\nQuery OK, 0 rows affected (0.12 sec)\n\nCREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS increment_animal\n AFTER INSERT ON animals FOR EACH ROW\n UPDATE animal_count SET animal_count.animals = animal_count.animals+1;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1359 | Trigger already exists |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\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 (717,38,'CREATE VIEW','Syntax\n------\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-----------\n\nThe CREATE VIEW statement creates a new view, or replaces an existing one if\nthe OR REPLACE clause is given. If the view does not exist, CREATE OR REPLACE\nVIEW is the same as CREATE VIEW. If the view does exist, CREATE OR REPLACE\nVIEW is the same as ALTER VIEW.\n\nThe select_statement is a SELECT statement that provides the definition of the\nview. (When you select from the view, you select in effect using the SELECT\nstatement.) select_statement can select from base tables or other views.\n\nThe view definition is \"frozen\" at creation time, so changes to the underlying\ntables afterwards do not affect the view definition. For example, if a view is\ndefined as SELECT * on a table, new columns added to the table later do not\nbecome part of the view. A SHOW CREATE VIEW shows that such queries are\nrewritten and column names are included in the view definition.\n\nThe view definition must be a query that does not return errors at view\ncreation times. However, the base tables used by the views might be altered\nlater and the query may not be valid anymore. In this case, querying the view\nwill result in an error. CHECK TABLE helps in finding this kind of problems.\n\nThe ALGORITHM clause affects how MariaDB processes the view. The DEFINER and\nSQL SECURITY clauses specify the security context to be used when checking\naccess privileges at view invocation time. The WITH CHECK OPTION clause can be\ngiven to constrain inserts or updates to rows in tables referenced by the\nview. These clauses are described later in this section.\n\nThe CREATE VIEW statement requires the CREATE VIEW privilege for the view, and\nsome privilege for each column selected by the SELECT statement. For columns\nused elsewhere in the SELECT statement you must have the SELECT privilege. If\nthe OR REPLACE clause is present, you must also have the DROP privilege for\nthe view.\n\nA view belongs to a database. By default, a new view is created in the default\ndatabase. To create the view explicitly in a given database, specify the name\nas 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 database, so a\ndatabase cannot contain a base table and a view that have the same name.\n\nViews must have unique column names with no duplicates, just like base tables.\nBy default, the names of the columns retrieved by the SELECT statement are\nused for the view column names. To define explicit names for the view columns,\nthe optional column_list clause can be given as a list of comma-separated\nidentifiers. The number of names in column_list must be the same as the number\nof columns retrieved by the SELECT statement.\n\nMySQL until 5.1.28\n------------------\nPrior to MySQL 5.1.29, When you modify an existing view, the current view\ndefinition is backed up and saved. It is stored in that table\'s database\ndirectory, in a subdirectory named arc. The backup file for a view v is named\nv.frm-00001. If you alter the view again, the next backup is named\nv.frm-00002. The three latest view backup definitions are stored. Backed up\nview definitions are not preserved by mysqldump, or any other such programs,\nbut you can retain them using a file copy operation. However, they are not\nneeded for anything but to provide you with a backup of your previous view\ndefinition. It is safe to remove these backup definitions, but only while\nmysqld is not running. If you delete the arc subdirectory or its files while\nmysqld is running, you will receive an error the next time you try to alter\nthe view:\n\nMariaDB [test]> ALTER VIEW v AS SELECT * FROM t; \nERROR 6 (HY000): Error on delete of \'.\\test\\arc/v.frm-0004\' (Errcode: 2)\n\nColumns retrieved by the SELECT statement can be simple references to table\ncolumns. They can also be expressions that use functions, constant values,\noperators, and so forth.\n\nUnqualified table or view names in the SELECT statement are interpreted with\nrespect to the default database. A view can refer to tables or views in other\ndatabases by qualifying the table or view name with the proper database name.\n\nA view can be created from many kinds of SELECT statements. It can refer to\nbase tables or other views. It can use joins, UNION, and subqueries. The\nSELECT need not even refer to any tables. The following example defines a view\nthat selects two columns from another table, as well as an expression\ncalculated from those columns:\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 t;\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:\n\n* The SELECT statement cannot contain a subquery in the FROM clause.\n* The SELECT statement cannot refer to system or user variables.\n* Within a stored program, the definition cannot refer to program parameters\nor local variables.\n* The SELECT statement cannot refer to prepared statement parameters.\n* Any table or view referred to in the definition must exist. However, after a\nview has been created, it is possible to drop a table or view that the\ndefinition refers to. In this case, use of the view results in an error. To\ncheck a view definition for problems of this kind, use the CHECK TABLE\nstatement.\n* The definition cannot refer to a TEMPORARY table, and you cannot create a\nTEMPORARY view.\n* Any tables named in the view definition must exist at definition time.\n* You cannot associate a trigger with a view.\n* For valid identifiers to use as view names, see Identifier Names.\n\nORDER BY is allowed in a view definition, but it is ignored if you select from\na view using a statement that has its own ORDER BY.\n\nFor other options or clauses in the definition, they are added to the options\nor clauses of the statement that references the view, but the effect is\nundefined. For example, if a view definition includes a LIMIT clause, and you\nselect from the view using a statement that has its own LIMIT clause, it is\nundefined which limit applies. This same principle applies to options such as\nALL, DISTINCT, or SQL_SMALL_RESULT that follow the SELECT keyword, and to\nclauses such as INTO, FOR UPDATE, and LOCK IN SHARE MODE.\n\nThe PROCEDURE clause cannot be used in a view definition, and it cannot be\nused if a view is referenced in the FROM clause.\n\nIf you create a view and then change the query processing environment by\nchanging system variables, that may affect the results that you get from the\nview:\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 account to use\nwhen checking access privileges for the view when a statement is executed that\nreferences the view. They were added in MySQL 5.1.2. The legal SQL SECURITY\ncharacteristic values are DEFINER and INVOKER. These indicate that the\nrequired privileges must be held by the user who defined or invoked the view,\nrespectively. The default SQL SECURITY value is DEFINER.\n\nIf a user value is given for the DEFINER clause, it should be a MariaDB\naccount in \'user_name\'@\'host_name\' format (the same format used in the GRANT\nstatement). The user_name and host_name values both are required. The definer\ncan also be given as CURRENT_USER or CURRENT_USER(). The default DEFINER value\nis the user who executes the CREATE VIEW statement. This is the same as\nspecifying DEFINER = CURRENT_USER explicitly.\n\nIf you specify the DEFINER clause, these rules determine the legal DEFINER\nuser values:\n\n* If you do not have the SUPER privilege, or, from MariaDB 10.5.2, the SET\nUSER privilege, the only legal user value is your own account, either\nspecified literally or by using CURRENT_USER. You cannot set the definer to\nsome other account.\n* If you have the SUPER privilege, or, from MariaDB 10.5.2, the SET USER\nprivilege, you can specify any syntactically legal account name. If the\naccount does not actually exist, a warning is generated.\n* If the SQL SECURITY value is DEFINER but the definer account does not exist\nwhen the view is referenced, an error occurs.\n\nWithin a view definition, CURRENT_USER returns the view\'s DEFINER value by\ndefault. For views defined with the SQL SECURITY INVOKER characteristic,\nCURRENT_USER returns the account for the view\'s invoker. For information about\nuser auditing 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 SECURITY DEFINER\ncharacteristic, CURRENT_USER returns the routine\'s DEFINER value. This also\naffects a view defined within such a program, if the view definition contains\na DEFINER value of CURRENT_USER.\n\nView privileges are checked like this:\n\n* At view definition time, the view creator must have the privileges needed to\nuse the top-level objects accessed by the view. For example, if the view\ndefinition refers to table columns, the creator must have privileges for the\ncolumns, as described previously. If the definition refers to a stored\nfunction, only the privileges needed to invoke the function can be checked.\nThe privileges required when the function runs can be checked only as it\nexecutes: For different invocations of the function, different execution paths\nwithin the function might be taken.\n* When a view is referenced, privileges for objects accessed by the view are\nchecked against the privileges held by the view creator or invoker, depending\non whether the SQL SECURITY characteristic is DEFINER or INVOKER, respectively.\n* If reference to a view causes execution of a stored function, privilege\nchecking for statements executed within the function depend on whether the\nfunction is defined with a SQL SECURITY characteristic of DEFINER or INVOKER.\nIf the security characteristic is DEFINER, the function runs with the\nprivileges of its creator. If the characteristic is INVOKER, the function runs\nwith the privileges determined by the view\'s SQL SECURITY characteristic.\n\nExample: A view might depend on a stored function, and that function might\ninvoke other stored routines. For example, the following view invokes a stored\nfunction f():\n\nCREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);\n\nSuppose that f() contains a statement such as this:\n\nIF name IS NULL then\n CALL p1();\nELSE\n CALL p2();\nEND IF;\n\nThe privileges required for executing statements within f() need to be checked\nwhen f() executes. This might mean that privileges are needed for p1() or\np2(), depending on the execution path within f(). Those privileges must be\nchecked at runtime, and the user who must possess the privileges is determined\nby the SQL SECURITY values of the view v and the function f().\n\nThe DEFINER and SQL SECURITY clauses for views are extensions to standard SQL.\nIn standard SQL, views are handled using the rules for SQL SECURITY INVOKER.\n\nIf you invoke a view that was created before MySQL 5.1.2, it is treated as\nthough it was created with a SQL SECURITY DEFINER clause and with a DEFINER\nvalue that is the same as your account. However, because the actual definer is\nunknown, MySQL issues a warning. To make the warning go away, it is sufficient\nto re-create the view so that the view definition includes a DEFINER clause.\n\nThe optional ALGORITHM clause is an extension to standard SQL. It affects how\nMariaDB processes the view. ALGORITHM takes three values: MERGE, TEMPTABLE, or\nUNDEFINED. The default algorithm is UNDEFINED if no ALGORITHM clause is\npresent. See View Algorithms for more information.\n\nSome views are updatable. That is, you can use them in statements such as\nUPDATE, DELETE, or INSERT to update the contents of the underlying table. For\na view to be updatable, there must be a one-to-one relationship between the\nrows in the view and the rows in the underlying table. There are also certain\nother constructs that make a view non-updatable. See Inserting and Updating\nwith Views.\n\nWITH CHECK OPTION\n-----------------\n\nThe WITH CHECK OPTION clause can be given for an updatable view to prevent\ninserts or updates to rows except those for which the WHERE clause in the\nselect_statement is true.\n\nIn a WITH CHECK OPTION clause for an updatable view, the LOCAL and CASCADED\nkeywords determine the scope of check testing when the view is defined in\nterms of another view. The LOCAL keyword restricts the CHECK OPTION only to\nthe view being defined. CASCADED causes the checks for underlying views to be\nevaluated as well. When neither keyword is given, the default is CASCADED.\n\nFor more information about updatable views and the WITH CHECK OPTION clause,\nsee Inserting and Updating with Views.\n\nIF NOT EXISTS\n-------------\n\nMariaDB starting with 10.1.3\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 warning instead\nof an error if the specified view already exists. Cannot be used together with\nthe OR REPLACE clause.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE VIEW is atomic.\n\nExamples\n--------\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| 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;\nERROR 1050 (42S01): Table \'v\' already exists\n\nCREATE OR REPLACE VIEW v AS SELECT a, a*2 AS a2 FROM t;\nQuery OK, 0 rows affected (0.04 sec)\n\nCREATE VIEW IF NOT EXISTS v AS SELECT a, a*2 AS a2 FROM t;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n','','https://mariadb.com/kb/en/create-view/');
+update help_topic set description = CONCAT(description, '\nSHOW WARNINGS;\n+-------+------+--------------------------+\n| Level | Code | Message |\n+-------+------+--------------------------+\n| Note | 1050 | Table \'v\' already exists |\n+-------+------+--------------------------+\n\nURL: https://mariadb.com/kb/en/create-view/') WHERE help_topic_id = 717;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (718,38,'Generated (Virtual and Persistent/Stored) Columns','Syntax\n------\n\n<type> [GENERATED ALWAYS] AS ( <expression> )\n[VIRTUAL | PERSISTENT | STORED] [UNIQUE] [UNIQUE KEY] [COMMENT <text>]\n\nMariaDB\'s generated columns syntax is designed to be similar to the syntax for\nMicrosoft SQL Server\'s computed columns and Oracle Database\'s virtual columns.\nIn MariaDB 10.2 and later, the syntax is also compatible with the syntax for\nMySQL\'s generated columns.\n\nDescription\n-----------\n\nA generated column is a column in a table that cannot explicitly be set to a\nspecific value in a DML query. Instead, its value is automatically generated\nbased on an expression. This expression might generate the value based on the\nvalues of other columns in the table, or it might generate the value by\ncalling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n* PERSISTENT (a.k.a. STORED): This type\'s value is actually stored in the\ntable.\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nSupported Features\n------------------\n\nStorage Engine Support\n----------------------\n\n* Generated columns can only be used with storage engines which support them.\nIf you try to use a storage engine that does not support them, then you will\nsee an error similar to the following:\n\nERROR 1910 (HY000): TokuDB storage engine does not support computed columns\n\n* InnoDB, Aria, MyISAM and CONNECT support generated columns.\n\n* A column in a MERGE table can be built on a PERSISTENT generated column.\nHowever, a column in a MERGE table can not be defined as a VIRTUAL and\nPERSISTENT generated column.\n\nData Type Support\n-----------------\n\n* All data types are supported when defining generated columns.\n\n* Using the ZEROFILL column option is supported when defining generated\ncolumns.\n\nMariaDB starting with 10.2.6\n----------------------------\nIn MariaDB 10.2.6 and later, the following statements apply to data types for\ngenerated columns:\n\n* Using the AUTO_INCREMENT column option is not supported when defining\ngenerated columns. Previously, it was supported, but this support was removed,\nbecause it would not work correctly. See MDEV-11117.\n\nIndex Support\n-------------\n\n* Using a generated column as a table\'s primary key is not supported. See\nMDEV-5590 for more information. If you try to use one as a primary key, then\nyou will see an error similar to the following:\n\nERROR 1903 (HY000): Primary key cannot be defined upon a computed column\n\n* Using PERSISTENT generated columns as part of a foreign key is supported.\n\n* Referencing PERSISTENT generated columns as part of a foreign key is also\nsupported.\nHowever, using the ON UPDATE CASCADE, ON UPDATE SET NULL, or ON DELETE SET\nNULL clauses is not supported. If you try to use an unsupported clause, then\nyou will see an error similar to the following:\n\nERROR 1905 (HY000): Cannot define foreign key with ON UPDATE SET NULL clause\non a computed column\n\nMariaDB starting with 10.2.3\n----------------------------\nIn MariaDB 10.2.3 and later, the following statements apply to indexes for\ngenerated columns:\n\n* Defining indexes on both VIRTUAL and PERSISTENT generated columns is\nsupported.\nIf an index is defined on a generated column, then the optimizer considers\nusing it in the same way as indexes based on \"real\" columns.\n\nMariaDB until 10.2.2\n--------------------\nIn MariaDB 10.2.2 and before, the following statements apply to indexes for\ngenerated columns:\n\n* Defining indexes on VIRTUAL generated columns is not supported.\n\n* Defining indexes on PERSISTENT generated columns is supported.\nIf an index is defined on a generated column, then the optimizer considers\nusing it in the same way as indexes based on \"real\" columns.\n\nStatement Support\n-----------------\n\n* Generated columns are used in DML queries just as if they were \"real\"\ncolumns.\nHowever, VIRTUAL and PERSISTENT generated columns differ in how their data is\nstored.\nValues for PERSISTENT generated columns are generated whenever a DML queries\ninserts or updates the row with the special DEFAULT value. This generates the\ncolumns value, and it is stored in the table like the other \"real\" columns.\nThis value can be read by other DML queries just like the other \"real\" columns.\nValues for VIRTUAL generated columns are not stored in the table. Instead, the\nvalue is generated dynamically whenever the column is queried. If other\ncolumns in a row are queried, but the VIRTUAL generated column is not one of\nthe queried columns, then the column\'s value is not generated.\n\n* The SELECT statement supports generated columns.\n\n* Generated columns can be referenced in the INSERT, UPDATE, and DELETE\nstatements.\nHowever, VIRTUAL or PERSISTENT generated columns cannot be explicitly set to\nany other values than NULL or DEFAULT. If a generated column is explicitly set\nto any other value, then the outcome depends on whether strict mode is enabled\nin sql_mode. If it is not enabled, then a warning will be raised and the\ndefault generated value will be used instead. If it is enabled, then an error\nwill be raised instead.\n\n* The CREATE TABLE statement has limited support for generated columns.\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 generated columns.\n\n* The ALTER TABLE statement has limited support for generated columns.\nIt supports the MODIFY and CHANGE clauses for PERSISTENT generated columns.\nIt does not support the MODIFY clause for VIRTUAL generated columns if\nALGORITHM is not set to COPY. See MDEV-15476 for more information.\nIt does not support the CHANGE clause for VIRTUAL generated columns if\nALGORITHM is not set to COPY. See MDEV-17035 for more information.\nIt does not support altering a table if ALGORITHM is not set to COPY if the\ntable has a VIRTUAL generated column that is indexed. See MDEV-14046 for more\ninformation.\nIt does not support adding a VIRTUAL generated column with the ADD clause if\nthe same statement is also adding other columns if ALGORITHM is not set to\nCOPY. See MDEV-17468 for more information.\nIt also does not support altering an existing column into a VIRTUAL generated\ncolumn.\nIt supports using generated columns to partition tables.\nIt does not support using the versioning clauses with generated columns.\n\n* The SHOW CREATE TABLE statement supports generated columns.\n\n* The DESCRIBE statement can be used to check whether a table has generated\ncolumns.\nYou can tell which columns are generated by looking for the ones where the\nExtra column is set to either VIRTUAL or PERSISTENT. For example:\n\nDESCRIBE table1;\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\n* Generated columns can be properly referenced in the NEW and OLD rows in\ntriggers.\n\n* Stored procedures support generated columns.\n\n* The HANDLER statement supports generated columns.\n\nExpression Support\n------------------\n\n* Most legal, deterministic expressions which can be calculated are supported\nin expressions for generated columns.\n\n* Most built-in functions are supported in expressions for generated columns.\nHowever, some built-in functions can\'t be supported for technical reasons. For\nexample, If you try to use an unsupported function in an expression, an error\nis generated similar to the following:\n\nERROR 1901 (HY000): Function or expression \'dayname()\' cannot be used in the\nGENERATED ALWAYS AS clause of `v`\n\n* Subqueries are not supported in expressions for generated columns because\nthe underlying data can change.\n\n* Using anything that depends on data outside the row is not supported in\nexpressions for generated columns.\n\n* Stored functions are not supported in expressions for generated columns. See\nMDEV-17587 for more information.\n\nMariaDB starting with 10.2.1\n----------------------------\nIn MariaDB 10.2.1 and later, the following statements apply to expressions for\ngenerated columns:\n\n* Non-deterministic built-in functions are supported in expressions for not\nindexed VIRTUAL generated columns.\n\n* Non-deterministic built-in functions are not supported in expressions for\nPERSISTENT or indexed VIRTUAL generated columns.\n\n* User-defined functions (UDFs) are supported in expressions for generated\ncolumns.\nHowever, MariaDB can\'t check whether a UDF is deterministic, so it is up to\nthe user to be sure that they do not use non-deterministic UDFs with VIRTUAL\ngenerated columns.\n\n* Defining a generated column based on other generated columns defined before\nit in the table definition is supported. For example:\n\nCREATE TABLE t1 (a int as (1), b int as (a));\n\n* However, defining a generated column based on other generated columns\ndefined after in the table definition is not supported in expressions for\ngeneration columns because generated columns are calculated in the order they\nare defined.\n\n* Using an expression that exceeds 255 characters in length is supported in\nexpressions for generated columns. The new limit for the entire table\ndefinition, including all expressions for generated columns, is 65,535 bytes.\n\n* Using constant expressions is supported in expressions for generated\ncolumns. 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 to expressions\nfor generated columns:\n\n* Non-deterministic built-in functions are not supported in expressions for\ngenerated columns.\n\n* User-defined functions (UDFs) are not supported in expressions for generated\ncolumns.\n\n* Defining a generated column based on other generated columns defined in the\ntable is not supported. Otherwise, it would generate errors like this:\n\nERROR 1900 (HY000): A computed column cannot be based on a computed column\n\n* Using an expression that exceeds 255 characters in length is not supported\nin expressions for generated columns.\n\n* Using constant expressions is not supported in expressions for generated\ncolumns. Otherwise, it would generate errors like this:\n\nERROR 1908 (HY000): Constant expression in computed column function is not\nallowed\n\nMaking Stored Values Consistent\n-------------------------------\n\nWhen a generated column is PERSISTENT or indexed, the value of the expression\nneeds to be consistent regardless of the SQL Mode flags in the current\nsession. If it is not, then the table will be seen as corrupted when the value\nthat should actually be returned by the computed expression and the value that\nwas previously stored and/or indexed using a different sql_mode setting\ndisagree.\n\nThere are currently two affected classes of inconsistencies: character padding\nand unsigned subtraction:\n\n* For a VARCHAR or TEXT generated column the length of the value returned can\nvary depending on the PAD_CHAR_TO_FULL_LENGTH sql_mode flag. To make the\nvalue consistent, create the generated column using an RTRIM() or RPAD()\nfunction. Alternately, create the generated column as a CHAR column so that\nits data is always fully padded.\n\n* If a SIGNED generated column is based on the subtraction of an UNSIGNED\nvalue, the resulting value can vary depending on how large the value is and\nthe NO_UNSIGNED_SUBTRACTION sql_mode flag. To make the value consistent, use\nCAST() to ensure that each UNSIGNED operand is SIGNED before the subtraction.\n\nMariaDB starting with 10.5\n--------------------------\nBeginning in MariaDB 10.5, there is a fatal error generated when trying to\ncreate a generated column whose value can change depending on the SQL Mode\nwhen its data is PERSISTENT or indexed.\n\nFor an existing generated column that has a potentially inconsistent value, a\nwarning about a bad expression is generated the first time it is used (if\nwarnings are enabled).\n\nBeginning in MariaDB 10.4.8, MariaDB 10.3.18, and MariaDB 10.2.27 a\npotentially inconsistent generated column outputs a warning when created or\nfirst used (without restricting their creation).\n\nHere is an example of two tables that would be rejected in MariaDB 10.5 and\nwarned about in the other listed versions:\n\nCREATE TABLE bad_pad (\n txt CHAR(5),\n -- CHAR -> VARCHAR or CHAR -> TEXT can\'t be persistent or indexed:\n vtxt VARCHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE bad_sub (\n num1 BIGINT UNSIGNED,\n num2 BIGINT UNSIGNED,\n -- The resulting value can vary for some large values\n vnum BIGINT AS (num1 - num2) VIRTUAL,\n KEY(vnum)\n);\n\nThe warnings for the above tables look like this:\n\nWarning (Code 1901): Function or expression \'`txt`\' cannot be used in the\nGENERATED ALWAYS AS clause of `vtxt`\nWarning (Code 1105): Expression depends on the @@sql_mode value\nPAD_CHAR_TO_FULL_LENGTH\n\nWarning (Code 1901): Function or expression \'`num1` - `num2`\' cannot be used\nin the GENERATED ALWAYS AS clause of `vnum`\nWarning (Code 1105): Expression depends on the @@sql_mode value\nNO_UNSIGNED_SUBTRACTION\n\nTo work around the issue, force the padding or type to make the generated\ncolumn\'s expression return a consistent value. For example:\n\nCREATE TABLE good_pad (\n txt CHAR(5),\n -- Using RTRIM() or RPAD() makes the value consistent:\n vtxt VARCHAR(5) AS (RTRIM(txt)) PERSISTENT,\n -- When not persistent or indexed, it is OK for the value to vary by mode:\n vtxt2 VARCHAR(5) AS (txt) VIRTUAL,\n -- CHAR -> CHAR is always OK:\n txt2 CHAR(5) AS (txt) PERSISTENT\n);\n\nCREATE TABLE good_sub (\n num1 BIGINT UNSIGNED,\n num2 BIGINT UNSIGNED,\n -- The indexed value will always be consistent in this expression:\n vnum BIGINT AS (CAST(num1 AS SIGNED) - CAST(num2 AS SIGNED)) VIRTUAL,\n KEY(vnum)\n);\n\nMySQL Compatibility Support\n---------------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nIn MariaDB 10.2.1 and later, the following statements apply to MySQL','','https://mariadb.com/kb/en/generated-columns/');
+update help_topic set description = CONCAT(description, '\ncompatibility for generated columns:\n\n* The STORED keyword is supported as an alias for the PERSISTENT keyword.\n\n* Tables created with MySQL 5.7 or later that contain MySQL\'s generated\ncolumns can be imported into MariaDB without a dump and restore.\n\nMariaDB until 10.2.0\n--------------------\nIn MariaDB 10.2.0 and before, the following statements apply to MySQL\ncompatibility for generated columns:\n\n* The STORED keyword is not supported as an alias for the PERSISTENT keyword.\n\n* Tables created with MySQL 5.7 or later that contain MySQL\'s generated\ncolumns can not be imported into MariaDB without a dump and restore.\n\nImplementation Differences\n--------------------------\n\nGenerated columns are subject to various constraints in other DBMSs that are\nnot present in MariaDB\'s implementation. Generated columns may also be called\ncomputed columns or virtual columns in different implementations. The various\ndetails for a specific implementation can be found in the documentation for\neach specific DBMS.\n\nImplementation Differences Compared to Microsoft SQL Server\n-----------------------------------------------------------\n\nMariaDB\'s generated columns implementation does not enforce the following\nrestrictions that are present in Microsoft SQL Server\'s computed columns\nimplementation:\n\n* MariaDB allows server variables in generated column expressions, including\nthose that change dynamically, such as warning_count.\n* MariaDB allows the CONVERT_TZ() function to be called with a named time zone\nas an argument, even though time zone names and time offsets are configurable.\n* MariaDB allows the CAST() function to be used with non-unicode character\nsets, even though character sets are configurable and differ between\nbinaries/versions.\n* MariaDB allows FLOAT expressions to be used in generated columns. Microsoft\nSQL Server considers these expressions to be \"imprecise\" due to potential\ncross-platform differences in floating-point implementations and precision.\n* Microsoft SQL Server requires the ARITHABORT mode to be set, so that\ndivision by zero returns an error, and not a NULL.\n* Microsoft SQL Server requires QUOTED_IDENTIFIER to be set in sql_mode. In\nMariaDB, if data is inserted without ANSI_QUOTES set in sql_mode, then it will\nbe processed and stored differently in a generated column that contains quoted\nidentifiers.\n* In MariaDB 10.2.0 and before, it does not allow user-defined functions\n(UDFs) to be used in expressions for generated columns.\n\nMicrosoft SQL Server enforces the above restrictions by doing one of the\nfollowing things:\n\n* Refusing to create computed columns.\n* Refusing to allow updates to a table containing them.\n* Refusing to use an index over such a column if it can not be guaranteed that\nthe expression is fully deterministic.\n\nIn MariaDB, as long as the sql_mode, language, and other settings that were in\neffect during the CREATE TABLE remain unchanged, the generated column\nexpression will always be evaluated the same. If any of these things change,\nthen please be aware that the generated column expression might not be\nevaluated the same way as it previously was.\n\nIn MariaDB 5.2, you will get a warning if you try to update a virtual column.\nIn MariaDB 5.3 and later, this warning will be converted to an error if strict\nmode is enabled in sql_mode.\n\nDevelopment History\n-------------------\n\nGenerated columns was originally developed by Andrey Zhakov. It was then\nmodified by Sanja Byelkin and Igor Babaev at Monty Program for inclusion in\nMariaDB. Monty did the work on MariaDB 10.2 to lift a some of the old\nlimitations.\n\nExamples\n--------\n\nHere is an example table that uses both VIRTUAL and PERSISTENT 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 are virtual by\nlooking in the \"Extra\" column:\n\nDESCRIBE table1;\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 virtual column you can\nuse 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 column, you will\nreceive a warning and what you tried to insert will be ignored and the derived\nvalue inserted instead:\n\nWARNINGS;\nShow warnings enabled.\n\nINSERT INTO table1 VALUES (1, \'some text\',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 \'c\' in table\n\'table1\' has been ignored.\n\nINSERT INTO table1 VALUES (123, \'even more text\',default,\'something\');\nQuery OK, 1 row affected, 2 warnings (0.00 sec)\n\nWarning (Code 1645): The value specified for computed column \'d\' in table\n\'table1\' has been ignored.\nWarning (Code 1265): Data truncated for column \'d\' at row 1\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 directly after the\ntype definition, before the AS (<expression>):\n\nCREATE TABLE table2 (a INT, b INT ZEROFILL AS (a*2) VIRTUAL);\nINSERT INTO table2 (a) VALUES (1);\n\nSELECT * FROM table2;\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 man\'s partial index\".\nSee example at the end of Unique Index.\n\nURL: https://mariadb.com/kb/en/generated-columns/') WHERE help_topic_id = 718;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (719,38,'Invisible Columns','MariaDB starting with 10.3.3\n----------------------------\nInvisible columns (sometimes also called hidden columns) first appeared in\nMariaDB 10.3.3.\n\nColumns can be given an INVISIBLE attribute in a CREATE TABLE or ALTER TABLE\nstatement. These columns will then not be listed in the results of a SELECT *\nstatement, nor do they 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 tables or views\ncreated in this manner will have no trace of the invisible columns. If\nspecifically referenced in the SELECT statement, the columns will be brought\ninto the view/new table, but the INVISIBLE attribute will not.\n\nInvisible columns can be declared as NOT NULL, but then require a DEFAULT\nvalue.\n\nIt is not possible for all columns in a table to be invisible.\n\nExamples\n--------\n\nCREATE TABLE t (x INT INVISIBLE);\nERROR 1113 (42000): A table must have at least 1 column\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL);\nERROR 4106 (HY000): Invisible column `z` must have a default value\n\nCREATE TABLE t (x INT, y INT INVISIBLE, z INT INVISIBLE NOT NULL DEFAULT 4);\n\nINSERT INTO t VALUES (1),(2);\n\nINSERT INTO t (x,y) VALUES (3,33);\n\nSELECT * FROM t;\n+------+\n| x |\n+------+\n| 1 |\n| 2 |\n| 3 |\n+------+\n\nSELECT x,y,z FROM t;\n+------+------+---+\n| x | y | z |\n+------+------+---+\n| 1 | NULL | 4 |\n| 2 | NULL | 4 |\n| 3 | 33 | 4 |\n+------+------+---+\n\nDESC t;\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 INT NOT NULL\nDEFAULT 4;\n\nDESC t;\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| Field | Type | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| y | int(11) | YES | | NULL | |\n| z | int(11) | NO | | 4 | |\n+-------+---------+------+-----+---------+-------+\n\nCREATE VIEW v2 AS SELECT x,y,z FROM t;\n\nDESC v2;\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\nAdding a Surrogate Primary Key:\n\ncreate table t1 (x bigint unsigned not null, y varchar(16), z text);\n\ninsert into t1 values (123, \'qq11\', \'ipsum\');\n\ninsert into t1 values (123, \'qq22\', \'lorem\');\n\nalter table t1 add pkid serial primary key invisible first;\n\ninsert into t1 values (123, \'qq33\', \'amet\');\n\nselect * from t1;\n+-----+------+-------+\n| x | y | z |\n+-----+------+-------+\n| 123 | qq11 | ipsum |\n| 123 | qq22 | lorem |\n| 123 | qq33 | amet |\n+-----+------+-------+\n\nselect pkid, z from t1;\n+------+-------+\n| pkid | z |\n+------+-------+\n| 1 | ipsum |\n| 2 | lorem |\n| 3 | amet |\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 (720,38,'DROP DATABASE','Syntax\n------\n\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDescription\n-----------\n\nDROP DATABASE drops all tables in the database and deletes the database. Be\nvery careful with this statement! To use DROP DATABASE, you need the DROP\nprivilege on the database. DROP SCHEMA is a synonym for DROP DATABASE.\n\nImportant: When a database is dropped, user privileges on the database are not\nautomatically dropped. See GRANT.\n\nIF EXISTS\n---------\n\nUse IF EXISTS to prevent an error from occurring for databases that do not\nexist. A NOTE is generated for each non-existent database when using IF\nEXISTS. See SHOW WARNINGS.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL.\n\nDROP DATABASE is implemented as\n\nloop over all tables\n DROP TABLE table\n\nEach individual DROP TABLE is atomic while DROP DATABASE as a whole is\ncrash-safe.\n\nExamples\n--------\n\nDROP DATABASE bufg;\nQuery OK, 0 rows affected (0.39 sec)\n\nDROP DATABASE bufg;\nERROR 1008 (HY000): Can\'t drop database \'bufg\'; database doesn\'t exist\n\n\\W\nShow warnings enabled.\n\nDROP DATABASE IF EXISTS bufg;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\nNote (Code 1008): Can\'t drop database \'bufg\'; database doesn\'t exist\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 (721,38,'DROP EVENT','Syntax\n------\n\nDROP EVENT [IF EXISTS] event_name\n\nDescription\n-----------\n\nThis statement drops the event named event_name. The event immediately ceases\nbeing active, and is deleted completely from the server.\n\nIf the event does not exist, the error ERROR 1517 (HY000): Unknown event\n\'event_name\' results. You can override this and cause the statement to\ngenerate a NOTE for non-existent events instead by using IF EXISTS. See SHOW\nWARNINGS.\n\nThis statement requires the EVENT privilege. In MySQL 5.1.11 and earlier, an\nevent could be dropped only by its definer, or by a user having the SUPER\nprivilege.\n\nExamples\n--------\n\nDROP EVENT myevent3;\n\nUsing the IF EXISTS clause:\n\nDROP EVENT IF EXISTS myevent3;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n\nSHOW WARNINGS;\n+-------+------+-------------------------------+\n| Level | Code | Message |\n+-------+------+-------------------------------+\n| Note | 1305 | Event myevent3 does not exist |\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 (722,38,'DROP FUNCTION','Syntax\n------\n\nDROP FUNCTION [IF EXISTS] f_name\n\nDescription\n-----------\n\nThe DROP FUNCTION statement is used to drop a stored function or a\nuser-defined function (UDF). That is, the specified routine is removed from\nthe server, along with all privileges specific to the function. You must have\nthe ALTER ROUTINE privilege for the routine in order to drop it. If the\nautomatic_sp_privileges server system variable is set, both the ALTER ROUTINE\nand EXECUTE privileges are granted automatically to the routine creator - see\nStored Routine Privileges.\n\nIF EXISTS\n---------\n\nThe IF EXISTS clause is a MySQL/MariaDB extension. It prevents an error from\noccurring if the function does not exist. A NOTE is produced that can be\nviewed with SHOW WARNINGS.\n\nFor dropping a user-defined functions (UDF), see DROP FUNCTION UDF.\n\nExamples\n--------\n\nDROP FUNCTION hello;\nQuery OK, 0 rows affected (0.042 sec)\n\nDROP FUNCTION hello;\nERROR 1305 (42000): FUNCTION test.hello does not exist\n\nDROP FUNCTION IF EXISTS hello;\nQuery OK, 0 rows affected, 1 warning (0.000 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------+\n| Note | 1305 | FUNCTION test.hello does not exist |\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 (723,38,'DROP INDEX','Syntax\n------\n\nDROP INDEX [IF EXISTS] index_name ON tbl_name \n [WAIT n |NOWAIT]\n\nDescription\n-----------\n\nDROP INDEX drops the index named index_name from the table tbl_name. This\nstatement is mapped to an ALTER TABLE statement to drop the index.\n\nIf another connection is using the table, a metadata lock is active, and this\nstatement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nSee ALTER TABLE.\n\nAnother shortcut, CREATE INDEX, allows the creation of an index.\n\nTo remove the primary key, `PRIMARY` must be specified as index_name. Note\nthat the quotes are necessary, because PRIMARY is a keyword.\n\nPrivileges\n----------\n\nExecuting the DROP INDEX statement requires the INDEX privilege for the table\nor the database.\n\nOnline DDL\n----------\n\nOnline DDL is used by default with InnoDB, when the drop index operation\nsupports it.\n\nSee InnoDB Online DDL Overview for more information on online DDL with InnoDB.\n\nDROP INDEX IF EXISTS ...\n------------------------\n\nIf the IF EXISTS clause is used, then MariaDB will return a warning instead of\nan error if the index does not exist.\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nProgress Reporting\n------------------\n\nMariaDB provides progress reporting for DROP INDEX statement for clients that\nsupport the new progress reporting protocol. For example, if you were using\nthe mysql client, then the progress report might look like this::\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 (724,38,'DROP PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nDROP PACKAGE [IF EXISTS] [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE statement drops a stored package entirely:\n\n* Drops the package specification (earlier created using the CREATE PACKAGE\nstatement).\n* Drops the package implementation, if the implementation was already created\nusing the CREATE PACKAGE BODY statement.\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 (725,38,'DROP PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nDROP PACKAGE BODY [IF EXISTS] [ db_name . ] package_name\n\nDescription\n-----------\n\nThe DROP PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nThe DROP PACKAGE BODY statement drops the package body (i.e the\nimplementation), previously created using the CREATE PACKAGE BODY statement.\n\nNote, DROP PACKAGE BODY drops only the package implementation, but does not\ndrop the package specification. Use DROP PACKAGE to drop the package entirely\n(i.e. both implementation and specification).\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 (726,38,'DROP PROCEDURE','Syntax\n------\n\nDROP PROCEDURE [IF EXISTS] sp_name\n\nDescription\n-----------\n\nThis statement is used to drop a stored procedure. That is, the specified\nroutine is removed from the server along with all privileges specific to the\nprocedure. You must have the ALTER ROUTINE privilege for the routine. If the\nautomatic_sp_privileges server system variable is set, that privilege and\nEXECUTE are granted automatically to the routine creator - see Stored Routine\nPrivileges.\n\nThe IF EXISTS clause is a MySQL/MariaDB extension. It prevents an error from\noccurring if the procedure or function does not exist. A NOTE is produced that\ncan be viewed with SHOW WARNINGS.\n\nWhile this statement takes effect immediately, threads which are executing a\nprocedure can continue execution.\n\nExamples\n--------\n\nDROP PROCEDURE simpleproc;\n\nIF EXISTS:\n\nDROP PROCEDURE simpleproc;\nERROR 1305 (42000): PROCEDURE test.simpleproc does not exist\n\nDROP PROCEDURE IF EXISTS simpleproc;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------------------------+\n| Level | Code | Message |\n+-------+------+------------------------------------------+\n| Note | 1305 | PROCEDURE test.simpleproc does not exist |\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 (727,38,'DROP SERVER','Syntax\n------\n\nDROP SERVER [ IF EXISTS ] server_name\n\nDescription\n-----------\n\nDrops the server definition for the server named server_name. The\ncorresponding row within the mysql.servers table will be deleted. This\nstatement requires the SUPER privilege or, from MariaDB 10.5.2, the FEDERATED\nADMIN privilege.\n\nDropping a server for a table does not affect any FederatedX, FEDERATED,\nConnect or Spider tables that used this connection information when they were\ncreated.\n\nDROP SERVER is not written to the binary log, irrespective of the binary log\nformat being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,\nALTER SERVER and DROP SERVER statements.\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will not return an error if the\nserver does not exist. Unlike all other statements, DROP SERVER IF EXISTS does\nnot issue a note if the server does not exist. See MDEV-9400.\n\nExamples\n--------\n\nDROP SERVER s;\n\nIF EXISTS:\n\nDROP SERVER s;\nERROR 1477 (HY000): The foreign server name you are trying to reference \n does not exist. Data source error: s\n\nDROP SERVER IF EXISTS s;\nQuery OK, 0 rows affected (0.00 sec)\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 (728,38,'DROP TABLESPACE','The DROP TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\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 (729,38,'DROP TRIGGER','Syntax\n------\n\nDROP TRIGGER [IF EXISTS] [schema_name.]trigger_name\n\nDescription\n-----------\n\nThis statement drops a trigger. The schema (database) name is optional. If the\nschema is omitted, the trigger is dropped from the default schema. Its use\nrequires the TRIGGER privilege for the table associated with the trigger.\n\nUse IF EXISTS to prevent an error from occurring for a trigger that does not\nexist. A NOTE is generated for a non-existent trigger when using IF EXISTS.\nSee SHOW WARNINGS.\n\nNote: Triggers for a table are also dropped if you drop the table.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and DROP TRIGGER is atomic.\n\nExamples\n--------\n\nDROP TRIGGER test.example_trigger;\n\nUsing the IF EXISTS clause:\n\nDROP TRIGGER IF EXISTS test.example_trigger;\nQuery OK, 0 rows affected, 1 warning (0.01 sec)\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1360 | Trigger does not exist |\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 (730,38,'DROP VIEW','Syntax\n------\n\nDROP VIEW [IF EXISTS]\n view_name [, view_name] ...\n [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP VIEW removes one or more views. You must have the DROP privilege for each\nview. If any of the views named in the argument list do not exist, MariaDB\nreturns an error indicating by name which non-existing views it was unable to\ndrop, but it also drops all of the views in the list that do exist.\n\nThe IF EXISTS clause prevents an error from occurring for views that don\'t\nexist. When this clause is given, a NOTE is generated for each 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. This is useful to\ndelete views from multiple databases with one statement. See Identifier\nQualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For\ntemporary tables, no privilege is required, because such tables are only\nvisible for the current session.\n\nIf a view references another view, it will be possible to drop the referenced\nview. However, the other view will reference a view which does not exist any\nmore. Thus, querying it will produce an error similar to the following:\n\nERROR 1356 (HY000): View \'db_name.view_name\' references invalid table(s) or \ncolumn(s) or function(s) or definer/invoker of view lack rights 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 existing view,\nbecause CREATE VIEW has an OR REPLACE clause.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and DROP VIEW for a singular view is\natomic. Dropping multiple views is crash-safe.\n\nExamples\n--------\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\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 (731,38,'CONSTRAINT','MariaDB supports the implementation of constraints at the table-level using\neither CREATE TABLE or ALTER TABLE statements. A table constraint restricts\nthe data you can add to the table. If you attempt to insert invalid data on a\ncolumn, MariaDB throws an error.\n\nSyntax\n------\n\n[CONSTRAINT [symbol]] constraint_expression\n\nconstraint_expression:\n | PRIMARY KEY [index_type] (index_col_name, ...) [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-----------\n\nConstraints provide restrictions on the data you can add to a table. This\nallows you to enforce data integrity from MariaDB, rather than through\napplication logic. When a statement violates a constraint, MariaDB throws an\nerror.\n\nThere are four types of table constraints:\n\n+------------------------------------+---------------------------------------+\n| Constraint | Description |\n+------------------------------------+---------------------------------------+\n| PRIMARY KEY | Sets the column for referencing |\n| | rows. Values must be unique and not |\n| | null. |\n+------------------------------------+---------------------------------------+\n| FOREIGN KEY | Sets the column to reference the |\n| | primary key on another table. |\n+------------------------------------+---------------------------------------+\n| UNIQUE | Requires values in column or columns |\n| | only occur once in the table. |\n+------------------------------------+---------------------------------------+\n| CHECK | Checks whether the data meets the |\n| | given condition. |\n+------------------------------------+---------------------------------------+\n\nThe Information Schema TABLE_CONSTRAINTS Table contains information about\ntables that have constraints.\n\nFOREIGN KEY Constraints\n-----------------------\n\nInnoDB supports foreign key constraints. The syntax for a foreign 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\nThe Information Schema REFERENTIAL_CONSTRAINTS table has more information\nabout foreign keys.\n\nCHECK Constraints\n-----------------\n\nMariaDB starting with 10.2.1\n----------------------------\nFrom MariaDB 10.2.1, constraints are enforced. Before MariaDB 10.2.1\nconstraint expressions were accepted in the syntax but ignored.\n\nIn MariaDB 10.2.1 you can define constraints in 2 different ways:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraint expression returns false, then the\nrow will not be inserted or updated. One can use most deterministic functions\nin a constraint, including UDFs.\n\nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2), CONSTRAINT a_greater\nCHECK (a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get an automatically generated name. This is done so that\nyou can later delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the\ncheck_constraint_checks variable to OFF. This is useful for example when\nloading a table that violates some constraints that you want to later find and\nfix in SQL.\n\nReplication\n-----------\n\nIn row-based replication, only the master checks constraints, and failed\nstatements will not be replicated. In statement-based replication, the slaves\nwill also check constraints. Constraints should therefore be identical, as\nwell as deterministic, in a replication environment.\n\nAuto_increment\n--------------\n\nMariaDB starting with 10.2.6\n----------------------------\n* From MariaDB 10.2.6, auto_increment columns are no longer permitted in check\nconstraints. Previously they were permitted, but would not work correctly. See\nMDEV-11117.\n\nExamples\n--------\n\nCREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n\nMariaDB starting with 10.2.1\n----------------------------\nThe following examples will work from MariaDB 10.2.1 onwards.\n\nNumeric constraints and comparisons:\n\nCREATE TABLE t1 (a INT CHECK (a>2), b INT CHECK (b>2), CONSTRAINT a_greater\nCHECK (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 `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 (CHAR_LENGTH(name)>2), start_date\nDATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL OR\nstart_date<end_date));\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', \'2003-12-15\',\n\'2014-11-09\');\nQuery OK, 1 row affected (0.04 sec)\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Io\', \'2003-12-15\',\n\'2014-11-09\');\nERROR 4022 (23000): CONSTRAINT `name` failed for `test`.`t2`\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', NULL, \'2014-11-09\');\nQuery OK, 1 row affected (0.04 sec)\n\nINSERT INTO t2(name, start_date, end_date) VALUES(\'Ione\', \'2015-12-15\',\n\'2014-11-09\');\nERROR 4022 (23000): CONSTRAINT `end_date` failed for `test`.`t2`\n\nA misplaced parenthesis:\n\nCREATE TABLE t3 (name VARCHAR(30) CHECK (CHAR_LENGTH(name>2)), start_date\nDATE, \n end_date DATE CHECK (start_date IS NULL OR end_date IS NULL OR\nstart_date<end_date));\nQuery OK, 0 rows affected (0.32 sec)\n\nINSERT INTO t3(name, start_date, end_date) VALUES(\'Io\', \'2003-12-15\',\n\'2014-11-09\');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1292 | Truncated incorrect DOUBLE value: \'Io\' |\n+---------+------+----------------------------------------+\n\nCompare the definition of table t2 to table t3. CHAR_LENGTH(name)>2 is very\ndifferent to CHAR_LENGTH(name>2) as the latter mistakenly performs a numeric\ncomparison on the name field, leading to unexpected results.\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 (732,38,'Dynamic Columns','Dynamic columns allow one to store different sets of columns for each row in a\ntable. It works by storing a set of columns in a blob and having a small set\nof functions to manipulate it. Dynamic columns should be used when it is not\npossible to use regular columns. A typical use case is when one needs to store\nitems that may have many different attributes (like size, color, weight, etc),\nand the set of possible attributes is very large and/or unknown in advance. In\nthat case, attributes can be put into dynamic columns.\n\nDynamic Columns Basics\n----------------------\n\nThe table should have a blob column which will be used as storage for dynamic\ncolumns:\n\ncreate table assets (\n item_name varchar(32) primary key, -- A common attribute for all items\n dynamic_cols blob -- Dynamic columns will be stored here\n);\n\nOnce created, one can access dynamic columns via dynamic column functions:\n\nInsert a row with two dynamic columns: color=blue, size=XL\n\nINSERT INTO assets VALUES \n (\'MariaDB T-shirt\', COLUMN_CREATE(\'color\', \'blue\', \'size\', \'XL\'));\n\nInsert another row with dynamic columns: color=black, price=500\n\nINSERT INTO assets VALUES\n (\'Thinkpad Laptop\', COLUMN_CREATE(\'color\', \'black\', \'price\', 500));\n\nSelect dynamic column \'color\' for all items:\n\nSELECT item_name, COLUMN_GET(dynamic_cols, \'color\' as char) \n AS color FROM assets;\n+-----------------+-------+\n| item_name | color |\n+-----------------+-------+\n| MariaDB T-shirt | blue |\n| Thinkpad Laptop | black |\n+-----------------+-------+\n\nIt is possible to add and remove dynamic columns from a row:\n\n-- Remove a column:\nUPDATE assets SET dynamic_cols=COLUMN_DELETE(dynamic_cols, \"price\") \nWHERE COLUMN_GET(dynamic_cols, \'color\' as char)=\'black\';\n\n-- Add a column:\nUPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, \'warranty\', \'3 years\')\nWHERE item_name=\'Thinkpad Laptop\';\n\nYou can also list all columns, or get them together with their values in JSON\nformat:\n\nSELECT item_name, column_list(dynamic_cols) FROM assets;\n+-----------------+---------------------------+\n| item_name | column_list(dynamic_cols) |\n+-----------------+---------------------------+\n| MariaDB T-shirt | `size`,`color` |\n| Thinkpad Laptop | `color`,`warranty` |\n+-----------------+---------------------------+\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 years\"} |\n+-----------------+----------------------------------------+\n\nDynamic Columns Reference\n-------------------------\n\nThe rest of this page is a complete reference of dynamic columns in MariaDB\n\nDynamic Columns Functions\n-------------------------\n\nCOLUMN_CREATE\n-------------\n\nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value \n [as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name, value \n [as type]]...);\n\nReturn a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n* \nstoring in a table\nfurther modification with other dynamic columns functions\n\nThe as type part allows one to specify the value type. In most cases, this is\nredundant because MariaDB will be able to deduce the type of the value.\nExplicit type specification may be needed when the type of the value is not\napparent. For example, a literal \'2012-12-01\' has a CHAR type by default, one\nwill need to specify \'2012-12-01\' AS DATE to have it stored as a date. See the\nDatatypes section for further details. Note also MDEV-597.\n\nTypical usage:\n\n-- MariaDB 5.3+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column id*/, \"value\");\n-- MariaDB 10.0.1+:\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\n\nCOLUMN_ADD\n----------\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\nAdds or updates dynamic columns.\n\n* \ndyncol_blob must be either a valid dynamic columns blob (for example,\nCOLUMN_CREATE returns such blob), or an empty string.\ncolumn_name specifies the name of the column to be added. If dyncol_blob\nalready has a column with this name, it will be overwritten.\nvalue specifies the new value for the column. Passing a NULL value will cause\nthe column to be deleted.\nas type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nTypical usage:\n\n-- MariaDB 5.3+:\nUPDATE tbl SET dyncol_blob=COLUMN_ADD(dyncol_blob, 1 /*column id*/, \"value\") \n WHERE id=1;\n-- MariaDB 10.0.1+:\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, \"column_name\", \"value\") \n WHERE id=1;\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order\nto update the value in the table you have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\n\nCOLUMN_GET\n----------\n\nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n\nGet the value of a dynamic column by its name. If no column with the given\nname exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic\ncolumn they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype\nthey\'re retrieving? Can\'t the dynamic columns system figure the datatype from\nthe data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs\nto know the datatypes of all expressions before the query is run (for example,\nwhen one is using prepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the client about the\ndatatype of the column being read before the query is executed and the server\ncan see what datatype the column actually has).\n\nSee the Datatypes section for more information about datatypes.\n\nCOLUMN_DELETE\n-------------\n\nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n\nDelete a dynamic column with the specified name. Multiple names can be given.\n\nThe return value is a dynamic column blob after the modification.\n\nCOLUMN_EXISTS\n-------------\n\nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n\nCheck if a column with name column_name exists in dyncol_blob. If yes, return\n1, otherwise return 0.\n\nCOLUMN_LIST\n-----------\n\nCOLUMN_LIST(dyncol_blob);\n\nReturn a comma-separated list of column names. The names are quoted with\nbackticks.\n\nSELECT column_list(column_create(\'col1\',\'val1\',\'col2\',\'val2\'));\n+---------------------------------------------------------+\n| column_list(column_create(\'col1\',\'val1\',\'col2\',\'val2\')) |\n+---------------------------------------------------------+\n| `col1`,`col2` |\n+---------------------------------------------------------+\n\nCOLUMN_CHECK\n------------\n\nCOLUMN_CHECK(dyncol_blob);\n\nCheck if dyncol_blob is a valid packed dynamic columns blob. Return value of 1\nmeans the blob is valid, return value of 0 means it is not.\n\nRationale: Normally, one works with valid dynamic column blobs. Functions like\nCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column\nblobs. However, if a dynamic column blob is accidentally truncated, or\ntranscoded from one character set to another, it will be corrupted. This\nfunction can be used to check if a value in a blob field is a valid dynamic\ncolumn blob.\n\nNote: It is possible that a truncation cut a Dynamic Column \"clearly\" so that\nCOLUMN_CHECK will not notice the corruption, but in any case of truncation a\nwarning is issued during value storing.\n\nCOLUMN_JSON\n-----------\n\nCOLUMN_JSON(dyncol_blob);\n\nReturn a JSON representation of data in dyncol_blob.\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 years\"} |\n+-----------------+----------------------------------------+\n\nLimitation: COLUMN_JSON will decode nested dynamic columns at a nesting level\nof not more than 10 levels deep. Dynamic columns that are nested deeper than\n10 levels will be shown as BINARY string, without encoding.\n\nNesting Dynamic Columns\n-----------------------\n\nIt is possible to use nested dynamic columns by putting one dynamic column\nblob inside another. The COLUMN_JSON function will display nested columns.\n\nSET @tmp= column_create(\'parent_column\', \n column_create(\'child_column\', 12345));\nQuery OK, 0 rows affected (0.00 sec)\n\nSELECT column_json(@tmp);\n+------------------------------------------+\n| column_json(@tmp) |\n+------------------------------------------+\n| {\"parent_column\":{\"child_column\":12345}} |\n+------------------------------------------+\n\nSELECT column_get(column_get(@tmp, \'parent_column\' AS char), \n \'child_column\' AS int);\n+------------------------------------------------------------------------------\n\n| column_get(column_get(@tmp, \'parent_column\' as char), \'child_column\' as int)\n|\n+------------------------------------------------------------------------------\n\n| 12345\n|\n+------------------------------------------------------------------------------\n\nIf you are trying to get a nested dynamic column as a string use \'as BINARY\'\nas the last argument of COLUMN_GET (otherwise problems with character set\nconversion and illegal symbols are possible):\n\nselect column_json( column_get(\n column_create(\'test1\',\n column_create(\'key1\',\'value1\',\'key2\',\'value2\',\'key3\',\'value3\')),\n \'test1\' as BINARY));\n\nDatatypes\n---------\n\nIn SQL, one needs to define the type of each column in a table. Dynamic\ncolumns do not provide any way to declare a type in advance (\"whenever there\nis a column \'weight\', it should be integer\" is not possible). However, each\nparticular dynamic column value is stored together with its datatype.\n\nThe set of possible datatypes is mostly the same as that used by the SQL CAST\nand CONVERT functions. However, note that there are currently some differences\n- see MDEV-597.\n\n+--------+----------------------------------------------+-------------------+\n| type | dynamic column internal type | description |\n+--------+----------------------------------------------+-------------------+\n| BINARY | DYN_COL_STRING | (variable length |\n| (N)] | | string with |\n| | | binary charset) |\n+--------+----------------------------------------------+-------------------+\n| CHAR[( | DYN_COL_STRING | (variable length |\n| )] | | string with |\n| | | charset) |\n+--------+----------------------------------------------+-------------------+\n| DATE | DYN_COL_DATE | (date - 3 bytes) |\n+--------+----------------------------------------------+-------------------+\n| DATETI | DYN_COL_DATETIME | (date and time |\n| E[(D)] | | (with |\n| | | microseconds) - |\n| | | 9 bytes) |\n+--------+----------------------------------------------+-------------------+\n| DECIMA | DYN_COL_DECIMAL | (variable length |\n| [(M[,D | | binary decimal |\n| )] | | representation |\n| | | with MariaDB |\n| | | limitation) |\n+--------+----------------------------------------------+-------------------+\n| DOUBLE | DYN_COL_DOUBLE | (64 bit |\n| (M,D)] | | double-precision |\n| | | floating point) |\n+--------+----------------------------------------------+-------------------+\n| INTEGE | DYN_COL_INT | (variable |\n| | | length, up to 64 |\n| | | bit signed |\n| | | integer) |\n+--------+----------------------------------------------+-------------------+\n| SIGNED | DYN_COL_INT | (variable |\n| [INTEG | | length, up to 64 |\n| R] | | bit signed |\n| | | integer) |\n+--------+----------------------------------------------+-------------------+\n| TIME[( | DYN_COL_TIME | (time (with |\n| )] | | microseconds, |\n| | | may be negative) |\n| | | - 6 bytes) |\n+--------+----------------------------------------------+-------------------+\n| UNSIGN | DYN_COL_UINT | (variable |\n| D | | length, up to |','','https://mariadb.com/kb/en/dynamic-columns/');
+update help_topic set description = CONCAT(description, '\n| [INTEG | | 64bit unsigned |\n| R] | | integer) |\n+--------+----------------------------------------------+-------------------+\n\nA Note About Lengths\n--------------------\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#, not as CHAR(n)),\nMariaDB will report the maximum length of the resultset column to be\n53,6870,911 (bytes or characters?) for MariaDB 5.3-10.0.0 and 16,777,216 for\nMariaDB 10.0.1+. This may cause excessive memory usage in some client\nlibraries, because they try to pre-allocate a buffer of maximum resultset\nwidth. If you suspect you\'re hitting this problem, use CHAR(n) whenever you\'re\nusing COLUMN_GET in the select list.\n\nMariaDB 5.3 vs MariaDB 10.0\n---------------------------\n\nThe dynamic columns feature was introduced into MariaDB in two steps:\n\n* MariaDB 5.3 was the first version to support dynamic columns. Only numbers\n could be used as column names in this version.\n* In MariaDB 10.0.1, column names can be either numbers or strings.\n Also, the COLUMN_JSON and COLUMN_CHECK functions were added.\n\nSee also Dynamic Columns in MariaDB 10.\n\nClient-side API\n---------------\n\nIt is also possible to create or parse dynamic columns blobs on the client\nside. libmysql client library now includes an API for writing/reading dynamic\ncolumn blobs. See dynamic-columns-api for details.\n\nLimitations\n-----------\n\n+---------------------------------------------------+------------------------+\n| Description | Limit |\n+---------------------------------------------------+------------------------+\n| Max number of columns | 65535 |\n+---------------------------------------------------+------------------------+\n| Max total length of packed dynamic column | max_allowed_packet |\n| | (1G) |\n+---------------------------------------------------+------------------------+\n\nURL: https://mariadb.com/kb/en/dynamic-columns/') WHERE help_topic_id = 732;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (733,38,'Dynamic Columns from MariaDB 10','MariaDB starting with 10.0.1\n----------------------------\nMariaDB 10.0.1 introduced the following improvements to the dynamic columns\nfeature.\n\nColumn Name Support\n-------------------\n\nIt is possible to refer to column by names. Names can be used everywhere where\nin MariaDB 5.3 one could use only strings:\n\n* Create a dynamic column blob:\n\nCOLUMN_CREATE(\'int_col\', 123 as int, \'double_col\', 3.14 as double,\n\'string_col\', \'text-data\' as char);\n\n* Set a column value:\n\nCOLUMN_ADD(dyncol_blob, \'intcol\', 1234);\n\n* Get a column value:\n\nCOLUMN_GET(dynstr, \'column1\' as char(10));\n\n* Check whether a column exists\n\nCOLUMN_EXISTS(dyncol_blob, \'column_name\');\n\nChanges in Behavior\n-------------------\n\n* Column list output now includes quoting:\n\nselect column_list(column_create(1, 22, 2, 23));\n+------------------------------------------+\n| column_list(column_create(1, 22, 2, 23)) |\n+------------------------------------------+\n| `1`,`2` |\n+------------------------------------------+\nselect column_list(column_create(\'column1\', 22, \'column2\', 23)); \n+----------------------------------------------------------+\n| column_list(column_create(\'column1\', 22, \'column2\', 23)) |\n+----------------------------------------------------------+\n| `column1`,`column2` |\n+----------------------------------------------------------+\n\n* Column name interpretation has been changed so that the string now is not\nconverted to a number. So some \"magic\" tricks will not work any more, for\nexample, \"1test\" and \"1\" now become different column names:\n\nselect column_list(column_add(column_create(\'1a\', 22), \'1b\', 23));\n+------------------------------------------------------------+\n| column_list(column_add(column_create(\'1a\', 22), \'1b\', 23)) |\n+------------------------------------------------------------+\n| `1a`,`1b` |\n+------------------------------------------------------------+\n\n* Old behavior:\n\nselect column_list(column_add(column_create(\'1a\', 22), \'1b\', 23));\n+------------------------------------------------------------+\n| column_list(column_add(column_create(\'1a\', 22), \'1b\', 23)) |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n\nNew Functions\n-------------\n\nThe following new functions have been added to dynamic columns in MariaDB 10\n\nCOLUMN_CHECK\n------------\n\nCOLUMN_CHECK is used to check a column\'s integrity. When it encounters an\nerror it does not return illegal format errors but returns false instead. It\nalso checks integrity more thoroughly and finds errors in the dynamic column\ninternal structures which might not be found by other functions.\n\nselect column_check(column_create(\'column1\', 22));\n+--------------------------------------------+\n| column_check(column_create(\'column1\', 22)) |\n+--------------------------------------------+\n| 1 |\n+--------------------------------------------+\nselect column_check(\'abracadabra\');\n+-----------------------------+\n| column_check(\'abracadabra\') |\n+-----------------------------+\n| 0 |\n+-----------------------------+\n\nCOLUMN_JSON\n-----------\n\nCOLUMN_JSON converts all dynamic column record content to a JSON object.\n\nselect column_json(column_create(\'column1\', 1, \'column2\', \"two\"));\n+------------------------------------------------------------+\n| column_json(column_create(\'column1\', 1, \'column2\', \"two\")) |\n+------------------------------------------------------------+\n| {\"column1\":1,\"column2\":\"two\"} |\n+------------------------------------------------------------+\n\nOther Changes\n-------------\n\n* All API functions has prefix mariadb_dyncol_ (old prefix dynamic_column_ is\ndepricated\n* API changed to be able to work with the new format (*_named functions).\n* Removed \'delete\' function because deleting could be done by adding NULL\nvalue.\n* \'Time\' and \'datetime\' in the new format are stored without microseconds if\nthey are 0.\n* New function added to API (except that two which are representing SQL level\nfunctions):\n\'Unpack\' the dynamic columns content to an arrays of values and names.\n3 functions to get any column value as string, integer (long long) or floating\npoint (double).\n\n* New type of \"dynamic column\" row added on the API level (in SQL level output\nit is a string but if you use dynamic column functions to construct object it\nwill be added as dynamic column value) which allow to add dynamic columns\ninside dynamic columns. JSON function represent such recursive constructions\ncorrectly but limit depth of representation as current implementation limit\n(internally depth of dynamic columns embedding is not limited).\n\nInterface with Cassandra\n------------------------\n\nCassandraSE is no longer actively being developed and has been removed in\nMariaDB 10.6. See MDEV-23024.\n\nSome internal changes were added to dynamic columns to allow them to serve as\nan interface to Apache Cassandra dynamic columns. The Cassandra engine may\npack all columns which were not mentioned in the MariaDB interface table\ndefinition and even bring changes in the dynamic column contents back to the\ncassandra columns family (the table analog in cassandra).\n\nURL: https://mariadb.com/kb/en/dynamic-columns-from-mariadb-10/','','https://mariadb.com/kb/en/dynamic-columns-from-mariadb-10/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (734,38,'MERGE','Description\n-----------\n\nThe MERGE storage engine, also known as the MRG_MyISAM engine, is a collection\nof identical MyISAM tables that can be used as one. \"Identical\" means that all\ntables have identical column and index information. You cannot merge MyISAM\ntables in which the columns are listed in a different order, do not have\nexactly the same columns, or have the indexes in different order. However, any\nor all of the MyISAM tables can be compressed with myisampack. Columns names\nand indexes names can be different, as long as data types and NULL/NOT NULL\nclauses are the same. Differences in table options such as AVG_ROW_LENGTH,\nMAX_ROWS, or PACK_KEYS do not matter.\n\nEach index in a MERGE table must match an index in underlying MyISAM tables,\nbut the opposite is not true. Also, a MERGE table cannot have a PRIMARY KEY or\nUNIQUE indexes, because it cannot enforce uniqueness over all underlying\ntables.\n\nThe following options are meaningful for MERGE tables:\n\n* UNION. This option specifies the list of the underlying MyISAM tables. The\nlist is enclosed between parentheses and separated with commas.\n* INSERT_METHOD. This options specifies whether, and how, INSERTs are allowed\nfor the table. Allowed values are: NO (INSERTs are not allowed), FIRST (new\nrows will be written into the first table specified in the UNION list), LAST\n(new rows will be written into the last table specified in the UNION list).\nThe default value is NO.\n\nIf you define a MERGE table with a definition which is different from the\nunderlying MyISAM tables, or one of the underlying tables is not MyISAM, the\nCREATE TABLE statement will not return any error. But any statement which\ninvolves the table will produce an error like the following:\n\nERROR 1168 (HY000): Unable to open underlying table which is differently\ndefined \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, but an underlying\ntable\'s definition changes at some point in time.\n\nIf you try to insert a new row into a MERGE table with INSERT_METHOD=NO, you\nwill 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 have one or more\nvirtual columns. MERGE itself does not support virtual columns, thus such\ncolumns will be seen as regular columns. The data types and sizes will still\nneed to be identical, and they cannot be NOT NULL.\n\nExamples\n--------\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 (\'Testing\'),(\'table\'),(\'t1\');\n\nINSERT INTO t2 (message) VALUES (\'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| 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, and then a MERGE\ntable on them. However, one of them uses a different data type for the column\nb, so a SELECT will produce 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;\nERROR 1168 (HY000): Unable to open underlying table which is differently\ndefined\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\\G\n*************************** 1. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: Error\nMsg_text: Table \'test.t3\' is differently defined or of non-MyISAM type or\ndoesn\'t exist\n*************************** 2. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: Error\nMsg_text: Unable to open underlying table which is differently defined or of\nnon-MyISAM type or doesn\'t exist\n*************************** 3. row ***************************\n Table: test.t_mrg\n Op: check\nMsg_type: error\nMsg_text: Corrupt\n\nNow, we know that the problem is in t3\'s definition.\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 (735,39,'Sequence Overview','MariaDB starting with 10.3\n--------------------------\nSequences were introduced in MariaDB 10.3.\n\nIntroduction\n------------\n\nA sequence is an object that generates a sequence of numeric values, as\nspecified by the CREATE SEQUENCE statement.\n\nCREATE SEQUENCE will create a sequence that generates new values when called\nwith NEXT VALUE FOR sequence_name. It\'s an alternative to AUTO INCREMENT when\none wants to have more control of how the numbers are generated. As the\nSEQUENCE caches values (up to the CACHE value in the CREATE SEQUENCE\nstatement, by default 1000) it can in some cases be much faster than AUTO\nINCREMENT. Another benefit is that one can access the last value generated by\nall used sequences, which solves one of the limitations with LAST_INSERT_ID().\n\nCreating a Sequence\n-------------------\n\nThe CREATE SEQUENCE statement is used to create a sequence. Here is an example\nof a sequence starting at 100, incrementing by 10 each time:\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nThe CREATE SEQUENCE statement, along with defaults, can be viewd with the SHOW\nCREATE SEQUENCE STATEMENT, for example:\n\nSHOW CREATE SEQUENCE s\\G\n*************************** 1. row ***************************\n Table: s\nCreate Table: CREATE SEQUENCE `s` start with 100 minvalue 1 maxvalue\n9223372036854775806 \n increment by 10 cache 1000 nocycle ENGINE=InnoDB\n\nUsing Sequence Objects\n----------------------\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 from 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--------------------------\n\nMariaDB starting with 10.3.3\n----------------------------\nStarting from 10.3.3 you can use Sequences in DEFAULT:\n\ncreate sequence s1;\ncreate table t1 (a int primary key default (next value for s1), b int);\ninsert into t1 (b) values (1),(2);\nselect * from t1;\n+---+------+\n| a | b |\n+---+------+\n| 1 | 1 |\n| 2 | 2 |\n+---+------+\n\nChanging a Sequence\n-------------------\n\nThe ALTER SEQUENCE statement is used for changing sequences. For example, to\nrestart 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 to be returned for\na 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. Attempting to set a\nlower value will fail, returning NULL:\n\nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n\nDropping a Sequence\n-------------------\n\nThe DROP SEQUENCE statement is used to drop a sequence, for example:\n\nDROP SEQUENCE s;\n\nReplication\n-----------\n\nIf one wants to use Sequences in a master-master setup or with Galera one\nshould use INCREMENT=0. This will tell the Sequence to use\nauto_increment_increment and auto_increment_offset to generate unique values\nfor each server.\n\nStandards Compliance\n--------------------\n\nMariaDB 10.3 supports both ANSI SQL and Oracle syntax for sequences.\n\nHowever as SEQUENCE is implemented as a special kind of table, it uses the\nsame namespace as tables. The benefits are that sequences show up in SHOW\nTABLES, and one can also create a sequence with CREATE TABLE and drop it with\nDROP TABLE. One can SELECT from it as from any other table. This ensures that\nall old tools that work with tables should work with sequences.\n\nSince sequence objects act as regular tables in many contexts, they will be\naffected by LOCK TABLES. This is not the case in other DBMS, such as Oracle,\nwhere LOCK TABLE does not affect sequences.\n\nNotes\n-----\n\nOne of the goals with the Sequence implementation is that all old tools, such\nas mysqldump, should work unchanged, while still keeping the normal usage of\nsequence standard compatibly.\n\nTo make this possible, sequence is currently implemented as a table with a few\nexclusive properties.\n\nThe special properties for sequence tables are:\n\n* A sequence table has always one row.\n* When one creates a sequence, either with CREATE TABLE or CREATE SEQUENCE,\none row will be inserted.\n* If one tries to insert into a sequence table, the single row will be\nupdated. This allows mysqldump to work but also gives the additional benefit\nthat one can change all properties of a sequence with a single insert. New\napplications should of course also use ALTER SEQUENCE.\n* UPDATE or DELETE can\'t be performed on Sequence objects.\n* Doing a select on the sequence shows the current state of the sequence,\nexcept the values that are reserved in the cache. The next_value column shows\nthe next value not reserved by the cache.\n* FLUSH TABLES will close the sequence and the next sequence number generated\nwill be according to what\'s stored in the Sequence object. In effect, this\nwill discard the cached values.\n* A number of normal table operations work on Sequence tables. See next\nsection.\n\nTable Operations that Work with Sequences\n-----------------------------------------\n\n* SHOW CREATE TABLE sequence_name. This shows the table structure that is\nbehind the SEQUENCE including the field names that can be used with SELECT or\neven CREATE TABLE.\n* CREATE TABLE sequence-structure ... SEQUENCE=1\n* ALTER TABLE sequence RENAME TO sequence2\n* RENAME TABLE sequence_name TO new_sequence_name\n* DROP TABLE sequence_name. This is allowed mainly to get old tools like\nmysqldump to work with sequence tables.\n* SHOW TABLES\n\nImplementation\n--------------\n\nInternally, sequence tables are created as a normal table without rollback\n(the InnoDB, Aria and MySAM engines support this), wrapped by a sequence\nengine object. This allowed us to create sequences with almost no performance\nimpact for normal tables. (The cost is one \'if\' per insert if the binary log\nis enabled).\n\nUnderlying Table Structure\n--------------------------\n\nThe following example shows the table structure of sequences and how it can be\nused as a table. (Output of results are slightly edited to make them easier to\nread)\n\ncreate sequence t1;\nshow create sequence t1\\G\n*************************** 1. row ***************************\n CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806\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 when sequences is\ncreated or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, 1 if the sequence should begin a new cycle when maximum_value is\npassed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have 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\n\nThe cycle_count column is incremented every time the sequence wraps around.\n\nCredits\n-------\n\n* Thanks to Jianwe Zhao from Aliyun for his work on SEQUENCE in AliSQL, which\ngave ideas and inspiration for this work.\n* Thanks to Peter Gulutzan,who helped test and gave useful comments about the\nimplementation.\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 (736,39,'CREATE SEQUENCE','MariaDB starting with 10.3\n--------------------------\nCREATE SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] SEQUENCE [IF NOT EXISTS] sequence_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]\nThe options for CREATE SEQUENCE can be given in any order, optionally followed\nby table_options.\n\ntable_options can be any of the normal table options in CREATE TABLE but the\nmost usable ones are ENGINE=... and COMMENT=.\n\nNOMAXVALUE and NOMINVALUE are there to allow one to create SEQUENCEs using the\nOracle syntax.\n\nDescription\n-----------\n\nCREATE SEQUENCE will create a sequence that generates new values when called\nwith NEXT VALUE FOR sequence_name. It\'s an alternative to AUTO INCREMENT when\none wants to have more control of how the numbers are generated. As the\nSEQUENCE caches values (up to CACHE) it can in some cases be much faster than\nAUTO INCREMENT. Another benefit is that one can access the last value\ngenerated by all used sequences, which solves one of the limitations with\nLAST_INSERT_ID().\n\nCREATE SEQUENCE requires the CREATE privilege.\n\nDROP SEQUENCE can be used to drop a sequence, and ALTER SEQUENCE to change it.\n\nArguments to Create\n-------------------\n\nThe following options may be used:\n\n+---------------+------------------------------+----------------------------+\n| Option | Default value | Description |\n+---------------+------------------------------+----------------------------+\n| INCREMENT | 1 | Increment to use for |\n| | | values. May be negative. |\n| | | Setting an increment of 0 |\n| | | causes the sequence to |\n| | | use the value of the |\n| | | auto_increment_increment |\n| | | system variable at the |\n| | | time of creation, which |\n| | | is always a positive |\n| | | number. (see MDEV-16035). |\n+---------------+------------------------------+----------------------------+\n| MINVALUE | 1 if INCREMENT > 0 and | Minimum value for the |\n| | -9223372036854775807 if | sequence |\n| | INCREMENT < 0 | |\n+---------------+------------------------------+----------------------------+\n| MAXVALUE | 9223372036854775806 if | Max value for sequence |\n| | INCREMENT > 0 and -1 if | |\n| | INCREMENT < 0 | |\n+---------------+------------------------------+----------------------------+\n| START | MINVALUE if INCREMENT > 0 | First value that the |\n| | and MAX_VALUE if INCREMENT< | sequence will generate |\n| | 0 | |\n+---------------+------------------------------+----------------------------+\n| CACHE | 1000 | Number of values that |\n| | | should be cached. 0 if no |\n| | | CACHE. The underlying |\n| | | table will be updated |\n| | | first time a new sequence |\n| | | number is generated and |\n| | | each time the cache runs |\n| | | out. |\n+---------------+------------------------------+----------------------------+\n\nIf CYCLE is used then the sequence should start again from MINVALUE after it\nhas run out of values. Default value is NOCYCLE.\n\nConstraints on Create Arguments\n-------------------------------\n\nTo be able to create a legal sequence, the following must hold:\n\n* MAXVALUE >= start\n* MAXVALUE > MINVALUE\n* START >= MINVALUE\n* MAXVALUE <= 9223372036854775806 (LONGLONG_MAX-1)\n* MINVALUE >= -9223372036854775807 (LONGLONG_MIN+1)\n\nNote that sequences can\'t generate the maximum/minimum 64 bit number because\nof the constraint of MINVALUE and MAXVALUE.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL and CREATE SEQUENCE is atomic.\n\nExamples\n--------\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 with the defaults\n\nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10;\nERROR 4082 (HY000): Sequence \'test.s3\' values are conflicting\n\nThe sequence can be created by specifying workable minimum and maximum values:\n\nCREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10 MINVALUE=-100 MAXVALUE=1000;\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 (737,39,'ALTER SEQUENCE','MariaDB starting with 10.3.1\n----------------------------\nALTER SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\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 ] CYCLE ]\n[ RESTART [[WITH | =] restart]\n\nALTER SEQUENCE allows one to change any values for a SEQUENCE created with\nCREATE SEQUENCE.\n\nThe options for ALTER SEQUENCE can be given in any order.\n\nDescription\n-----------\n\nALTER SEQUENCE changes the parameters of an existing sequence generator. Any\nparameters not specifically set in the ALTER SEQUENCE command retain their\nprior settings.\n\nALTER SEQUENCE requires the ALTER privilege.\n\nArguments to ALTER SEQUENCE\n---------------------------\n\nThe following options may be used:\n\n+---------------+-------------------------------+---------------------------+\n| Option | Default value | Description |\n+---------------+-------------------------------+---------------------------+\n| INCREMENT | 1 | Increment to use for |\n| | | values. May be negative. |\n+---------------+-------------------------------+---------------------------+\n| MINVALUE | 1 if INCREMENT > 0 and | Minimum value for the |\n| | -9223372036854775807 if | sequence. |\n| | INCREMENT < 0 | |\n+---------------+-------------------------------+---------------------------+\n| MAXVALUE | 9223372036854775806 if | Max value for sequence. |\n| | INCREMENT > 0 and -1 if | |\n| | INCREMENT < 0 | |\n+---------------+-------------------------------+---------------------------+\n| START | MINVALUE if INCREMENT > 0 | First value that the |\n| | and MAX_VALUE if INCREMENT< 0 | sequence will generate. |\n+---------------+-------------------------------+---------------------------+\n| CACHE | 1000 | Number of values that |\n| | | should be cached. 0 if |\n| | | no CACHE. The |\n| | | underlying table will be |\n| | | updated first time a new |\n| | | sequence number is |\n| | | generated and each time |\n| | | the cache runs out. |\n+---------------+-------------------------------+---------------------------+\n| CYCLE | 0 (= NO CYCLE) | 1 if the sequence should |\n| | | start again from |\n| | | MINVALUE# after it has |\n| | | run out of values. |\n+---------------+-------------------------------+---------------------------+\n| RESTART | START if restart value not | If RESTART option is |\n| | is given | used, NEXT VALUE will |\n| | | return the restart value. |\n+---------------+-------------------------------+---------------------------+\n\nThe optional clause RESTART [ WITH restart ] sets the next value for the\nsequence. This is equivalent to calling the SETVAL() function with the is_used\nargument as 0. The specified value will be returned by the next call of\nnextval. Using RESTART with no restart value is equivalent to supplying the\nstart value that was recorded by CREATE SEQUENCE or last set by ALTER SEQUENCE\nSTART WITH.\n\nALTER SEQUENCE will not allow you to change the sequence so that it\'s\ninconsistent. For example:\n\nCREATE SEQUENCE s1;\nALTER SEQUENCE s1 MINVALUE 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 RESTART 10;\nERROR 4061 (HY000): Sequence \'test.t1\' values are conflicting\n\nALTER SEQUENCE s1 MINVALUE 10 START 10 RESTART 10;\n\nINSERT\n------\n\nTo allow SEQUENCE objects to be backed up by old tools, like mysqldump, one\ncan use SELECT to read the current state of a SEQUENCE object and use an\nINSERT to update the SEQUENCE object. INSERT is only allowed if all fields are\nspecified:\n\nCREATE SEQUENCE s1;\nINSERT INTO s1 VALUES(1000,10,2000,1005,1,1000,0,0);\nSELECT * FROM s1;\n\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n| next_value | min_value | max_value | start | increment | cache | cycle |\nround |\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n| 1000 | 10 | 2000 | 1005 | 1 | 1000 | 0 | \n0 |\n+------------+-----------+-----------+-------+-----------+-------+-------+-----\n-+\n\nSHOW CREATE SEQUENCE s1;\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n| Table | Create Table \n |\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n| s1 | CREATE SEQUENCE `s1` start with 1005 minvalue 10 maxvalue 2000\nincrement by 1 cache 1000 nocycle ENGINE=Aria |\n+-------+----------------------------------------------------------------------\n---------------------------------------+\n\nNotes\n-----\n\nALTER SEQUENCE will instantly affect all future SEQUENCE operations. This is\nin contrast to some other databases where the changes requested by ALTER\nSEQUENCE will not be seen until the sequence cache has run out.\n\nALTER SEQUENCE will take a full table lock of the sequence object during its\n(brief) operation. This ensures that ALTER SEQUENCE is replicated correctly.\nIf you only want to set the next sequence value to a higher value than\ncurrent, then you should use SETVAL() instead, as this is not blocking.\n\nIf you want to change storage engine, sequence comment or rename the sequence,\nyou can use ALTER TABLE for this.\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 (738,39,'DROP SEQUENCE','MariaDB starting with 10.3\n--------------------------\nDROP SEQUENCE was introduced in MariaDB 10.3.\n\nSyntax\n------\n\nDROP [TEMPORARY] SEQUENCE [IF EXISTS] [/*COMMENT TO SAVE*/]\n sequence_name [, sequence_name] ...\n\nDescription\n-----------\n\nDROP SEQUENCE removes one or more sequences created with CREATE SEQUENCE. You\nmust have the DROP privilege for each sequence. MariaDB returns an error\nindicating by name which non-existing tables it was unable to drop, but it\nalso drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not\nautomatically dropped. See GRANT.\n\nIf another connection is using the sequence, a metadata lock is active, and\nthis statement will wait until the lock is released. This is also true for\nnon-transactional tables.\n\nFor each referenced sequence, DROP SEQUENCE drops a temporary sequence with\nthat name, if it exists. If it does not exist, and the TEMPORARY keyword is\nnot used, it drops a non-temporary sequence with the same name, if it exists.\nThe TEMPORARY keyword ensures that a non-temporary sequence will not\naccidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for sequences that do not\nexist. A NOTE is generated for each non-existent sequence when using IF\nEXISTS. See SHOW WARNINGS.\n\nDROP SEQUENCE requires the DROP privilege.\n\nNotes\n-----\n\nDROP SEQUENCE only removes sequences, not tables. However, DROP TABLE can\nremove both sequences and tables.\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 (739,39,'NEXT VALUE for sequence_name','MariaDB starting with 10.3\n--------------------------\nSEQUENCEs were introduced in MariaDB 10.3\n\nSyntax\n------\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 PostgreSQL syntax.\n\nDescription\n-----------\n\nGenerate next value for a SEQUENCE.\n\n* You can greatly speed up NEXT VALUE by creating the sequence with the CACHE\noption. If not, every NEXT VALUE usage will cause changes in the stored\nSEQUENCE table.\n* When using NEXT VALUE the value will be reserved at once and will not be\nreused, except if the SEQUENCE was created with CYCLE. This means that when\nyou are using SEQUENCEs you have to expect gaps in the generated sequence\nnumbers.\n* If one updates the SEQUENCE with SETVAL() or ALTER SEQUENCE ... RESTART,\nNEXT VALUE FOR will notice this and start from the next requested value.\n* FLUSH TABLES will close the sequence and the next sequence number generated\nwill be according to what\'s stored in the SEQUENCE object. In effect, this\nwill discard the cached values.\n* A server restart (or closing the current connection) also causes a drop of\nall cached values. The cached sequence numbers are reserved only for the\ncurrent connection.\n* NEXT VALUE requires the INSERT privilege.\n\nMariaDB starting with 10.3.3\n----------------------------\n* You can also use NEXT VALUE FOR sequence for column DEFAULT.\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 (740,39,'PREVIOUS VALUE FOR sequence_name','MariaDB starting with 10.3\n--------------------------\nSEQUENCEs were introduced in MariaDB 10.3.\n\nSyntax\n------\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 PostgreSQL syntax.\n\nDescription\n-----------\n\nGet last value in the current connection generated from a sequence.\n\n* If the sequence has not yet been used by the connection, PREVIOUS VALUE FOR\nreturns NULL (the same thing applies with a new connection which doesn\'t see a\nlast value for an existing sequence).\n* If a SEQUENCE has been dropped and re-created then it\'s treated as a new\nSEQUENCE and PREVIOUS VALUE FOR will return NULL.\n* FLUSH TABLES has no effect on PREVIOUS VALUE FOR.\n* Previous values for all used sequences are stored per connection until\nconnection ends.\n* PREVIOUS VALUE FOR requires the SELECT privilege.\n\nExample\n-------\n\nCREATE SEQUENCE s START WITH 100 INCREMENT BY 10;\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| NULL |\n+----------------------+\n\n# The function works for sequences only, if the table is used an error is\ngenerated\nSELECT PREVIOUS VALUE FOR t;\nERROR 4089 (42S02): \'test.t\' is not a SEQUENCE\n\n# Call the NEXT VALUE FOR s:\nSELECT NEXT VALUE FOR s;\n+------------------+\n| NEXT VALUE FOR s |\n+------------------+\n| 100 |\n+------------------+\n\nSELECT PREVIOUS VALUE FOR s;\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 100 |\n+----------------------+\n\nNow try to start the new connection and check that the last value is still\nNULL, before updating the value in the new connection after the output of the\nnew connection gets current value (110 in the example below). Note that first\nconnection cannot see this change and the result of last value still remains\nthe same (100 in the example above).\n\n$ .mysql -uroot test -e\"SELECT PREVIOUS VALUE FOR s; SELECT NEXT VALUE FOR s;\nSELECT PREVIOUS VALUE FOR s;\"\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| NULL |\n+----------------------+\n+------------------+\n| NEXT VALUE FOR s |\n+------------------+\n| 110 |\n+------------------+\n+----------------------+\n| PREVIOUS VALUE FOR s |\n+----------------------+\n| 110 |\n+----------------------+\n\nURL: https://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 (741,39,'SETVAL','MariaDB starting with 10.3.1\n----------------------------\nSEQUENCEs were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSETVAL(sequence_name, next_value, [is_used, [round]])\n\nDescription\n-----------\n\nSet the next value to be returned for a SEQUENCE.\n\nThis function is compatible with PostgreSQL syntax, extended with the round\nargument.\n\nIf the is_used argument is not given or is 1 or true, then the next used value\nwill one after the given value. If is_used is 0 or false then the next\ngenerated value will be the given value.\n\nIf round is used then it will set the round value (or the internal cycle\ncount, starting at zero) for the sequence. If round is not used, it\'s assumed\nto be 0.\n\nnext_value must be an integer literal.\n\nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE) one should use\nboth next_value and round to define the next value. In this case the current\nsequence value is defined to be round, next_value.\n\nThe result returned by SETVAL() is next_value or NULL if the given next_value\nand round is smaller than the current value.\n\nSETVAL() will not set the SEQUENCE value to a something that is less than its\ncurrent value. This is needed to ensure that SETVAL() is replication safe. If\nyou want to set the SEQUENCE to a smaller number use ALTER SEQUENCE.\n\nIf CYCLE is used, first round and then next_value are compared to see if the\nvalue is bigger than the current value.\n\nInternally, in the MariaDB server, SETVAL() is used to inform slaves that a\nSEQUENCE has changed value. The slave may get SETVAL() statements out of\norder, but this is ok as only the biggest one will have an effect.\n\nSETVAL requires the INSERT privilege.\n\nExamples\n--------\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 42\n\nSETVAL setting higher and lower values on a sequence with an increment 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 next_value and round is\nsmaller 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 be 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\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 (742,40,'JSON_ARRAYAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_ARRAYAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_ARRAYAGG(column_or_expression)\n\nDescription\n-----------\n\nJSON_ARRAYAGG returns a JSON array containing an element for each value in a\ngiven set of JSON or SQL values. It acts on a column or an expression that\nevaluates to a single value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_ARRAYAGG cannot currently be used as a window function.\n\nThe full syntax is as follows:\n\nJSON_ARRAYAGG([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT);\n\nINSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2,\n2);\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;\n+-------------------+-------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+-------------------+-------------------+\n| [1,2,1,2,3,2,2,2] | [1,1,1,1,2,2,2,2] |\n+-------------------+-------------------+\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;\n+------------------+------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+------------------+------------------+\n| [1,2,1,2] | [1,1,1,1] |\n| [3,2,2,2] | [2,2,2,2] |\n+------------------+------------------+\n\nURL: https://mariadb.com/kb/en/json_arrayagg/','','https://mariadb.com/kb/en/json_arrayagg/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (743,40,'JSON_OBJECTAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_OBJECTAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_OBJECTAGG(key, value)\n\nDescription\n-----------\n\nJSON_OBJECTAGG returns a JSON object containing key-value pairs. It takes two\nexpressions that evaluate to a single value, or two column names, as\narguments, the first used as a key, and the second as a value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_OBJECTAGG cannot currently be used as a window function.\n\nExamples\n--------\n\nselect * from t1;\n+------+-------+\n| a | b |\n+------+-------+\n| 1 | Hello |\n| 1 | World |\n| 2 | This |\n+------+-------+\n\nSELECT JSON_OBJECTAGG(a, b) FROM t1;\n+----------------------------------------+\n| JSON_OBJECTAGG(a, b) |\n+----------------------------------------+\n| {\"1\":\"Hello\", \"1\":\"World\", \"2\":\"This\"} |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_objectagg/','','https://mariadb.com/kb/en/json_objectagg/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (744,40,'JSONPath Expressions','A number of JSON functions accept JSON Path expressions. MariaDB defines this\npath as follows:\n\nJSON Path Syntax\n----------------\n\npath : [\'lax\'] \'$\' [step]*\n\nThe path starts with an optional path mode. At the moment, MariaDB supports\nonly the \"lax\" mode, which is also the mode that is used when it is not\nexplicitly specified.\n\nThe $ symbol represents the context item. The search always starts from the\ncontext item; because of that, the path always starts with $.\n\nThen, it is followed by zero or more steps, which select element(s) in the\nJSON document. A step may be one of the following:\n\n* Object member selector\n* Array element selector\n* Wildcard selector\n\nObject Member Selector\n----------------------\n\nTo select member(s) in a JSON object, one can use one of the following:\n\n* .memberName selects the value of the member with name memberName.\n* .\"memberName\" - the same as above but allows one to select a member with a\nname that\'s not a valid identifier (that is, has space, dot, and/or other\ncharacters)\n* .* - selects the values of all members of the object.\n\nIf the current item is an array (instead of an object), nothing will be\nselected.\n\nArray Element Selector\n----------------------\n\nTo select elements of an array, one can use one of the following:\n\n* [N] selects element number N in the array. The elements are counted from\nzero.\n* [*] selects all elements in the array.\n\nIf the current item is an object (instead of an array), nothing will be\nselected.\n\nStarting from MariaDB server 10.9, JSON path also supports negative index in\narray, \'last\' keyword and range notation (\'to\' keyword) for accessing array\nelements. Negative index starts from -1.\n\n* [-N] selects n th element from end.\n* [last-N] selects n th element from the last element.\n* [M to N] selects range of elements starting from index M to N.\n\nExample:\n\nSET @json=\'{\n \"A\": [0,\n [1, 2, 3],\n [4, 5, 6],\n \"seven\",\n 0.8,\n true,\n false,\n \"eleven\",\n [12, [13, 14], {\"key1\":\"value1\"},[15]],\n true],\n \"B\": {\"C\": 1},\n \"D\": 2\n }\';\nSELECT JSON_EXTRACT(@json, \'$.A[-8][1]\');\n+--------------------------------------------------+\n| JSON_EXTRACT(@json, \'$.A[-8][1]\') |\n+--------------------------------------------------+\n| 5 |\n+--------------------------------------------------+\n\nSELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\');\n+-----------------------------------------------+\n| SELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\'); |\n+-----------------------------------------------+\n| 5 |\n+-----------------------------------------------+\n\nSET @json= \'[\n [1, {\"key1\": \"value1\"}, 3],\n [false, 5, 6],\n [7, 8, [9, {\"key2\": 2}, 11]],\n [15, 1.34, [14], [\"string1\", [16, {\"key1\":[1,2,3,[4,5,6]]}, 18]]],\n [19, 20],\n 21, 22\n ]\';\n\nSELECT JSON_EXTRACT(@json, \'$[0 to 3][2]\');\n+-----------------------------------------------+\n| JSON_EXTRACT(@json, \'$[0 to 3][2]\') |\n+-----------------------------------------------+\n| [3, 6, [9, {\"key2\": 2}, 11], [14]] |\n+-----------------------------------------------+\n\nThis will produce output for first index of eighth from last element of a two\ndimensional array.\n\nNote: In range notation, when M > N ( when M,N are greater than or equal to 0)\nor (size of array - M or size of array - N when M, N are less than 0), then it\nis treated as an impossible range and NULL is returned.\n\nSET @json= \'[1, 2, 3, 4, 5]\';\nSELECT JSON_EXTRACT(@json, \'$[4 to 2]\');\n+-----------------------------------+\n| JSON_EXTRACT(@json, \'$[4 to 2]\') |\n+-----------------------------------+\n| NULL |\n+-----------------------------------+\n\nWildcard\n--------\n\nThe wildcard step, **, recursively selects all child elements of the current\nelement. Both array elements and object members are selected.\n\nThe wildcard step must not be the last step in the JSONPath expression. It\nmust be followed by an array or object member selector step.\n\nFor example:\n\nselect json_extract(@json_doc, \'$**.price\');\n\nwill select all object members in the document that are named price, while\n\nselect json_extract(@json_doc, \'$**[2]\');\n\nwill select the second element in each of the arrays present in the document.\n\nCompatibility\n-------------\n\nMariaDB\'s JSONPath syntax supports a subset of JSON Path\'s definition in the\nSQL Standard. The most notable things not supported are the strict mode and\nfilters.\n\nMariaDB\'s JSONPath is close to MySQL\'s JSONPath. The wildcard step ( ** ) is a\nnon-standard extension that has the same meaning as in MySQL. The differences\nbetween MariaDB and MySQL\'s JSONPath are: MySQL supports [last] and [M to N]\nas array element selectors; MySQL doesn\'t allow one to specify the mode\nexplicitly (but uses lax mode implicitly).\n\nURL: https://mariadb.com/kb/en/jsonpath-expressions/','','https://mariadb.com/kb/en/jsonpath-expressions/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (745,40,'JSON_ARRAY','Syntax\n------\n\nJSON_ARRAY([value[, value2] ...])\n\nDescription\n-----------\n\nReturns a JSON array containing the listed values. The list can be empty.\n\nExample\n-------\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\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 (746,40,'JSON_ARRAY_APPEND','Syntax\n------\n\nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nAppends values to the end of the specified arrays within a JSON document,\nreturning the result, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\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\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 (747,40,'JSON_ARRAY_INSERT','Syntax\n------\n\nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nInserts a value into a JSON document, returning the modified document, or NULL\nif any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\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\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 (748,40,'JSON_COMPACT','Syntax\n------\n\nJSON_COMPACT(json_doc)\n\nDescription\n-----------\n\nRemoves all unnecessary spaces so the json document is as short as possible.\n\nExample\n-------\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\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 (749,40,'JSON_CONTAINS','Syntax\n------\n\nJSON_CONTAINS(json_doc, val[, path])\n\nDescription\n-----------\n\nReturns whether or not the specified value is found in the given JSON document\nor, optionally, at the specified path within the document. Returns 1 if it\ndoes, 0 if not and NULL if any of the arguments are null. An error occurs if\nthe document or path is not valid, or contains the * or ** wildcards.\n\nExamples\n--------\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\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 (750,40,'JSON_CONTAINS_PATH','Syntax\n------\n\nJSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)\n\nDescription\n-----------\n\nIndicates whether the given JSON document contains data at the specified path\nor paths. Returns 1 if it does, 0 if not and NULL if any of the arguments are\nnull.\n\nThe return_arg can be one or all:\n\n* one - Returns 1 if at least one path exists within the JSON document. \n* all - Returns 1 only if all paths exist within the JSON document.\n\nExamples\n--------\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\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 (751,40,'JSON_DEPTH','Syntax\n------\n\nJSON_DEPTH(json_doc)\n\nDescription\n-----------\n\nReturns the maximum depth of the given JSON document, or NULL if the argument\nis null. An error will occur if the argument is an invalid JSON document.\n\n* Scalar values or empty arrays or objects have a depth of 1.\n* Arrays or objects that are not empty but contain only elements or member\nvalues of depth 1 will have a depth of 2.\n* In other cases, the depth will be greater than 2.\n\nExamples\n--------\n\nSELECT JSON_DEPTH(\'[]\'), JSON_DEPTH(\'true\'), JSON_DEPTH(\'{}\');\n+------------------+--------------------+------------------+\n| JSON_DEPTH(\'[]\') | JSON_DEPTH(\'true\') | JSON_DEPTH(\'{}\') |\n+------------------+--------------------+------------------+\n| 1 | 1 | 1 |\n+------------------+--------------------+------------------+\n\nSELECT JSON_DEPTH(\'[1, 2, 3]\'), JSON_DEPTH(\'[[], {}, []]\');\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\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 (752,40,'JSON_DETAILED','Syntax\n------\n\nJSON_DETAILED(json_doc[, tab_size])\n\nDescription\n-----------\n\nRepresents JSON in the most understandable way emphasizing nested structures.\n\nExample\n-------\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\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 (753,40,'JSON_EQUALS','MariaDB starting with 10.7.0\n----------------------------\nJSON_EQUALS was added in MariaDB 10.7.0\n\nSyntax\n------\n\nJSON_EQUALS(json1, json2)\n\nDescription\n-----------\n\nChecks if there is equality between two json objects. Returns 1 if it there\nis, 0 if not, or NULL if any of the arguments are null.\n\nExamples\n--------\n\nSELECT JSON_EQUALS(\'{\"a\" :[1, 2, 3],\"b\":[4]}\', \'{\"b\":[4],\"a\":[1, 2, 3.0]}\');\n+------------------------------------------------------------------------+\n| JSON_EQUALS(\'{\"a\" :[1, 2, 3],\"b\":[4]}\', \'{\"b\":[4],\"a\":[1, 2, 3.0]}\') |\n+------------------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------------------+\n\nSELECT JSON_EQUALS(\'{\"a\":[1, 2, 3]}\', \'{\"a\":[1, 2, 3.01]}\');\n+------------------------------------------------------+\n| JSON_EQUALS(\'{\"a\":[1, 2, 3]}\', \'{\"a\":[1, 2, 3.01]}\') |\n+------------------------------------------------------+\n| 0 |\n+------------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_equals/','','https://mariadb.com/kb/en/json_equals/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (754,40,'JSON_EXISTS','Syntax\n------\n\nDescription\n-----------\n\nDetermines whether a specified JSON value exists in the given data. Returns 1\nif found, 0 if not, or NULL if any of the inputs were NULL.\n\nExamples\n--------\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2\") |\n+------------------------------------------------------------+\n| 1 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key3\");\n+------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key3\") |\n+------------------------------------------------------------+\n| 0 |\n+------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[1]\");\n+---------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[1]\") |\n+---------------------------------------------------------------+\n| 1 |\n+---------------------------------------------------------------+\n\nSELECT JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[10]\");\n+----------------------------------------------------------------+\n| JSON_EXISTS(\'{\"key1\":\"xxxx\", \"key2\":[1, 2, 3]}\', \"$.key2[10]\") |\n+----------------------------------------------------------------+\n| 0 |\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 (755,40,'JSON_EXTRACT','Syntax\n------\n\nJSON_EXTRACT(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nExtracts data from a JSON document. The extracted data is selected from the\nparts matching the path arguments. Returns all matched values; either as a\nsingle matched value, or, if the arguments could return multiple values, a\nresult autowrapped as an array in the matching order.\n\nReturns NULL if no paths match or if any of the arguments are NULL.\n\nAn error will occur if any path argument is not a valid path, or if the\njson_doc argument is not a valid JSON document.\n\nThe path expression be a JSONPath expression as supported by MariaDB\n\nExamples\n--------\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\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 (756,40,'JSON_INSERT','Syntax\n------\n\nJSON_INSERT(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nInserts data into a JSON document, returning the resulting document or NULL if\nany argument is null.\n\nAn error will occur if the JSON document is not invalid, or if any of the\npaths are invalid or contain a * or ** wildcard.\n\nJSON_INSERT can only insert data while JSON_REPLACE can only update. JSON_SET\ncan update or insert data.\n\nExamples\n--------\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\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 (757,40,'JSON_KEYS','Syntax\n------\n\nJSON_KEYS(json_doc[, path])\n\nDescription\n-----------\n\nReturns the keys as a JSON array from the top-level value of a JSON object or,\nif the optional path argument is provided, the top-level keys from the path.\n\nExcludes keys from nested sub-objects in the top level value. The resulting\narray will be empty if the selected object is empty.\n\nReturns NULL if any of the arguments are null, a given path does not locate an\nobject, or if the json_doc argument is not an object.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the\npath contains a * or ** wildcard.\n\nExamples\n--------\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\": 3}}\', \'$.C\');\n+-----------------------------------------------------+\n| JSON_KEYS(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\') |\n+-----------------------------------------------------+\n| [\"D\"] |\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 (758,40,'JSON_LENGTH','Syntax\n------\n\nJSON_LENGTH(json_doc[, path])\n\nDescription\n-----------\n\nReturns the length of a JSON document, or, if the optional path argument is\ngiven, the length of the value within the document specified by the path.\n\nReturns NULL if any of the arguments argument are null or the path argument\ndoes not identify a value in the document.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nLength will be determined as follow:\n\n* A scalar\'s length is always 1.\n* If an array, the number of elements in the array.\n* If an object, the number of members in the object.\n\nThe length of nested arrays or objects are not counted.\n\nExamples\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 (759,40,'JSON_LOOSE','Syntax\n------\n\nJSON_LOOSE(json_doc)\n\nDescription\n-----------\n\nAdds spaces to a JSON document to make it look more readable.\n\nExample\n-------\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\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 (760,40,'JSON_MERGE','Syntax\n------\n\nJSON_MERGE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\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 documents.\n\nJSON_MERGE has been deprecated since MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5. JSON_MERGE_PATCH is an RFC 7396-compliant replacement, and\nJSON_MERGE_PRESERVE is a synonym.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[3, 4]\';\n\nSELECT JSON_MERGE(@json1,@json2);\n+---------------------------+\n| JSON_MERGE(@json1,@json2) |\n+---------------------------+\n| [1, 2, 3, 4] |\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 (761,40,'JSON_MERGE_PATCH','MariaDB starting with 10.2.25\n-----------------------------\nJSON_MERGE_PATCH was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5.\n\nSyntax\n------\n\nJSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PATCH is an RFC 7396-compliant replacement for JSON_MERGE, which\nhas been deprecated.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[2, 3]\';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\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 (762,40,'JSON_MERGE_PRESERVE','MariaDB starting with 10.2.25\n-----------------------------\nJSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5.\n\nSyntax\n------\n\nJSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)\n\nDescription\n-----------\n\nMerges the given JSON documents, returning the merged result, or NULL if any\nargument is NULL.\n\nJSON_MERGE_PRESERVE was introduced in MariaDB 10.2.25, MariaDB 10.3.16 and\nMariaDB 10.4.5 as a synonym for JSON_MERGE, which has been deprecated.\n\nExample\n-------\n\nSET @json1 = \'[1, 2]\';\nSET @json2 = \'[2, 3]\';\nSELECT JSON_MERGE_PATCH(@json1,@json2),JSON_MERGE_PRESERVE(@json1,@json2);\n+---------------------------------+------------------------------------+\n| JSON_MERGE_PATCH(@json1,@json2) | JSON_MERGE_PRESERVE(@json1,@json2) |\n+---------------------------------+------------------------------------+\n| [2, 3] | [1, 2, 2, 3] |\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 (763,40,'JSON_NORMALIZE','MariaDB starting with 10.7.0\n----------------------------\nJSON_NORMALIZE was added in MariaDB 10.7.0.\n\nSyntax\n------\n\nJSON_NORMALIZE(json)\n\nDescription\n-----------\n\nRecursively sorts keys and removes spaces, allowing comparison of json\ndocuments for equality.\n\nExamples\n--------\n\nWe may wish our application to use the database to enforce a unique constraint\non the JSON contents, and we can do so using the JSON_NORMALIZE function in\ncombination with a unique key.\n\nFor example, if we have a table with a JSON column:\n\nCREATE TABLE t1 (\n id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n val JSON,\n /* other columns here */\n PRIMARY KEY (id)\n);\n\nAdd a unique constraint using JSON_NORMALIZE like this:\n\nALTER TABLE t1\n ADD COLUMN jnorm JSON AS (JSON_NORMALIZE(val)) VIRTUAL,\n ADD UNIQUE KEY (jnorm);\n\nWe can test this by first inserting a row as normal:\n\nINSERT INTO t1 (val) VALUES (\'{\"name\":\"alice\",\"color\":\"blue\"}\');\n\nAnd then seeing what happens with a different string which would produce the\nsame JSON object:\n\nINSERT INTO t1 (val) VALUES (\'{ \"color\": \"blue\", \"name\": \"alice\" }\');\nERROR 1062 (23000): Duplicate entry \'{\"color\":\"blue\",\"name\":\"alice\"}\' for key\n\'jnorm\'\n\nURL: https://mariadb.com/kb/en/json_normalize/','','https://mariadb.com/kb/en/json_normalize/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (764,40,'JSON_OBJECT','Syntax\n------\n\nJSON_OBJECT([key, value[, key, value] ...])\n\nDescription\n-----------\n\nReturns a JSON object containing the given key/value pairs. The key/value list\ncan be empty.\n\nAn error will occur if there are an odd number of arguments, or any key name\nis NULL.\n\nExample\n-------\n\nSELECT JSON_OBJECT(\"id\", 1, \"name\", \"Monty\");\n+---------------------------------------+\n| JSON_OBJECT(\"id\", 1, \"name\", \"Monty\") |\n+---------------------------------------+\n| {\"id\": 1, \"name\": \"Monty\"} |\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 (765,40,'JSON_QUERY','Syntax\n------\n\nJSON_QUERY(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns an object or array specified by the path.\nReturns NULL if not given a valid JSON document, or if there is no match.\n\nExamples\n--------\n\nselect json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\', \'$.key1\');\n+-----------------------------------------------------+\n| json_query(\'{\"key1\":{\"a\":1, \"b\":[1,2]}}\', \'$.key1\') |\n+-----------------------------------------------------+\n| {\"a\":1, \"b\":[1,2]} |\n+-----------------------------------------------------+\n\nselect json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\', \'$.key1\');\n+-------------------------------------------------------+\n| json_query(\'{\"key1\":123, \"key1\": [1,2,3]}\', \'$.key1\') |\n+-------------------------------------------------------+\n| [1,2,3] |\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 (766,40,'JSON_QUOTE','Syntax\n------\n\nJSON_QUOTE(json_value)\n\nDescription\n-----------\n\nQuotes a string as a JSON value, usually for producing valid JSON string\nliterals for inclusion in JSON documents. Wraps the string with double quote\ncharacters and escapes interior quotes and other special characters, returning\na utf8mb4 string.\n\nReturns NULL if the argument is NULL.\n\nExamples\n--------\n\nSELECT JSON_QUOTE(\'A\'), JSON_QUOTE(\"B\"), JSON_QUOTE(\'\"C\"\');\n+-----------------+-----------------+-------------------+\n| JSON_QUOTE(\'A\') | JSON_QUOTE(\"B\") | JSON_QUOTE(\'\"C\"\') |\n+-----------------+-----------------+-------------------+\n| \"A\" | \"B\" | \"\\\"C\\\"\" |\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 (767,40,'JSON_REMOVE','Syntax\n------\n\nJSON_REMOVE(json_doc, path[, path] ...)\n\nDescription\n-----------\n\nRemoves data from a JSON document returning the result, or NULL if any of the\narguments are null. If the element does not exist in the document, no changes\nare made.\n\nAn error will occur if JSON document is invalid, the path is invalid or if the\npath contains a * or ** wildcard.\n\nPath arguments are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nExamples\n--------\n\nSELECT JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\');\n+-------------------------------------------------------+\n| JSON_REMOVE(\'{\"A\": 1, \"B\": 2, \"C\": {\"D\": 3}}\', \'$.C\') |\n+-------------------------------------------------------+\n| {\"A\": 1, \"B\": 2} |\n+-------------------------------------------------------+\n\nSELECT JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\', \'$[1]\');\n+----------------------------------------------------+\n| JSON_REMOVE(\'[\"A\", \"B\", [\"C\", \"D\"], \"E\"]\', \'$[1]\') |\n+----------------------------------------------------+\n| [\"A\", [\"C\", \"D\"], \"E\"] |\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 (768,40,'JSON_REPLACE','Syntax\n------\n\nJSON_REPLACE(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nReplaces existing values in a JSON document, returning the result, or NULL if\nany of the arguments are NULL.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or ** wildcard.\n\nPaths and values are evaluated from left to right, with the result from the\nearlier evaluation being used as the value for the next.\n\nJSON_REPLACE can only update data, while JSON_INSERT can only insert. JSON_SET\ncan update or insert data.\n\nExamples\n--------\n\nSELECT JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\', 4);\n+-----------------------------------------------------+\n| JSON_REPLACE(\'{ \"A\": 1, \"B\": [2, 3]}\', \'$.B[1]\', 4) |\n+-----------------------------------------------------+\n| { \"A\": 1, \"B\": [2, 4]} |\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 (769,40,'JSON_SEARCH','Syntax\n------\n\nJSON_SEARCH(json_doc, return_arg, search_str[, escape_char[, path] ...])\n\nDescription\n-----------\n\nReturns the path to the given string within a JSON document, or NULL if any of\njson_doc, search_str or a path argument is NULL; if the search string is not\nfound, or if no path exists within the document.\n\nA warning will occur if the JSON document is not valid, any of the path\narguments are not valid, if return_arg is neither one nor all, or if the\nescape character is not a constant. NULL will be returned.\n\nreturn_arg can be one of two values:\n\n* \'one: Terminates after finding the first match, so will return one path\nstring. If there is more than one match, it is undefined which is considered\nfirst.\n* all: Returns all matching path strings, without duplicates. Multiple strings\nare autowrapped as an array. The order is undefined.\n\nExamples\n--------\n\nSET @json = \'[\"A\", [{\"B\": \"1\"}], {\"C\":\"AB\"}, {\"D\":\"BC\"}]\';\n\nSELECT JSON_SEARCH(@json, \'one\', \'AB\');\n+---------------------------------+\n| JSON_SEARCH(@json, \'one\', \'AB\') |\n+---------------------------------+\n| \"$[2].C\" |\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 (770,40,'JSON_SET','Syntax\n------\n\nJSON_SET(json_doc, path, val[, path, val] ...)\n\nDescription\n-----------\n\nUpdates or inserts data into a JSON document, returning the result, or NULL if\nany of the arguments are NULL or the optional path fails to find an object.\n\nAn error will occur if the JSON document is invalid, the path is invalid or if\nthe path contains a * or wildcard.\n\nJSON_SET can update or insert data, while JSON_REPLACE can only update, and\nJSON_INSERT only insert.\n\nExamples\n--------\n\nSELECT JSON_SET(Priv, \'$.locked\', \'true\') FROM mysql.global_priv\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 (771,40,'JSON_TABLE','MariaDB starting with 10.6.0\n----------------------------\nJSON_TABLE was added in MariaDB 10.6.0.\n\nJSON_TABLE is a table function that converts JSON data into a relational form.\n\nSyntax\n------\n\nJSON_TABLE(json_doc, \n context_path COLUMNS (column_list)\n) [AS] alias\n\ncolumn_list:\n column[, column][, ...]\n\ncolumn:\n name FOR ORDINALITY\n | name type PATH path_str [on_empty] [on_error]\n | name type EXISTS PATH path_str\n | NESTED PATH path_str COLUMNS (column_list)\n\non_empty:\n {NULL | DEFAULT string | ERROR} ON EMPTY\n\non_error:\n {NULL | DEFAULT string | ERROR} ON ERROR\n\nDescription\n-----------\n\nJSON_TABLE can be used in contexts where a table reference can be used; in the\nFROM clause of a SELECT statement, and in multi-table UPDATE/DELETE statements.\n\njson_doc is the JSON document to extract data from. In the simplest case, it\nis a string literal containing JSON. In more complex cases it can be an\narbitrary expression returning JSON. The expression may have references to\ncolumns of other tables. However, one can only refer to tables that precede\nthis JSON_TABLE invocation. For RIGHT JOIN, it is assumed that its outer side\nprecedes the inner. All tables in outer selects are also considered preceding.\n\ncontext_path is a JSON Path expression pointing to a collection of nodes in\njson_doc that will be used as the source of rows.\n\nThe COLUMNS clause declares the names and types of the columns that JSON_TABLE\nreturns, as well as how the values of the columns are produced.\n\nColumn Definitions\n------------------\n\nThe following types of columns are supported:\n\nPath Columns\n------------\n\nname type PATH path_str [on_empty] [on_error]\n\nLocates the JSON node pointed to by path_str and returns its value. The\npath_str is evaluated using the current row source node as the context node.\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\", \"price\":\"1000\"},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n color varchar(10) path \'$.color\',\n price decimal(8,2) path \'$.price\' )\n) as jt;\n+--------+-------+---------+\n| name | color | price |\n+--------+-------+---------+\n| Laptop | black | 1000.00 |\n| Jeans | blue | NULL |\n+--------+-------+---------+\n\nThe on_empty and on_error clauses specify the actions to be performed when the\nvalue was not found or there was an error condition. See the ON EMPTY and ON\nERROR clauses section for details.\n\nORDINALITY Columns\n------------------\n\nname FOR ORDINALITY\n\nCounts the rows, starting from 1.\n\nExample:\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\"},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n id for ordinality,\n name varchar(10) path \'$.name\')\n) as jt;\n+------+--------+\n| id | name |\n+------+--------+\n| 1 | Laptop |\n| 2 | Jeans |\n+------+--------+\n\nEXISTS PATH Columns\n-------------------\n\nname type EXISTS PATH path_str\n\nChecks whether the node pointed to by value_path exists. The value_path is\nevaluated using the current row source node as the context node.\n\nset @json=\'\n[\n {\"name\":\"Laptop\", \"color\":\"black\", \"price\":1000},\n {\"name\":\"Jeans\", \"color\":\"blue\"}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n has_price integer exists path \'$.price\')\n) as jt;\n+--------+-----------+\n| name | has_price |\n+--------+-----------+\n| Laptop | 1 |\n| Jeans | 0 |\n+--------+-----------+\n\nNESTED PATHs\n------------\n\nNESTED PATH converts nested JSON structures into multiple rows.\n\nNESTED PATH path COLUMNS (column_list)\n\nIt finds the sequence of JSON nodes pointed to by path and uses it to produce\nrows. For each found node, a row is generated with column values as specified\nby the NESTED PATH\'s COLUMNS clause. If path finds no nodes, only one row is\ngenerated with all columns having NULL values.\n\nFor example, consider a JSON document that contains an array of items, and\neach item, in turn, is expected to have an array of its available sizes:\n\nset @json=\'\n[\n {\"name\":\"Jeans\", \"sizes\": [32, 34, 36]},\n {\"name\":\"T-Shirt\", \"sizes\":[\"Medium\", \"Large\"]},\n {\"name\":\"Cellphone\"}\n]\';\n\nNESTED PATH allows one to produce a separate row for each size each item has:\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n nested path \'$.sizes[*]\' columns (\n size varchar(32) path \'$\'\n )\n )\n) as jt;\n+-----------+--------+\n| name | size |\n+-----------+--------+\n| Jeans | 32 |\n| Jeans | 34 |\n| Jeans | 36 |\n| T-Shirt | Medium |\n| T-Shirt | Large |\n| Cellphone | NULL |\n+-----------+--------+\n\nNESTED PATH clauses can be nested within one another. They can also be located\nnext to each other. In that case, the nested path clauses will produce records\none at a time. The ones that are not producing records will have all columns\nset to NULL.\n\nExample:\n\nset @json=\'\n[\n {\"name\":\"Jeans\", \"sizes\": [32, 34, 36], \"colors\":[\"black\", \"blue\"]}\n]\';\n\nselect * from json_table(@json, \'$[*]\' \n columns(\n name varchar(10) path \'$.name\',\n nested path \'$.sizes[*]\' columns (\n size varchar(32) path \'$\'\n ),\n nested path \'$.colors[*]\' columns (\n color varchar(32) path \'$\'\n )\n )\n) as jt;\n\n+-------+------+-------+\n| name | size | color |\n+-------+------+-------+\n| Jeans | 32 | NULL |\n| Jeans | 34 | NULL |\n| Jeans | 36 | NULL |\n| Jeans | NULL | black |\n| Jeans | NULL | blue |\n+-------+------+-------+\n\nON EMPTY and ON ERROR Clauses\n-----------------------------\n\nThe ON EMPTY clause specifies what will be done when the element specified by\nthe search path is missing in the JSON document.\n\non_empty:\n {NULL | DEFAULT string | ERROR} ON EMPTY\n\nWhen ON EMPTY clause is not present, NULL ON EMPTY is implied.\n\non_error:\n {NULL | DEFAULT string | ERROR} ON ERROR\n\nThe ON ERROR clause specifies what should be done if a JSON structure error\noccurs when trying to extract the value pointed to by the path expression. A\nJSON structure error here occurs only when one attempts to convert a JSON\nnon-scalar (array or object) into a scalar value. When the ON ERROR clause is\nnot present, NULL ON ERROR is implied.\n\nNote: A datatype conversion error (e.g. attempt to store a non-integer value\ninto an integer field, or a varchar column being truncated) is not considered\na JSON error and so will not trigger the ON ERROR behavior. It will produce\nwarnings, in the same way as CAST(value AS datatype) would.\n\nReplication\n-----------\n\nIn the current code, evaluation of JSON_TABLE is deterministic, that is, for a\ngiven input string JSON_TABLE will always produce the same set of rows in the\nsame order. However, one can think of JSON documents that one can consider\nidentical which will produce different output. In order to be future-proof and\nwithstand changes like:\n\n* sorting JSON object members by name (like MySQL does)\n* changing the way duplicate object members are handled\nthe function is marked as unsafe for statement-based replication.\n\nExtracting a Subdocument into a Column\n--------------------------------------\n\nMariaDB starting with 10.6.9\n----------------------------\nPrior to MariaDB 10.6.9, JSON_TABLE did not allow one to extract a JSON\n\"subdocument\" into a JSON column.\n\nSELECT * FROM JSON_TABLE(\'{\"foo\": [1,2,3,4]}\',\'$\' columns( jscol json path\n\'$.foo\') ) AS T;\n+-------+\n| jscol |\n+-------+\n| NULL |\n+-------+\n\nThis is supported from MariaDB 10.6.9:\n\nSELECT * FROM JSON_TABLE(\'{\"foo\": [1,2,3,4]}\',\'$\' columns( jscol json path\n\'$.foo\') ) AS T;\n+-----------+\n| jscol |\n+-----------+\n| [1,2,3,4] |\n+-----------+\n\nURL: https://mariadb.com/kb/en/json_table/','','https://mariadb.com/kb/en/json_table/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (772,40,'JSON_TYPE','Syntax\n------\n\nJSON_TYPE(json_val)\n\nDescription\n-----------\n\nReturns the type of a JSON value (as a string), or NULL if the argument is\nnull.\n\nAn error will occur if the argument is an invalid JSON value.\n\nThe following is a complete list of the possible return types:\n\n+-----------------------------------+-----------------+-----------------------+\n| Return type | Value | Example |\n+-----------------------------------+-----------------+-----------------------+\n| ARRAY | JSON array | [1, 2, {\"key\": |\n| | | \"value\"}] |\n+-----------------------------------+-----------------+-----------------------+\n| OBJECT | JSON object | {\"key\":\"value\"} |\n+-----------------------------------+-----------------+-----------------------+\n| BOOLEAN | JSON | true, false |\n| | true/false | |\n| | literals | |\n+-----------------------------------+-----------------+-----------------------+\n| DOUBLE | A number with | 1.2 |\n| | at least one | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| INTEGER | A number | 1 |\n| | without a | |\n| | floating point | |\n| | decimal. | |\n+-----------------------------------+-----------------+-----------------------+\n| NULL | JSON null | null |\n| | literal (this | |\n| | is returned as | |\n| | a string, not | |\n| | to be confused | |\n| | with the SQL | |\n| | NULL value!) | |\n+-----------------------------------+-----------------+-----------------------+\n| STRING | JSON String | \"a sample string\" |\n+-----------------------------------+-----------------+-----------------------+\n\nExamples\n--------\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\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 (773,40,'JSON_UNQUOTE','Syntax\n------\n\nJSON_UNQUOTE(val)\n\nDescription\n-----------\n\nUnquotes a JSON value, returning a string, or NULL if the argument is null.\n\nAn error will occur if the given value begins and ends with double quotes and\nis an invalid JSON string literal.\n\nIf the given value is not a JSON string, value is passed through unmodified.\n\nCertain character sequences have special meanings within a string. Usually, a\nbackslash is ignored, but the escape sequences in the table below are\nrecognised by MariaDB, unless the SQL Mode is set to NO_BACKSLASH_ESCAPES SQL.\n\n+-----------------------------------------------+-----------------------------+\n| Escape sequence | Character |\n+-----------------------------------------------+-----------------------------+\n| \\\" | Double quote (\") |\n+-----------------------------------------------+-----------------------------+\n| \\b | Backslash |\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 |\n| | value XXXX |\n+-----------------------------------------------+-----------------------------+\n\nExamples\n--------\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\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 (774,40,'JSON_VALID','Syntax\n------\n\nJSON_VALID(value)\n\nDescription\n-----------\n\nIndicates whether the given value is a valid JSON document or not. Returns 1\nif valid, 0 if not, and NULL if the argument is NULL.\n\nFrom MariaDB 10.4.3, the JSON_VALID function is automatically used as a CHECK\nconstraint for the JSON data type alias in order to ensure that a valid json\ndocument is inserted.\n\nExamples\n--------\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\", \"oddfield\"}\');\n+------------------------------------------------------+\n| JSON_VALID(\'{\"id\": 1, \"name\": \"Monty\", \"oddfield\"}\') |\n+------------------------------------------------------+\n| 0 |\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 (775,40,'JSON_VALUE','Syntax\n------\n\nJSON_VALUE(json_doc, path)\n\nDescription\n-----------\n\nGiven a JSON document, returns the scalar specified by the path. Returns NULL\nif not given a valid JSON document, or if there is no match.\n\nExamples\n--------\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}\', \'$.key1\');\n+-------------------------------------------------------+\n| json_value(\'{\"key1\": [1,2,3], \"key1\":123}\', \'$.key1\') |\n+-------------------------------------------------------+\n| 123 |\n+-------------------------------------------------------+\n\nIn the SET statement below, two escape characters are needed, as a single\nescape character would be applied by the SQL parser in the SET statement, and\nthe escaped character would not form part of the saved value.\n\nSET @json = \'{\"key1\":\"60\\\\\" Table\", \"key2\":\"1\"}\';\n\nSELECT JSON_VALUE(@json,\'$.key1\') AS Name , json_value(@json,\'$.key2\') as ID;\n+-----------+------+\n| Name | ID |\n+-----------+------+\n| 60\" Table | 1 |\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 (776,41,'Window Functions Overview','Introduction\n------------\n\nWindow functions allow calculations to be performed across a set of rows\nrelated to the current row.\n\nSyntax\n------\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 frame_border}\n\nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n\nDescription\n-----------\n\nIn some ways, window functions are similar to aggregate functions in that they\nperform calculations across a set of rows. However, unlike aggregate\nfunctions, the output is not grouped into a single row.\n\nNon-aggregate window functions include\n\n* CUME_DIST\n* DENSE_RANK\n* FIRST_VALUE\n* LAG\n* LAST_VALUE\n* LEAD\n* MEDIAN\n* NTH_VALUE\n* NTILE\n* PERCENT_RANK\n* PERCENTILE_CONT\n* PERCENTILE_DISC\n* RANK, ROW_NUMBER\n\nAggregate functions that can also be used as window functions include\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* MAX\n* MIN\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nWindow function queries are characterised by the OVER keyword, following which\nthe set of rows used for the calculation is specified. By default, the set of\nrows used for the calculation (the \"window) is the entire dataset, which can\nbe ordered with the ORDER BY clause. The PARTITION BY clause is used to reduce\nthe window to a particular group within the dataset.\n\nFor example, given the following data:\n\nCREATE TABLE student (name CHAR(10), test CHAR(10), score TINYINT);\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 test and by name\nrespectively:\n\nSELECT name, test, score, AVG(score) OVER (PARTITION BY test) \n AS average_by_test FROM student;\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 name) \n AS average_by_name FROM student;\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 window function\n(for example, the current row and all preceding rows). See Window Frames for\nmore details.\n\nScope\n-----\n\nWindow functions were introduced in SQL:2003, and their definition was\nexpanded in subsequent versions of the standard. The last expansion was in the\nlatest version of the standard, SQL:2011.\n\nMost database products support a subset of the standard, they implement some\nfunctions defined as late as in SQL:2011, and at the same time leave some\nparts of SQL:2008 unimplemented.\n\nMariaDB:\n\n* Supports ROWS and RANGE-type frames\nAll kinds of frame bounds are supported, including RANGE PRECEDING|FOLLOWING n\nframe bounds (unlike PostgreSQL or MS SQL Server)\nDoes not yet support DATE[TIME] datatype and arithmetic for RANGE-type frames\n(MDEV-9727)\n\n* Does not support GROUPS-type frames (it seems that no popular database\nsupports it, either)\n\n* Does not support frame exclusion (no other database seems to support it,\neither) (MDEV-9724)\n* Does not support explicit NULLS FIRST or NULLS LAST.\n* Does not support nested navigation in window functions (this is\nVALUE_OF(expr AT row_marker [, default_value) syntax)\n\n* The following window functions are supported:\n\"Streamable\" window functions: ROW_NUMBER, RANK, DENSE_RANK, \nWindow functions that can be streamed once the number of rows in partition is\nknown: PERCENT_RANK, CUME_DIST, NTILE\n\n* Aggregate functions that are currently supported as window functions are:\nCOUNT, SUM, AVG, BIT_OR, BIT_AND, BIT_XOR.\n* Aggregate functions with the DISTINCT specifier (e.g. COUNT( DISTINCT x))\nare not supported as window functions.\n\nLinks\n-----\n\n* MDEV-6115 is the main jira task for window functions development. Other\ntasks are are attached as sub-tasks\n* bb-10.2-mdev9543 is the feature tree for window functions. Development is\nongoing, and this tree has the newest changes.\n* Testcases are in mysql-test/t/win*.test\n\nExamples\n--------\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\', \'regular\'),\n (\'eddie.stevens@data.org\', \'Eddie\', \'Stevens\', \'regular\'),\n (\'john.smith@xyz.org\', \'John\', \'Smith\', \'regular\'),\n (\'root@boss.org\', \'Root\', \'Chief\', \'admin\')\n\nFirst, let\'s order the records by email alphabetically, giving each an\nascending rnum value starting with 1. This will make use of the ROW_NUMBER\nwindow 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| 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, using the PARTITION\nBY clause:\n\nSELECT row_number() OVER (PARTITION BY account_type ORDER BY email) AS rnum, \n email, first_name, last_name, account_type\nFROM users ORDER BY account_type,email;\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 top 5 salaries\nfrom each department.\n\nCREATE TABLE employee_salaries (dept VARCHAR(20), name VARCHAR(20), salary\nINT(11));\n\nINSERT INTO employee_salaries VALUES\n(\'Engineering\', \'Dharma\', 3500),\n(\'Engineering\', \'Binh\', 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) < 5\norder by dept, salary desc;\n\n+-------------+--------------+--------+\n| dept | name | salary |\n+-------------+--------------+--------+\n| Engineering | Dharma | 3500 |\n| Engineering | Binh | 3000 |\n| Engineering | Adalynn | 2800 |\n| Engineering | Samuel | 2500 |\n| Engineering | Cveta | 2200 |\n| Sales | Carbry | 500 |\n| Sales | Clytemnestra | 400 |\n| Sales | Juraj | 300 |\n| Sales | Kalpana | 300 |\n| Sales | Svantepolk | 250 |\n+-------------+--------------+--------+\n\nThis has a number of disadvantages:\n\n* if there is no index, the query could take a long time if the\nemployee_salary_table is large\n* Adding and maintaining indexes adds overhead, and even with indexes on dept\nand salary, each subquery execution adds overhead by performing a lookup\nthrough the index.\n\nLet\'s try achieve the same with window functions. First, generate a rank for\nall employees, using the RANK function.\n\nselect rank() over (partition by dept order by salary desc) as ranking,\n dept, name, salary\n from employee_salaries\n order by dept, ranking;\n+---------+-------------+--------------+--------+\n| ranking | dept | name | salary |\n+---------+-------------+--------------+--------+\n| 1 | Engineering | Dharma | 3500 |\n| 2 | Engineering | Binh | 3000 |\n| 3 | Engineering | Adalynn | 2800 |\n| 4 | Engineering | Samuel | 2500 |\n| 5 | Engineering | Cveta | 2200 |\n| 6 | Engineering | Ebele | 1800 |\n| 1 | Sales | Carbry | 500 |\n| 2 | Sales | Clytemnestra | 400 |\n| 3 | Sales | Juraj | 300 |\n| 3 | Sales | Kalpana | 300 |\n| 5 | Sales | Svantepolk | 250 |\n| 6 | Sales | Angelo | 200 |\n+---------+-------------+--------------+--------+\n\nEach department has a separate sequence of ranks due to the PARTITION BY\nclause. This particular sequence of values for rank() is given by the ORDER BY\nclause inside the window function’s OVER clause. Finally, to get our results\nin a readable format we order the data by dept and the newly generated ranking\ncolumn.\n\nNow, we need to reduce the results to find only the top 5 per department. Here\nis a common mistake:\n\nselect\nrank() over (partition by dept order by salary desc) as ranking,\ndept, name, salary\nfrom employee_salaries\nwhere ranking <= 5\norder by dept, ranking;\n\nERROR 1054 (42S22): Unknown column \'ranking\' in \'where clause\'\n\nTrying to filter only the first 5 values per department by putting a where\nclause in the statement does not work, due to the way window functions are\ncomputed. The computation of window functions happens after all WHERE, GROUP\nBY and HAVING clauses have been completed, right before ORDER BY, so the WHERE\nclause has no idea that the ranking column exists. It is only present after we\nhave filtered and grouped all the rows.\n\nTo counteract this problem, we need to wrap our query into a derived table. We\ncan then attach a where clause to it:\n\nselect *from (select rank() over (partition by dept order by salary desc) as\nranking,\n dept, name, salary\nfrom employee_salaries) as salary_ranks\nwhere (salary_ranks.ranking <= 5)\n order by dept, ranking;\n+---------+-------------+--------------+--------+\n| ranking | dept | name | salary |\n+---------+-------------+--------------+--------+\n| 1 | Engineering | Dharma | 3500 |\n| 2 | Engineering | Binh | 3000 |\n| 3 | Engineering | Adalynn | 2800 |\n| 4 | Engineering | Samuel | 2500 |\n| 5 | Engineering | Cveta | 2200 |\n| 1 | Sales | Carbry | 500 |\n| 2 | Sales | Clytemnestra | 400 |\n| 3 | Sales | Juraj | 300 |\n| 3 | Sales | Kalpana | 300 |\n| 5 | Sales | Svantepolk | 250 |\n+---------+-------------+--------------+--------+\n\nURL: https://mariadb.com/kb/en/window-functions-overview/','','https://mariadb.com/kb/en/window-functions-overview/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (777,41,'CUME_DIST','Syntax\n------\n\nCUME_DIST() OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nCUME_DIST() is a window function that returns the cumulative distribution of a\ngiven row. The following formula is used to calculate the value:\n\n(number of rows <= current row) / (total rows)\n\nExamples\n--------\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| 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| 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 pct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\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\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 (778,41,'DENSE_RANK','Syntax\n------\n\nDENSE_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nDENSE_RANK() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving the same result. Unlike the RANK() function,\nthere are no skipped values if the preceding results are identical. It is also\nsimilar to the ROW_NUMBER() function except that in that function, identical\nvalues will receive a different row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (779,41,'FIRST_VALUE','Syntax\n------\n\nFIRST_VALUE(expr) OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nFIRST_VALUE returns the first result from an ordered set, or NULL if no such\nresult exists.\n\nExamples\n--------\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 (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 and 1 FOLLOWING) AS\nf_1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS\nl_1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS\nf_1p1f,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS\nf_2p1p,\n FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f,\n LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS\nf_1f2f\nFROM t1;\n\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p | f_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\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 (780,41,'LAG','Syntax\n------\n\nLAG (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ]\n < ORDER BY order_list >\n)\n\nDescription\n-----------\n\nThe LAG function accesses data from a previous row according to the ORDER BY\nclause without the need for a self-join. The specific row is determined by the\noffset (default 1), which specifies the number of rows behind the current row\nto use. An offset of 0 is the current row.\n\nExamples\n--------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), 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| 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\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 (781,41,'LEAD','Syntax\n------\n\nLEAD (expr[, offset]) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe LEAD function accesses data from a following row in the same result set\nwithout the need for a self-join. The specific row is determined by the offset\n(default 1), which specifies the number of rows ahead the current row to use.\nAn offset of 0 is the current row.\n\nExample\n-------\n\nCREATE TABLE t1 (pk int primary key, a int, b int, c char(10), d decimal(10,\n3), 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| 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\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 (782,41,'Median Window Function','MariaDB starting with 10.3.3\n----------------------------\nThe MEDIAN() window function was first introduced with in MariaDB 10.3.3.\n\nSyntax\n------\n\nMEDIAN(median expression) OVER (\n [ PARTITION BY partition_expression ]\n)\n\nDescription\n-----------\n\nMEDIAN() is a window function that returns the median value of a range of\nvalues.\n\nIt is a specific case of PERCENTILE_CONT, with an argument of 0.5 and the\nORDER BY column the one in MEDIAN\'s argument.\n\nMEDIAN(<median-arg>) OVER ( [ PARTITION BY partition_expression] )\n\nIs equivalent to:\n\nPERCENTILE_CONT(0.5) WITHIN \n GROUP (ORDER BY <median-arg>) OVER ( [ PARTITION BY partition_expression ])\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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) FROM book_rating;\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\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 (783,41,'NTH_VALUE','Syntax\n------\n\nNTH_VALUE (expr[, num_row]) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nThe NTH_VALUE function returns the value evaluated at row number num_row of\nthe window frame, starting from 1, or NULL if the row does not exist.\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 (784,41,'NTILE','Syntax\n------\n\nNTILE (expr) OVER ( \n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nNTILE() is a window function that returns an integer indicating which group a\ngiven row falls into. The number of groups is specified in the argument\n(expr), starting at one. Ordered rows in the partition are divided into the\nspecified number of groups with as equal a size as possible.\n\nExamples\n--------\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| 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| 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\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 (785,41,'PERCENT_RANK','Syntax\n------\n\nPERCENT_RANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nPERCENT_RANK() is a window function that returns the relative percent rank of\na given row. The following formula is used to calculate the percent rank:\n\n(rank - 1) / (number of rows in the window or partition - 1)\n\nExamples\n--------\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| 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| 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 pct_rank,\n cume_dist() over (partition by a order by a) as cume_dist\nfrom t1;\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\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 (786,41,'PERCENTILE_CONT','MariaDB starting with 10.3.3\n----------------------------\nThe PERCENTILE_CONT() window function was first introduced with in MariaDB\n10.3.3.\n\nSyntax\n------\n\nDescription\n-----------\n\nPERCENTILE_CONT() (standing for continuous percentile) is a window function\nwhich returns a value which corresponds to the given fraction in the sort\norder. If required, it will interpolate between adjacent input items.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition, denoted by N\n* RN = p*(N-1), where p denotes the argument to the PERCENTILE_CONT function\n* calculate the FRN(floor row number) and CRN(column row number for the group(\nFRN= floor(RN) and CRN = ceil(RN))\n* look up rows FRN and CRN\n* If (CRN = FRN = RN) then the result is (value of expression from row at RN)\n* Otherwise 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, equivalent to\nPERCENTILE_CONT(0.5).\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc\n FROM book_rating;\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\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 (787,41,'PERCENTILE_DISC','MariaDB starting with 10.3.3\n----------------------------\nThe PERCENTILE_DISC() window function was first introduced with in MariaDB\n10.3.3.\n\nSyntax\n------\n\nDescription\n-----------\n\nPERCENTILE_DISC() (standing for discrete percentile) is a window function\nwhich returns the first value in the set whose ordered position is the same or\nmore than the specified fraction.\n\nEssentially, the following process is followed to find the value to return:\n\n* Get the number of rows in the partition.\n* Walk through the partition, in order, until finding the the first row with\nCUME_DIST() >= function_argument.\n\nExamples\n--------\n\nCREATE TABLE book_rating (name CHAR(30), star_rating TINYINT);\n\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 5);\nINSERT INTO book_rating VALUES (\'Lord of the Ladybirds\', 3);\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 star_rating)\n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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 star_rating) \n OVER (PARTITION BY name) AS pc FROM book_rating;\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\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 (788,41,'RANK','Syntax\n------\n\nRANK() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nRANK() is a window function that displays the number of a given row, starting\nat one and following the ORDER BY sequence of the window function, with\nidentical values receiving the same result. It is similar to the ROW_NUMBER()\nfunction except that in that function, identical values will receive a\ndifferent row number for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (789,41,'ROW_NUMBER','Syntax\n------\n\nROW_NUMBER() OVER (\n [ PARTITION BY partition_expression ]\n [ ORDER BY order_list ]\n)\n\nDescription\n-----------\n\nROW_NUMBER() is a window function that displays the number of a given row,\nstarting at one and following the ORDER BY sequence of the window function,\nwith identical values receiving different row numbers. It is similar to the\nRANK() and DENSE_RANK() functions except that in that function, identical\nvalues will receive the same rank for each result.\n\nExamples\n--------\n\nThe distinction between DENSE_RANK(), RANK() and ROW_NUMBER():\n\nCREATE TABLE student(course VARCHAR(10), mark int, name varchar(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 rank,\n DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,\n ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,\n course, mark, name\nFROM student ORDER BY course, mark DESC;\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\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 (790,41,'Aggregate Functions as Window Functions','It is possible to use aggregate functions as window functions. An aggregate\nfunction used as a window function must have the OVER clause. For example,\nhere\'s COUNT() used as a window function:\n\nselect COUNT(*) over (order by column) from table;\n\nMariaDB currently allows these aggregate functions to be used as window\nfunctions:\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* JSON_ARRAYAGG\n* JSON_OBJECTAGG\n* MAX\n* MIN\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nURL: https://mariadb.com/kb/en/aggregate-functions-as-window-functions/','','https://mariadb.com/kb/en/aggregate-functions-as-window-functions/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (791,41,'ColumnStore Window Functions','Introduction\n------------\n\nMariaDB ColumnStore provides support for window functions broadly following\nthe SQL 2003 specification. A window function allows for calculations relating\nto a window of data surrounding the current row in a result set. This\ncapability provides for simplified queries in support of common business\nquestions such as cumulative totals, rolling averages, and top 10 lists.\n\nAggregate functions are utilized for window functions however differ in\nbehavior from a group by query because the rows remain ungrouped. This\nprovides support for cumulative sums and rolling averages, for example.\n\nTwo key concepts for window functions are Partition and Frame:\n\n* A Partition is a group of rows, or window, that have the same value for a\nspecific column, for example a Partition can be created over a time period\nsuch as a quarter or lookup values.\n* The Frame for each row is a subset of the row\'s Partition. The frame\ntypically is dynamic allowing for a sliding frame of rows within the\nPartition. The Frame determines the range of rows for the windowing function.\nA Frame could be defined as the last X rows and next Y rows all the way up to\nthe entire Partition.\n\nWindow functions are applied after joins, group by, and having clauses are\ncalculated.\n\nSyntax\n------\n\nA window function is applied in the select clause using the following syntax:\n\nfunction_name ([expression [, expression ... ]]) OVER ( window_definition )\n\nwhere window_definition is defined as:\n\n[ PARTITION BY expression [, ...] ]\n[ ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] ]\n[ frame_clause ]\n\nPARTITION BY:\n\n* Divides the window result set into groups based on one or more expressions.\n* An expression may be a constant, column, and non window function expressions.\n* A query is not limited to a single partition by clause. Different partition\nclauses can be used across different window function applications.\n* The partition by columns do not need to be in the select list but do need to\nbe available from the query result set.\n* If there is no PARTITION BY clause, all rows of the result set define the\ngroup.\n\nORDER BY\n\n* Defines the ordering of values within the partition.\n* Can be ordered by multiple keys which may be a constant, column or non\nwindow function expression.\n* The order by columns do not need to be in the select list but need to be\navailable from the query result set.\n* Use of a select column alias from the query is not supported.\n* ASC (default) and DESC options allow for ordering ascending or descending.\n* NULLS FIRST and NULL_LAST options specify whether null values come first or\nlast in the ordering sequence. NULLS_FIRST is the default for ASC order, and\nNULLS_LAST is the default for DESC order.\n\nand the optional frame_clause is defined as:\n\n{ RANGE | ROWS } frame_start\n{ RANGE | ROWS } BETWEEN frame_start AND frame_end\n\nand the optional frame_start and frame_end are defined as (value being a\nnumeric expression):\n\nUNBOUNDED PRECEDING\nvalue PRECEDING\nCURRENT ROW\nvalue FOLLOWING\nUNBOUNDED FOLLOWING\n\nRANGE/ROWS:\n\n* Defines the windowing clause for calculating the set of rows that the\nfunction applies to for calculating a given rows window function result.\n* Requires an ORDER BY clause to define the row order for the window.\n* ROWS specify the window in physical units, i.e. result set rows and must be\na constant or expression evaluating to a positive numeric value.\n* RANGE specifies the window as a logical offset. If the the expression\nevaluates to a numeric value then the ORDER BY expression must be a numeric or\nDATE type. If the expression evaluates to an interval value then the ORDER BY\nexpression must be a DATE data type.\n* UNBOUNDED PRECEDING indicates the window starts at the first row of the\npartition.\n* UNBOUNDED FOLLOWING indicates the window ends at the last row of the\npartition.\n* CURRENT ROW specifies the window start or ends at the current row or value.\n* If omitted, the default is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.\n\nSupported Functions\n-------------------\n\n+--------------------------------+-------------------------------------------+\n| Function | Description |\n+--------------------------------+-------------------------------------------+\n| AVG() | The average of all input values. |\n+--------------------------------+-------------------------------------------+\n| COUNT() | Number of input rows. |\n+--------------------------------+-------------------------------------------+\n| CUME_DIST() | Calculates the cumulative distribution, |\n| | or relative rank, of the current row to |\n| | other rows in the same partition. Number |\n| | of peer or preceding rows / number of |\n| | rows in partition. |\n+--------------------------------+-------------------------------------------+\n| DENSE_RANK() | Ranks items in a group leaving no gaps |\n| | in ranking sequence when there are ties. |\n+--------------------------------+-------------------------------------------+\n| FIRST_VALUE() | The value evaluated at the row that is |\n| | the first row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| LAG() | The value evaluated at the row that is |\n| | offset rows before the current row |\n| | within the partition; if there is no |\n| | such row, instead return default. Both |\n| | offset and default are evaluated with |\n| | respect to the current row. If omitted, |\n| | offset defaults to 1 and default to |\n| | null. LAG provides access to more than |\n| | one row of a table at the same time |\n| | without a self-join. Given a series of |\n| | rows returned from a query and a |\n| | position of the cursor, LAG provides |\n| | access to a row at a given physical |\n| | offset prior to that position. |\n+--------------------------------+-------------------------------------------+\n| LAST_VALUE() | The value evaluated at the row that is |\n| | the last row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| LEAD() | Provides access to a row at a given |\n| | physical offset beyond that position. |\n| | Returns value evaluated at the row that |\n| | is offset rows after the current row |\n| | within the partition; if there is no |\n| | such row, instead return default. Both |\n| | offset and default are evaluated with |\n| | respect to the current row. If omitted, |\n| | offset defaults to 1 and default to null. |\n+--------------------------------+-------------------------------------------+\n| MAX() | Maximum value of expression across all |\n| | input values. |\n+--------------------------------+-------------------------------------------+\n| MEDIAN() | An inverse distribution function that |\n| | assumes a continuous distribution model. |\n| | It takes a numeric or datetime value and |\n| | returns the middle value or an |\n| | interpolated value that would be the |\n| | middle value once the values are sorted. |\n| | Nulls are ignored in the calculation. |\n+--------------------------------+-------------------------------------------+\n| MIN() | Minimum value of expression across all |\n| | input values. |\n+--------------------------------+-------------------------------------------+\n| NTH_VALUE() | The value evaluated at the row that is |\n| | the nth row of the window frame |\n| | (counting from 1); null if no such row. |\n+--------------------------------+-------------------------------------------+\n| NTILE() | Divides an ordered data set into a |\n| | number of buckets indicated by expr and |\n| | assigns the appropriate bucket number to |\n| | each row. The buckets are numbered 1 |\n| | through expr. The expr value must |\n| | resolve to a positive constant for each |\n| | partition. Integer ranging from 1 to the |\n| | argument value, dividing the partition |\n| | as equally as possible. |\n+--------------------------------+-------------------------------------------+\n| PERCENT_RANK() | relative rank of the current row: (rank |\n| | - 1) / (total rows - 1). |\n+--------------------------------+-------------------------------------------+\n| PERCENTILE_CONT() | An inverse distribution function that |\n| | assumes a continuous distribution model. |\n| | It takes a percentile value and a sort |\n| | specification, and returns an |\n| | interpolated value that would fall into |\n| | that percentile value with respect to |\n| | the sort specification. Nulls are |\n| | ignored in the calculation. |\n+--------------------------------+-------------------------------------------+\n| PERCENTILE_DISC() | An inverse distribution function that |\n| | assumes a discrete distribution model. |\n| | It takes a percentile value and a sort |\n| | specification and returns an element |\n| | from the set. Nulls are ignored in the |\n| | calculation. |\n+--------------------------------+-------------------------------------------+\n| RANK() | rank of the current row with gaps; same |\n| | as row_number of its first peer. |\n+--------------------------------+-------------------------------------------+\n| ROW_NUMBER() | number of the current row within its |\n| | partition, counting from 1 |\n+--------------------------------+-------------------------------------------+\n| STDDEV() STDDEV_POP() | Computes the population standard |\n| | deviation and returns the square root of |\n| | the population variance. |\n+--------------------------------+-------------------------------------------+\n| STDDEV_SAMP() | Computes the cumulative sample standard |\n| | deviation and returns the square root of |\n| | the sample variance. |\n+--------------------------------+-------------------------------------------+\n| SUM() | Sum of expression across all input |\n| | values. |\n+--------------------------------+-------------------------------------------+\n| VARIANCE() VAR_POP() | Population variance of the input values |\n| | (square of the population standard |\n| | deviation). |\n+--------------------------------+-------------------------------------------+\n| VAR_SAMP() | Sample variance of the input values |\n| | (square of the sample standard |\n| | deviation). |\n+--------------------------------+-------------------------------------------+\n\nExamples\n--------\n\nExample Schema\n--------------\n\nThe examples are all based on the following simplified sales opportunity table:\n\ncreate table opportunities (\nid int,\naccountName varchar(20),\nname varchar(128),\nowner varchar(7),\namount decimal(10,2),\ncloseDate date,\nstageName varchar(11)\n) engine=columnstore;\n\nSome example values are (thanks to https://www.mockaroo.com for sample data\ngeneration):\n\n+----+---------------+------+--------+---------+-------------+-------------+\n| id | accountName | name | owner | amount | closeDate | stageName |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 1 | Browseblab | Mult | Bob | 26444.8 | 2016-10-20 | Negotiating |','','https://mariadb.com/kb/en/window-functions-columnstore-window-functions/');
+update help_topic set description = CONCAT(description, '\n| | | -lat | | | | |\n| | | ral | | | | |\n| | | exec | | | | |\n| | | tive | | | | |\n| | | func | | | | |\n| | | ion | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 2 | Mita | Orga | Maria | 477878. | 2016-11-28 | ClosedWon |\n| | | ic | | 1 | | |\n| | | dema | | | | |\n| | | d-dr | | | | |\n| | | ven | | | | |\n| | | benc | | | | |\n| | | mark | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 3 | Miboo | De-e | Olivie | 80181.7 | 2017-01-05 | ClosedWon |\n| | | gine | | | | |\n| | | red | | | | |\n| | | hybr | | | | |\n| | | d | | | | |\n| | | grou | | | | |\n| | | ware | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 4 | Youbridge | Ente | Chris | 946245. | 2016-07-02 | ClosedWon |\n| | | pris | | 9 | | |\n| | | -wid | | | | |\n| | | | | | | |\n| | | bott | | | | |\n| | | m-li | | | | |\n| | | e | | | | |\n| | | Grap | | | | |\n| | | ic | | | | |\n| | | Inte | | | | |\n| | | face | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 5 | Skyba | Reve | Maria | 696241. | 2017-02-17 | Negotiating |\n| | | se-e | | 2 | | |\n| | | gine | | | | |\n| | | red | | | | |\n| | | fres | | | | |\n| | | -thi | | | | |\n| | | king | | | | |\n| | | stan | | | | |\n| | | ardi | | | | |\n| | | atio | | | | |\n| | | | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 6 | Eayo | Fund | Bob | 765605. | 2016-08-27 | Prospecting |\n| | | ment | | 2 | | |\n| | | l | | | | |\n| | | well | | | | |\n| | | modu | | | | |\n| | | ated | | | | |\n| | | arti | | | | |\n| | | icia | | | | |\n| | | | | | | |\n| | | inte | | | | |\n| | | lige | | | | |\n| | | ce | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 7 | Yotz | Exte | Chris | 319624. | 2017-01-06 | ClosedLost |\n| | | ded | | 0 | | |\n| | | seco | | | | |\n| | | dary | | | | |\n| | | infr | | | | |\n| | | stru | | | | |\n| | | ture | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 8 | Oloo | Conf | Chris | 321016. | 2017-03-08 | ClosedLost |\n| | | gura | | 6 | | |\n| | | le | | | | |\n| | | web- | | | | |\n| | | nabl | | | | |\n| | | d | | | | |\n| | | data | | | | |\n| | | ware | | | | |\n| | | ouse | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 9 | Kaymbo | Mult | Bob | 690881. | 2017-01-02 | Developing |\n| | | -lat | | 1 | | |\n| | | ral | | | | |\n| | | web- | | | | |\n| | | nabl | | | | |\n| | | d | | | | |\n| | | defi | | | | |\n| | | itio | | | | |\n| | | | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n| 10 | Rhyloo | Publ | Chris | 965477. | 2016-11-07 | Prospecting |\n| | | c-ke | | 4 | | |\n| | | | | | | |\n| | | cohe | | | | |\n| | | ent | | | | |\n| | | infr | | | | |\n| | | stru | | | | |\n| | | ture | | | | |\n+----+---------------+------+--------+---------+-------------+-------------+\n\nThe schema, sample data, and queries are available as an attachment to this\narticle.\n\nCumulative Sum and Running Max Example\n--------------------------------------\n\nWindow functions can be used to achieve cumulative / running calculations on a\ndetail report. In this case a won opportunity report for a 7 day period adds\ncolumns to show the accumulated won amount as well as the current highest\nopportunity amount in preceding rows.\n\nselect owner, \naccountName, \nCloseDate, \namount, \nsum(amount) over (order by CloseDate rows between unbounded preceding and\ncurrent row) cumeWon, \nmax(amount) over (order by CloseDate rows between unbounded preceding and\ncurrent row) runningMax\nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by CloseDate;\n\nwith example results:\n\n+--------+---------------+-------------+---------+----------+--------------+\n| owner | accountName | CloseDate | amount | cumeWon | runningMax |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.4 | 437636.47 |\n| | | | 7 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 583722.9 | 437636.47 |\n| | | | 1 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 1417958. | 834235.93 |\n| | | | 3 | 1 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 2458738. | 834235.93 |\n| | | | 5 | 5 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 1918761. | 834235.93 |\n| | | | 9 | 0 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Latz | 2016-10-08 | 857254. | 3315993. | 857254.87 |\n| | | | 7 | 2 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 4015560. | 857254.87 |\n| | | | 6 | 8 | |\n+--------+---------------+-------------+---------+----------+--------------+\n\nPartitioned Cumulative Sum and Running Max Example\n--------------------------------------------------\n\nThe above example can be partitioned, so that the window functions are over a\nparticular field grouping such as owner and accumulate within that grouping.\nThis is achieved by adding the syntax \"partition by <columns>\" in the window\nfunction clause.\n\nselect owner, \naccountName, \nCloseDate, \namount, \nsum(amount) over (partition by owner order by CloseDate rows between unbounded\npreceding and current row) cumeWon, \nmax(amount) over (partition by owner order by CloseDate rows between unbounded\npreceding and current row) runningMax \nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by owner, CloseDate;\n\nwith example results:\n\n+--------+---------------+-------------+---------+----------+--------------+\n| owner | accountName | CloseDate | amount | cumeWon | runningMax |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.4 | 437636.47 |\n| | | | 7 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 583722.9 | 437636.47 |\n| | | | 1 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Bill | Latz | 2016-10-08 | 857254. | 1440977. | 857254.87 |\n| | | | 7 | 5 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 539977.4 | 539977.45 |\n| | | | 5 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 1239544. | 699566.86 |\n| | | | 6 | 1 | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 834235.9 | 834235.93 |\n| | | | 3 | | |\n+--------+---------------+-------------+---------+----------+--------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 1335038. | 834235.93 |\n| | | | 9 | 2 | |\n+--------+---------------+-------------+---------+----------+--------------+\n\nRanking / Top Results\n---------------------\n\nThe rank window function allows for ranking or assigning a numeric order value\nbased on the window function definition. Using the Rank() function will result\nin the same value for ties / equal values and the next rank value skipped. The\nDense_Rank() function behaves similarly except the next consecutive number is\nused after a tie rather than skipped. The Row_Number() function will provide a\nunique ordering value. The example query shows the Rank() function being\napplied to rank sales reps by the number of opportunities for Q4 2016.\n\nselect owner, \nwonCount, \nrank() over (order by wonCount desc) rank \nfrom (\n select owner,\n count(*) wonCount\n from opportunities\n where stageName=\'ClosedWon\'\n and closeDate >= \'2016-10-01\' and closeDate < \'2016-12-31\'\n group by owner\n) t\norder by rank;\n\nwith example results (note the query is technically incorrect by using\ncloseDate < \'2016-12-31\' however this creates a tie scenario for illustrative\npurposes):\n\n+----------------------+----------------------------------+------------------+\n| owner | wonCount | rank |\n+----------------------+----------------------------------+------------------+\n| Bill | 19 | 1 |\n+----------------------+----------------------------------+------------------+\n| Chris | 15 | 2 |') WHERE help_topic_id = 791;
+update help_topic set description = CONCAT(description, '\n+----------------------+----------------------------------+------------------+\n| Maria | 14 | 3 |\n+----------------------+----------------------------------+------------------+\n| Bob | 14 | 3 |\n+----------------------+----------------------------------+------------------+\n| Olivier | 10 | 5 |\n+----------------------+----------------------------------+------------------+\n\nIf the dense_rank function is used the rank values would be 1,2,3,3,4 and for\nthe row_number function the values would be 1,2,3,4,5.\n\nFirst and Last Values\n---------------------\n\nThe first_value and last_value functions allow determining the first and last\nvalues of a given range. Combined with a group by this allows summarizing\nopening and closing values. The example shows a more complex case where\ndetailed information is presented for first and last opportunity by quarter.\n\nselect a.year, \na.quarter, \nf.accountName firstAccountName, \nf.owner firstOwner, \nf.amount firstAmount, \nl.accountName lastAccountName, \nl.owner lastOwner, \nl.amount lastAmount \nfrom (\n select year,\n quarter,\n min(firstId) firstId,\n min(lastId) lastId\n from (\n select year(closeDate) year,\n quarter(closeDate) quarter,\n first_value(id) over (partition by year(closeDate), quarter(closeDate)\norder by closeDate rows between unbounded preceding and current row) firstId, \n last_value(id) over (partition by year(closeDate), quarter(closeDate)\norder by closeDate rows between current row and unbounded following) lastId \n from opportunities where stageName=\'ClosedWon\'\n ) t\n group by year, quarter order by year,quarter\n) a \njoin opportunities f on a.firstId = f.id \njoin opportunities l on a.lastId = l.id \norder by year, quarter;\n\nwith example results:\n\n+----+------+------------+--------+---------+-----------+-------+--------+\n| ye | quar | firstAccou | firstO | firstAm | lastAccou | lastO | lastAm |\n| r | er | tName | ner | unt | tName | ner | unt |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 3 | Skidoo | Bill | 523295. | Skipstorm | Bill | 151420 |\n| 6 | | | | 7 | | | 86 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 4 | Skimia | Chris | 961513. | Avamm | Maria | 112493 |\n| 6 | | | | 9 | | | 65 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n| 20 | 1 | Yombu | Bob | 536875. | Skaboo | Chris | 270273 |\n| 7 | | | | 1 | | | 08 |\n+----+------+------------+--------+---------+-----------+-------+--------+\n\nPrior and Next Example\n----------------------\n\nSometimes it useful to understand the previous and next values in the context\nof a given row. The lag and lead window functions provide this capability. By\ndefault the offset is one providing the prior or next value but can also be\nprovided to get a larger offset. The example query is a report of\nopportunities by account name showing the opportunity amount, and the prior\nand next opportunity amount for that account by close date.\n\nselect accountName, \ncloseDate, \namount currentOppAmount, \nlag(amount) over (partition by accountName order by closeDate) priorAmount,\nlead(amount) over (partition by accountName order by closeDate) nextAmount \nfrom opportunities \norder by accountName, closeDate \nlimit 9;\n\nwith example results:\n\n+--------------+-----------+-------------------+--------------+-------------+\n| accountName | closeDate | currentOppAmount | priorAmount | nextAmount |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-09-1 | 645098.45 | NULL | 161086.82 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-10-1 | 161086.82 | 645098.45 | 350235.75 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-12-1 | 350235.75 | 161086.82 | 878595.89 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2016-12-3 | 878595.89 | 350235.75 | 922322.39 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abata | 2017-01-2 | 922322.39 | 878595.89 | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Abatz | 2016-10-1 | 795424.15 | NULL | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-07-0 | 288974.84 | NULL | 914461.49 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-09-0 | 914461.49 | 288974.84 | 176645.52 |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n| Agimba | 2016-09-2 | 176645.52 | 914461.49 | NULL |\n| | | | | |\n+--------------+-----------+-------------------+--------------+-------------+\n\nQuartiles Example\n-----------------\n\nThe NTile window function allows for breaking up a data set into portions\nassigned a numeric value to each portion of the range. NTile(4) breaks the\ndata up into quartiles (4 sets). The example query produces a report of all\nopportunities summarizing the quartile boundaries of amount values.\n\nselect t.quartile, \nmin(t.amount) min, \nmax(t.amount) max \nfrom (\n select amount,\n ntile(4) over (order by amount asc) quartile\n from opportunities\n where closeDate >= \'2016-10-01\' and closeDate <= \'2016-12-31\'\n ) t\ngroup by quartile \norder by quartile;\n\nWith example results:\n\n+-----------------------------------------+----------------+----------------+\n| quartile | min | max |\n+-----------------------------------------+----------------+----------------+\n| 1 | 6337.15 | 287634.01 |\n+-----------------------------------------+----------------+----------------+\n| 2 | 288796.14 | 539977.45 |\n+-----------------------------------------+----------------+----------------+\n| 3 | 540070.04 | 748727.51 |\n+-----------------------------------------+----------------+----------------+\n| 4 | 753670.77 | 998864.47 |\n+-----------------------------------------+----------------+----------------+\n\nPercentile Example\n------------------\n\nThe percentile functions have a slightly different syntax from other window\nfunctions as can be seen in the example below. These functions can be only\napplied against numeric values. The argument to the function is the percentile\nto evaluate. Following \'within group\' is the sort expression which indicates\nthe sort column and optionally order. Finally after \'over\' is an optional\npartition by clause, for no partition clause use \'over ()\'. The example below\nutilizes the value 0.5 to calculate the median opportunity amount in the rows.\nThe values differ sometimes because percentile_cont will return the average of\nthe 2 middle rows for an even data set while percentile_desc returns the first\nencountered in the sort.\n\nselect owner, \naccountName, \nCloseDate, \namount,\npercentile_cont(0.5) within group (order by amount) over (partition by owner)\npct_cont,\npercentile_disc(0.5) within group (order by amount) over (partition by owner)\npct_disc\nfrom opportunities \nwhere stageName=\'ClosedWon\' \nand closeDate >= \'2016-10-02\' and closeDate <= \'2016-10-09\' \norder by owner, CloseDate;\n\nWith example results:\n\n+--------+----------------+-------------+---------+------------+------------+\n| owner | accountName | CloseDate | amount | pct_cont | pct_disc |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Babbleopia | 2016-10-02 | 437636. | 437636.470 | 437636.47 |\n| | | | 7 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Thoughtworks | 2016-10-04 | 146086. | 437636.470 | 437636.47 |\n| | | | 1 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Bill | Latz | 2016-10-08 | 857254. | 437636.470 | 437636.47 |\n| | | | 7 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Chris | Linkbridge | 2016-10-07 | 539977. | 619772.155 | 539977.45 |\n| | | | 5 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Chris | Avamm | 2016-10-09 | 699566. | 619772.155 | 539977.45 |\n| | | | 6 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Olivie | Devpulse | 2016-10-05 | 834235. | 667519.110 | 500802.29 |\n| | | | 3 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n| Olivie | Trupe | 2016-10-07 | 500802. | 667519.110 | 500802.29 |\n| | | | 9 | 000000 | |\n+--------+----------------+-------------+---------+------------+------------+\n\nURL: https://mariadb.com/kb/en/window-functions-columnstore-window-functions/') WHERE help_topic_id = 791;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (792,41,'Window Frames','Syntax\n------\n\nframe_clause:\n {ROWS | RANGE} {frame_border | BETWEEN frame_border AND frame_border}\n\nframe_border:\n | UNBOUNDED PRECEDING\n | UNBOUNDED FOLLOWING\n | CURRENT ROW\n | expr PRECEDING\n | expr FOLLOWING\n\nDescription\n-----------\n\nA basic overview of window functions is described in Window Functions\nOverview. Window frames expand this functionality by allowing the function to\ninclude a specified a number of rows around the current row.\n\nThese include:\n\n* All rows before the current row (UNBOUNDED PRECEDING), for example RANGE\nBETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n* All rows after the current row (UNBOUNDED FOLLOWING), for example RANGE\nBETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING\n* A set number of rows before the current row (expr PRECEDING) for example\nRANGE BETWEEN 6 PRECEDING AND CURRENT ROW\n* A set number of rows after the current row (expr PRECEDING AND expr\nFOLLOWING) for example RANGE BETWEEN CURRENT ROW AND 2 FOLLOWING\n* A specified number of rows both before and after the current row, for\nexample RANGE BETWEEN 6 PRECEDING AND 3 FOLLOWING\n\nThe following functions operate on window frames:\n\n* AVG\n* BIT_AND\n* BIT_OR\n* BIT_XOR\n* COUNT\n* LEAD\n* MAX\n* MIN\n* NTILE\n* STD\n* STDDEV\n* STDDEV_POP\n* STDDEV_SAMP\n* SUM\n* VAR_POP\n* VAR_SAMP\n* VARIANCE\n\nWindow frames are determined by the frame_clause in the window function\nrequest.\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| 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 clause, the SUM function is run over the entire\ndataset. However, if we specify an ORDER BY condition based on score (and\norder the entire result in the same way for clarity), the following result is\nreturned:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score) AS total_score\n FROM student_test ORDER BY score;\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 current row, and all\nprevious rows. The window frame in this example expands as the function\nproceeds.\n\nThe above query makes use of the default to define the window frame. It could\nbe written explicitly as follows:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS\ntotal_score \n FROM student_test ORDER BY score;\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 all following\nrows can be done with the use of UNBOUNDED FOLLOWING:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS\ntotal_score \n FROM student_test ORDER BY score;\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 entire unbounded\nfollowing or preceding set. The following example takes the current row, as\nwell as the previous row:\n\nSELECT name, test, score, SUM(score) \n OVER (ORDER BY score ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS\ntotal_score \n FROM student_test ORDER BY score;\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 FOLLOWING) AS\ntotal_score \n FROM student_test ORDER BY score;\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\nURL: https://mariadb.com/kb/en/window-frames/','','https://mariadb.com/kb/en/window-frames/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (793,42,'SPIDER_BG_DIRECT_SQL','Syntax\n------\n\nSPIDER_BG_DIRECT_SQL(\'sql\', \'tmp_table_list\', \'parameters\')\n\nDescription\n-----------\n\nExecutes the given SQL statement in the background on the remote server, as\ndefined in the parameters listing. If the query returns a result-set, it\nsttores the results in the given temporary table. When the given SQL statement\nexecutes successfully, this function returns the number of called UDF\'s. It\nreturns 0 when the given SQL statement fails.\n\nThis function is a UDF installed with the Spider storage engine.\n\nExamples\n--------\n\nSELECT SPIDER_BG_DIRECT_SQL(\'SELECT * FROM example_table\', \'\', \n \'srv \"node1\", port \"8607\"\') AS \"Direct Query\";\n+--------------+\n| Direct Query | \n+--------------+\n| 1 |\n+--------------+\n\nParameters\n----------\n\nerror_rw_mode\n-------------\n\n* Description: Returns empty results on network error.\n0 : Return error on getting network error.\n1: Return 0 records on getting network error.\n\n* Default Table Value: 0\n* DSN Parameter Name: erwm\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 (794,42,'SPIDER_COPY_TABLES','Syntax\n------\n\nSPIDER_COPY_TABLES(spider_table_name, \n source_link_id, destination_link_id_list [,parameters])\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function copies table\ndata from source_link_id to destination_link_id_list. The service does not\nneed to be stopped in order to copy.\n\nIf the Spider table is partitioned, the name must be of the format\ntable_name#P#partition_name. The partition name can be viewed in the\nmysql.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 copying the data failed.\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 (795,42,'SPIDER_DIRECT_SQL','Syntax\n------\n\nSPIDER_DIRECT_SQL(\'sql\', \'tmp_table_list\', \'parameters\')\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function is used to\nexecute the SQL string sql on the remote server, as defined in parameters. If\nany resultsets are returned, they are stored in the tmp_table_list.\n\nThe function returns 1 if the SQL executes successfully, or 0 if it fails.\n\nExamples\n--------\n\nSELECT SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv \"node1\", port \"8607\"\');\n+----------------------------------------------------------------------+\n| SPIDER_DIRECT_SQL(\'SELECT * FROM s\', \'\', \'srv \"node1\", port \"8607\"\') |\n+----------------------------------------------------------------------+\n| 1 |\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 (796,42,'SPIDER_FLUSH_TABLE_MON_CACHE','Syntax\n------\n\nSPIDER_FLUSH_TABLE_MON_CACHE()\n\nDescription\n-----------\n\nA UDF installed with the Spider Storage Engine, this function is used for\nrefreshing monitoring server information. It returns a value of 1.\n\nExamples\n--------\n\nSELECT SPIDER_FLUSH_TABLE_MON_CACHE();\n+--------------------------------+\n| SPIDER_FLUSH_TABLE_MON_CACHE() |\n+--------------------------------+\n| 1 |\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 (797,43,'COLUMN_ADD','Syntax\n------\n\nCOLUMN_ADD(dyncol_blob, column_nr, value [as type], [column_nr, value [as\ntype]]...);\nCOLUMN_ADD(dyncol_blob, column_name, value [as type], [column_name, value [as\ntype]]...);\n\nDescription\n-----------\n\nAdds or updates dynamic columns.\n\n* dyncol_blob must be either a valid dynamic columns blob (for example,\nCOLUMN_CREATE returns such blob), or an empty string.\n* column_name specifies the name of the column to be added. If dyncol_blob\nalready has a column with this name, it will be overwritten.\n* value specifies the new value for the column. Passing a NULL value will\ncause the column to be deleted.\n* as type is optional. See #datatypes section for a discussion about types.\n\nThe return value is a dynamic column blob after the modifications.\n\nExamples\n--------\n\nUPDATE t1 SET dyncol_blob=COLUMN_ADD(dyncol_blob, \"column_name\", \"value\")\nWHERE id=1;\n\nNote: COLUMN_ADD() is a regular function (just like CONCAT()), hence, in order\nto update the value in the table you have to use the UPDATE ... SET\ndynamic_col=COLUMN_ADD(dynamic_col, ....) pattern.\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 (798,43,'COLUMN_CHECK','Syntax\n------\n\nCOLUMN_CHECK(dyncol_blob);\n\nDescription\n-----------\n\nCheck if dyncol_blob is a valid packed dynamic columns blob. Return value of 1\nmeans the blob is valid, return value of 0 means it is not.\n\nRationale: Normally, one works with valid dynamic column blobs. Functions like\nCOLUMN_CREATE, COLUMN_ADD, COLUMN_DELETE always return valid dynamic column\nblobs. However, if a dynamic column blob is accidentally truncated, or\ntranscoded from one character set to another, it will be corrupted. This\nfunction can be used to check if a value in a blob field is a valid dynamic\ncolumn blob.\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 (799,43,'COLUMN_CREATE','Syntax\n------\n\nCOLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]]...);\nCOLUMN_CREATE(column_name, value [as type], [column_name, value [as type]]...);\n\nDescription\n-----------\n\nReturns a dynamic columns blob that stores the specified columns with values.\n\nThe return value is suitable for\n\n* storing in a table\n* further modification with other dynamic columns functions\n\nThe as type part allows one to specify the value type. In most cases, this is\nredundant because MariaDB will be able to deduce the type of the value.\nExplicit type specification may be needed when the type of the value is not\napparent. For example, a literal \'2012-12-01\' has a CHAR type by default, one\nwill need to specify \'2012-12-01\' AS DATE to have it stored as a date. See\nDynamic Columns:Datatypes for further details.\n\nExamples\n--------\n\nINSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(\"column_name\", \"value\");\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 (800,43,'COLUMN_DELETE','Syntax\n------\n\nCOLUMN_DELETE(dyncol_blob, column_nr, column_nr...);\nCOLUMN_DELETE(dyncol_blob, column_name, column_name...);\n\nDescription\n-----------\n\nDeletes a dynamic column with the specified name. Multiple names can be given.\nThe return value is a dynamic column blob after the modification.\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 (801,43,'COLUMN_EXISTS','Syntax\n------\n\nCOLUMN_EXISTS(dyncol_blob, column_nr);\nCOLUMN_EXISTS(dyncol_blob, column_name);\n\nDescription\n-----------\n\nChecks if a column with name column_name exists in dyncol_blob. If yes, return\n1, otherwise return 0. See dynamic columns for more information.\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 (802,43,'COLUMN_GET','Syntax\n------\n\nCOLUMN_GET(dyncol_blob, column_nr as type);\nCOLUMN_GET(dyncol_blob, column_name as type);\n\nDescription\n-----------\n\nGets the value of a dynamic column by its name. If no column with the given\nname exists, NULL will be returned.\n\ncolumn_name as type requires that one specify the datatype of the dynamic\ncolumn they are reading.\n\nThis may seem counter-intuitive: why would one need to specify which datatype\nthey\'re retrieving? Can\'t the dynamic columns system figure the datatype from\nthe data being stored?\n\nThe answer is: SQL is a statically-typed language. The SQL interpreter needs\nto know the datatypes of all expressions before the query is run (for example,\nwhen one is using prepared statements and runs \"select COLUMN_GET(...)\", the\nprepared statement API requires the server to inform the client about the\ndatatype of the column being read before the query is executed and the server\ncan see what datatype the column actually has).\n\nLengths\n-------\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, not as CHAR(n)),\nMariaDB will report the maximum length of the resultset column to be\n16,777,216. This may cause excessive memory usage in some client libraries,\nbecause they try to pre-allocate a buffer of maximum resultset width. To avoid\nthis problem, use CHAR(n) whenever you\'re using COLUMN_GET in the select list.\n\nSee Dynamic Columns:Datatypes for more information about datatypes.\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 (803,43,'COLUMN_JSON','Syntax\n------\n\nCOLUMN_JSON(dyncol_blob)\n\nDescription\n-----------\n\nReturns a JSON representation of data in dyncol_blob. Can also be used to\ndisplay nested columns. See dynamic columns for more information.\n\nExample\n-------\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 years\"} |\n+-----------------+----------------------------------------+\n\nLimitation: COLUMN_JSON will decode nested dynamic columns at a nesting level\nof not more than 10 levels deep. Dynamic columns that are nested deeper than\n10 levels will be shown as BINARY string, without encoding.\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 (804,43,'COLUMN_LIST','Syntax\n------\n\nCOLUMN_LIST(dyncol_blob);\n\nDescription\n-----------\n\nReturns a comma-separated list of column names. The names are quoted with\nbackticks.\n\nSee dynamic columns for more information.\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 (805,44,'WSREP_LAST_SEEN_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_LAST_SEEN_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_LAST_SEEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction\nobserved by the client.\n\nThe result can be useful to determine the transaction to provide to\nWSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking purposes.\n\nURL: https://mariadb.com/kb/en/wsrep_last_seen_gtid/','','https://mariadb.com/kb/en/wsrep_last_seen_gtid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (806,44,'WSREP_LAST_WRITTEN_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_LAST_WRITTEN_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_LAST_WRITTEN_GTID()\n\nDescription\n-----------\n\nReturns the Global Transaction ID of the most recent write transaction\nperformed by the client.\n\nURL: https://mariadb.com/kb/en/wsrep_last_written_gtid/','','https://mariadb.com/kb/en/wsrep_last_written_gtid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (807,44,'WSREP_SYNC_WAIT_UPTO_GTID','MariaDB starting with 10.4.2\n----------------------------\nWSREP_SYNC_WAIT_UPTO_GTID was added as part of Galera 4 in MariaDB 10.4.2.\n\nSyntax\n------\n\nWSREP_SYNC_WAIT_UPTO_GTID(gtid[,timeout])\n\nDescription\n-----------\n\nBlocks the client until the transaction specified by the given Global\nTransaction ID is applied and committed by the node.\n\nThe optional timeout argument can be used to specify a block timeout in\nseconds. If not provided, the timeout will be indefinite.\n\nReturns the node that applied and committed the Global Transaction ID,\nER_LOCAL_WAIT_TIMEOUT if the function is timed out before this, or\nER_WRONG_ARGUMENTS if the function is given an invalid GTID.\n\nThe result from WSREP_LAST_SEEN_GTID can be useful to determine the\ntransaction to provide to WSREP_SYNC_WAIT_UPTO_GTID for waiting and unblocking\npurposes.\n\nURL: https://mariadb.com/kb/en/wsrep_sync_wait_upto_gtid/','','https://mariadb.com/kb/en/wsrep_sync_wait_upto_gtid/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (808,45,'System-Versioned Tables','MariaDB supports temporal data tables in the form of system-versioning tables\n(allowing you to query and operate on historic data, discussed below),\napplication-time periods (allow you to query and operate on a temporal range\nof data), and bitemporal tables (which combine both system-versioning and\napplication-time periods).\n\nSystem-Versioned Tables\n-----------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nSupport for system-versioned tables was added in MariaDB 10.3.4.\n\nSystem-versioned tables store the history of all changes, not only data which\nis currently valid. This allows data analysis for any point in time, auditing\nof changes and comparison of data from different points in time. Typical uses\ncases are:\n\n* Forensic analysis & legal requirements to store data for N years.\n* Data analytics (retrospective, trends etc.), e.g. to get your staff\ninformation as of one year ago.\n* Point-in-time recovery - recover a table state as of particular point in\ntime.\n\nSystem-versioned tables were first introduced in the SQL:2011 standard.\n\nCreating a System-Versioned Table\n---------------------------------\n\nThe CREATE TABLE syntax has been extended to permit creating a\nsystem-versioned table. To be system-versioned, according to SQL:2011, a table\nmust have two generated columns, a period, and a special table option clause:\n\nCREATE TABLE t(\n x INT,\n start_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n end_timestamp TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME(start_timestamp, end_timestamp)\n) WITH SYSTEM VERSIONING;\n\nIn MariaDB one can also use a simplified syntax:\n\nCREATE TABLE t (\n x INT\n) WITH SYSTEM VERSIONING;\n\nIn the latter case no extra columns will be created and they won\'t clutter the\noutput of, say, SELECT * FROM t. The versioning information will still be\nstored, and it can be accessed via the pseudo-columns ROW_START and ROW_END:\n\nSELECT x, ROW_START, ROW_END FROM t;\n\nAdding or Removing System Versioning To/From a Table\n----------------------------------------------------\n\nAn existing table can be altered to enable system versioning for it.\n\nCREATE TABLE t(\n x INT\n);\n\nALTER TABLE t ADD SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n\nSimilarly, system versioning can be removed from a table:\n\nALTER TABLE t DROP SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nOne can also add system versioning with all columns created explicitly:\n\nALTER TABLE t ADD COLUMN ts TIMESTAMP(6) GENERATED ALWAYS AS ROW START,\n ADD COLUMN te TIMESTAMP(6) GENERATED ALWAYS AS ROW END,\n ADD PERIOD FOR SYSTEM_TIME(ts, te),\n ADD SYSTEM VERSIONING;\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\n Table: t\nCreate Table: CREATE TABLE `t` (\n `x` int(11) DEFAULT NULL,\n `ts` timestamp(6) GENERATED ALWAYS AS ROW START,\n `te` timestamp(6) GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME (`ts`, `te`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING\n\nQuerying Historical Data\n------------------------\n\nSELECT\n------\n\nTo query the historical data one uses the clause FOR SYSTEM_TIME directly\nafter the table name (before the table alias, if any). SQL:2011 provides three\nsyntactic extensions:\n\n* AS OF is used to see the table as it was at a specific point in time in the\npast:\n\nSELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09 08:07:06\';\n\n* BETWEEN start AND end will show all rows that were visible at any point\nbetween two specified points in time. It works inclusively, a row visible\nexactly at start or exactly at end will be shown too.\n\nSELECT * FROM t FOR SYSTEM_TIME BETWEEN (NOW() - INTERVAL 1 YEAR) AND NOW();\n\n* FROM start TO end will also show all rows that were visible at any point\nbetween two specified points in time, including start, but excluding end.\n\nSELECT * FROM t FOR SYSTEM_TIME FROM \'2016-01-01 00:00:00\' TO \'2017-01-01\n00:00:00\';\n\nAdditionally MariaDB implements a non-standard extension:\n\n* ALL will show all rows, historical and current.\n\nSELECT * FROM t FOR SYSTEM_TIME ALL;\n\nIf the FOR SYSTEM_TIME clause is not used, the table will show the current\ndata, as if one had specified FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP.\n\nViews and Subqueries\n--------------------\n\nWhen a system-versioned tables is used in a view or in a subquery in the from\nclause, FOR SYSTEM_TIME can be used directly in the view or subquery body, or\n(non-standard) applied to the whole view when it\'s being used in a SELECT:\n\nCREATE VIEW v1 AS SELECT * FROM t FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09\n08:07:06\';\n\nOr\n\nCREATE VIEW v1 AS SELECT * FROM t;\nSELECT * FROM v1 FOR SYSTEM_TIME AS OF TIMESTAMP\'2016-10-09 08:07:06\';\n\nUse in Replication and Binary Logs\n----------------------------------\n\nTables that use system-versioning implicitly add the row_end column to the\nPrimary Key. While this is generally not an issue for most use cases, it can\nlead to problems when re-applying write statements from the binary log or in\nreplication environments, where a primary retries an SQL statement on the\nreplica.\n\nSpecifically, these writes include a value on the row_end column containing\nthe timestamp from when the write was initially made. The re-occurrence of the\nPrimary Key with the old system-versioning columns raises an error due to the\nduplication.\n\nTo mitigate this with MariaDB Replication, set the secure_timestamp system\nvariable to YES on the replica. When set, the replica uses its own system\nclock when applying to the row log, meaning that the primary can retry as many\ntimes as needed without causing a conflict. The retries generate new\nhistorical rows with new values for the row_start and row_end columns.\n\nTransaction-Precise History in InnoDB\n-------------------------------------\n\nA point in time when a row was inserted or deleted does not necessarily mean\nthat a change became visible at the same moment. With transactional tables, a\nrow might have been inserted in a long transaction, and became visible hours\nafter it was inserted.\n\nFor some applications — for example, when doing data analytics on one-year-old\ndata — this distinction does not matter much. For others — forensic analysis —\nit might be crucial.\n\nMariaDB supports transaction-precise history (only for the InnoDB storage\nengine) that allows seeing the data exactly as it would\'ve been seen by a new\nconnection doing a SELECT at the specified point in time — rows inserted\nbefore that point, but committed after will not be shown.\n\nTo use transaction-precise history, InnoDB needs to remember not timestamps,\nbut transaction identifier per row. This is done by creating generated columns\nas BIGINT UNSIGNED, not TIMESTAMP(6):\n\nCREATE TABLE t(\n x INT,\n start_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW START,\n end_trxid BIGINT UNSIGNED GENERATED ALWAYS AS ROW END,\n PERIOD FOR SYSTEM_TIME(start_trxid, end_trxid)\n) WITH SYSTEM VERSIONING;\n\nThese columns must be specified explicitly, but they can be made INVISIBLE to\navoid cluttering SELECT * output.\n\nWhen one uses transaction-precise history, one can optionally use transaction\nidentifiers in the FOR SYSTEM_TIME clause:\n\nSELECT * FROM t FOR SYSTEM_TIME AS OF TRANSACTION 12345;\n\nThis will show the data, exactly as it was seen by the transaction with the\nidentifier 12345.\n\nStoring the History Separately\n------------------------------\n\nWhen the history is stored together with the current data, it increases the\nsize of the table, so current data queries — table scans and index searches —\nwill take more time, because they will need to skip over historical data. If\nmost queries on that table use only current data, it might make sense to store\nthe history separately, to reduce the overhead from versioning.\n\nThis is done by partitioning the table by SYSTEM_TIME. Because of the\npartition pruning optimization, all current data queries will only access one\npartition, the one that stores current data.\n\nThis example shows how to create such a partitioned table:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME (\n PARTITION p_hist HISTORY,\n PARTITION p_cur CURRENT\n );\n\nIn this example all history will be stored in the partition p_hist while all\ncurrent data will be in the partition p_cur. The table must have exactly one\ncurrent partition and at least one historical partition.\n\nPartitioning by SYSTEM_TIME also supports automatic partition rotation. One\ncan rotate historical partitions by time or by size. This example shows how to\nrotate partitions by size:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME LIMIT 100000 (\n PARTITION p0 HISTORY,\n PARTITION p1 HISTORY,\n PARTITION pcur CURRENT\n );\n\nMariaDB will start writing history rows into partition p0, and when it reaches\na size of 100000 rows, MariaDB will switch to partition p1. There are only two\nhistorical partitions, so when p1 overflows, MariaDB will issue a warning, but\nwill continue writing into it.\n\nSimilarly, one can rotate partitions by time:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 WEEK (\n PARTITION p0 HISTORY,\n PARTITION p1 HISTORY,\n PARTITION p2 HISTORY,\n PARTITION pcur CURRENT\n );\n\nThis means that the history for the first week after the table was created\nwill be stored in p0. The history for the second week — in p1, and all later\nhistory will go into p2. One can see the exact rotation time for each\npartition in the INFORMATION_SCHEMA.PARTITIONS table.\n\nIt is possible to combine partitioning by SYSTEM_TIME and subpartitions:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME\n SUBPARTITION BY KEY (x)\n SUBPARTITIONS 4 (\n PARTITION ph HISTORY,\n PARTITION pc CURRENT\n );\n\nDefault Partitions\n------------------\n\nMariaDB starting with 10.5.0\n----------------------------\nSince partitioning by current and historical data is such a typical usecase,\nfrom MariaDB 10.5, it is possible to use a simplified statement to do so. For\nexample, instead of\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME (\n PARTITION p0 HISTORY,\n PARTITION pn CURRENT\n);\n\nyou can use\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME;\n\nYou can also specify the number of partitions, which is useful if you want to\nrotate history by time, for example:\n\nCREATE TABLE t (x INT) WITH SYSTEM VERSIONING \n PARTITION BY SYSTEM_TIME\n INTERVAL 1 MONTH\n PARTITIONS 12;\n\nSpecifying the number of partitions without specifying a rotation condition\nwill result in a warning:\n\nCREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME PARTITIONS 12;\nQuery OK, 0 rows affected, 1 warning (0.518 sec)\n\nWarning (Code 4115): Maybe missing parameters: no rotation condition for\nmultiple HISTORY partitions.\n\nwhile specifying only 1 partition will result in an error:\n\nCREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME PARTITIONS 1;\nERROR 4128 (HY000): Wrong partitions for `t`: must have at least one HISTORY\nand exactly one last CURRENT\n\nAutomatically Creating Partitions\n---------------------------------\n\nMariaDB starting with 10.9.1\n----------------------------\nFrom MariaDB 10.9.1, the AUTO keyword can be used to automatically create\nhistory partitions.\n\nFor example\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 MONTH\n STARTS \'2021-01-01 00:00:00\' AUTO PARTITIONS 12;\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME LIMIT 1000 AUTO;\n\nOr with explicit partitions:\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO\n (PARTITION p0 HISTORY, PARTITION pn CURRENT);\n\nTo disable or enable auto-creation one can use ALTER TABLE by adding or\nremoving AUTO from the partitioning specification:\n\nCREATE TABLE t1 (x int) WITH SYSTEM VERSIONING\n PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\n# Disables auto-creation:\nALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR;\n\n# Enables auto-creation:\nALTER TABLE t1 PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR AUTO;\n\nIf the rest of the partitioning specification is identical to CREATE TABLE, no\nrepartitioning will be done (for details see MDEV-27328).\n\nRemoving Old History\n--------------------\n\nBecause it stores all the history, a system-versioned table might grow very\nlarge over time. There are many options to trim down the space and remove the\nold history.\n\nOne can completely drop the versioning from the table and add it back again,\nthis will delete all the history:\n\nALTER TABLE t DROP SYSTEM VERSIONING;\nALTER TABLE t ADD SYSTEM VERSIONING;\n\nIt might be a rather time-consuming operation, though, as the table will need\nto be rebuilt, possibly twice (depending on the storage engine).\n\nAnother option would be to use partitioning and drop some of historical\npartitions:\n\nALTER TABLE t DROP PARTITION p0;\n\nNote, that one cannot drop a current partition or the only historical\npartition.\n\nAnd the third option; one can use a variant of the DELETE statement to prune\nthe history:\n\nDELETE HISTORY FROM t;\n\nor only old history up to a specific point in time:\n\nDELETE HISTORY FROM t BEFORE SYSTEM_TIME \'2016-10-09 08:07:06\';\n\nor to a specific transaction (with BEFORE SYSTEM_TIME TRANSACTION xxx).\n\nTo protect the integrity of the history, this statement requires a special\nDELETE HISTORY privilege.\n\nCurrently, using the DELETE HISTORY statement with a BEFORE SYSTEM_TIME\ngreater than the ROW_END of the active records (as a TIMESTAMP, this has a\nmaximum value of \'2038-01-19 03:14:07\' UTC) will result in the historical\nrecords being dropped, and the active records being deleted and moved to\nhistory. See MDEV-25468.\n','','https://mariadb.com/kb/en/system-versioned-tables/');
+update help_topic set description = CONCAT(description, '\nPrior to MariaDB 10.4.5, the TRUNCATE TABLE statement drops all historical\nrecords from a system-versioned-table.\n\nFrom MariaDB 10.4.5, historic data is protected from TRUNCATE statements, as\nper the SQL standard, and an Error 4137 is instead raised:\n\nTRUNCATE t;\nERROR 4137 (HY000): System-versioned tables do not support TRUNCATE TABLE\n\nExcluding Columns From Versioning\n---------------------------------\n\nAnother MariaDB extension allows to version only a subset of columns in a\ntable. This is useful, for example, if you have a table with user information\nthat should be versioned, but one column is, let\'s say, a login counter that\nis incremented often and is not interesting to version. Such a column can be\nexcluded from versioning by declaring it WITHOUT VERSIONING\n\nCREATE TABLE t (\n x INT,\n y INT WITHOUT SYSTEM VERSIONING\n) WITH SYSTEM VERSIONING;\n\nA column can also be declared WITH VERSIONING, that will automatically make\nthe table versioned. The statement below is equivalent to the one above:\n\nCREATE TABLE t (\n x INT WITH SYSTEM VERSIONING,\n y INT\n);\n\nChanges in other sections: https://mariadb.com/kb/en/create-table/\nhttps://mariadb.com/kb/en/alter-table/ https://mariadb.com/kb/en/join-syntax/\nhttps://mariadb.com/kb/en/partitioning-types-overview/\nhttps://mariadb.com/kb/en/date-and-time-units/\nhttps://mariadb.com/kb/en/delete/ https://mariadb.com/kb/en/grant/\n\nthey all reference back to this page\n\nAlso, TODO:\n\n* limitations (size, speed, adding history to unique not nullable columns)\n\nSystem Variables\n----------------\n\nThere are a number of system variables related to system-versioned tables:\n\nsystem_versioning_alter_history\n-------------------------------\n\n* Description: SQL:2011 does not allow ALTER TABLE on system-versioned tables.\nWhen this variable is set to ERROR, an attempt to alter a system-versioned\ntable will result in an error. When this variable is set to KEEP, ALTER TABLE\nwill be allowed, but the history will become incorrect — querying historical\ndata will show the new table structure. This mode is still useful, for\nexample, when adding new columns to a table. Note that if historical data\ncontains or would contain nulls, attempting to ALTER these columns to be NOT\nNULL will return an error (or warning if strict_mode is not set).\n* Commandline: --system-versioning-alter-history=value\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Enum\n* Default Value: ERROR\n* Valid Values: ERROR, KEEP\n* Introduced: MariaDB 10.3.4\n\nsystem_versioning_asof\n----------------------\n\n* Description: If set to a specific timestamp value, an implicit FOR\nSYSTEM_TIME AS OF clause will be applied to all queries. This is useful if one\nwants to do many queries for history at the specific point in time. Set it to\nDEFAULT to restore the default behavior. Has no effect on DML, so queries such\nas INSERT .. SELECT and REPLACE .. SELECT need to state AS OF explicitly.\n* Commandline: None\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Varchar\n* Default Value: DEFAULT\n* Introduced: MariaDB 10.3.4\n\nsystem_versioning_innodb_algorithm_simple\n-----------------------------------------\n\n* Description: Never fully implemented and removed in the following release.\n* Commandline: --system-versioning-innodb-algorithm-simple[={0|1}]\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Boolean\n* Default Value: ON\n* Introduced: MariaDB 10.3.4\n* Removed: MariaDB 10.3.5\n\nsystem_versioning_insert_history\n--------------------------------\n\n* Description: Allows direct inserts into ROW_START and ROW_END columns if\nsecure_timestamp allows changing timestamp.\n* Commandline: --system-versioning-insert-history[={0|1}]\n* Scope: Global, Session\n* Dynamic: Yes\n* Type: Boolean\n* Default Value: OFF\n* Introduced: MariaDB 10.11.0\n\nLimitations\n-----------\n\n* Versioning clauses can not be applied to generated (virtual and persistent)\ncolumns.\n* mysqldump does not read historical rows from versioned tables, and so\nhistorical data will not be backed up. Also, a restore of the timestamps would\nnot be possible as they cannot be defined by an insert/a user.\n\nURL: https://mariadb.com/kb/en/system-versioned-tables/') WHERE help_topic_id = 808;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (809,45,'Application-Time Periods','MariaDB starting with 10.4.3\n----------------------------\nSupport for application-time period-versioning was added in MariaDB 10.4.3.\n\nExtending system-versioned tables, MariaDB 10.4 supports application-time\nperiod tables. Time periods are defined by a range between two temporal\ncolumns. The columns must be of the same temporal data type, i.e. DATE,\nTIMESTAMP or DATETIME (TIME and YEAR are not supported), and of the same width.\n\nUsing time periods implicitly defines the two columns as NOT NULL. It also\nadds a constraint to check whether the first value is less than the second\nvalue. The constraint is invisible to SHOW CREATE TABLE statements. The name\nof this constraint is prefixed by the time period name, to avoid conflict with\nother constraints.\n\nCreating Tables with Time Periods\n---------------------------------\n\nTo create a table with a time period, use a CREATE TABLE statement with the\nPERIOD table option.\n\nCREATE TABLE t1(\n name VARCHAR(50),\n date_1 DATE,\n date_2 DATE,\n PERIOD FOR date_period(date_1, date_2));\n\nThis creates a table with a time_period period and populates the table with\nsome basic temporal values.\n\nExamples are available in the MariaDB Server source code, at\nmysql-test/suite/period/r/create.result.\n\nAdding and Removing Time Periods\n--------------------------------\n\nThe ALTER TABLE statement now supports syntax for adding and removing time\nperiods from a table. To add a period, use the ADD PERIOD clause.\n\nFor example:\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE\n );\n\nALTER TABLE rooms ADD PERIOD FOR p(checkin,checkout);\n\nTo remove a period, use the DROP PERIOD clause:\n\nALTER TABLE rooms DROP PERIOD FOR p;\n\nBoth ADD PERIOD and DROP PERIOD clauses include an option to handle whether\nthe period already exists:\n\nALTER TABLE rooms ADD PERIOD IF NOT EXISTS FOR p(checkin,checkout);\n\nALTER TABLE rooms DROP PERIOD IF EXISTS FOR p;\n\nDeletion by Portion\n-------------------\n\nYou can also remove rows that fall within certain time periods.\n\nWhen MariaDB executes a DELETE FOR PORTION statement, it removes the row:\n\n* When the row period falls completely within the delete period, it removes\nthe row.\n* When the row period overlaps the delete period, it shrinks the row, removing\nthe overlap from the first or second row period value.\n* When the delete period falls completely within the row period, it splits the\nrow into two rows. The first row runs from the starting row period to the\nstarting delete period. The second runs from the ending delete period to the\nending row period.\n\nTo test this, first populate the table with some data to operate on:\n\nCREATE TABLE t1(\n name VARCHAR(50),\n date_1 DATE,\n date_2 DATE,\n PERIOD FOR date_period(date_1, date_2));\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n (\'a\', \'1999-01-01\', \'2000-01-01\'),\n (\'b\', \'1999-01-01\', \'2018-12-12\'),\n (\'c\', \'1999-01-01\', \'2017-01-01\'),\n (\'d\', \'2017-01-01\', \'2019-01-01\');\n\nSELECT * FROM t1;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2017-01-01 |\n| d | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nThen, run the DELETE FOR PORTION statement:\n\nDELETE FROM t1\nFOR PORTION OF date_period\n FROM \'2001-01-01\' TO \'2018-01-01\';\nQuery OK, 3 rows affected (0.028 sec)\n\nSELECT * FROM t1 ORDER BY name;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2001-01-01 |\n| b | 2018-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2001-01-01 |\n| d | 2018-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nHere:\n\n* a is unchanged, as the range falls entirely out of the specified portion to\nbe deleted.\n* b, with values ranging from 1999 to 2018, is split into two rows, 1999 to\n2000 and 2018-01 to 2018-12.\n* c, with values ranging from 1999 to 2017, where only the upper value falls\nwithin the portion to be deleted, has been shrunk to 1999 to 2001.\n* d, with values ranging from 2017 to 2019, where only the lower value falls\nwithin the portion to be deleted, has been shrunk to 2018 to 2019.\n\nThe DELETE FOR PORTION statement has the following restrictions\n\n* The FROM...TO clause must be constant\n* Multi-delete is not supported\n\nIf there are DELETE or INSERT triggers, it works as follows: any matched row\nis deleted, and then one or two rows are inserted. If the record is deleted\ncompletely, nothing is inserted.\n\nUpdating by Portion\n-------------------\n\nThe UPDATE syntax now supports UPDATE FOR PORTION, which modifies rows based\non their occurrence in a range:\n\nTo test it, first populate the table with some data:\n\nTRUNCATE t1;\n\nINSERT INTO t1 (name, date_1, date_2) VALUES\n (\'a\', \'1999-01-01\', \'2000-01-01\'),\n (\'b\', \'1999-01-01\', \'2018-12-12\'),\n (\'c\', \'1999-01-01\', \'2017-01-01\'),\n (\'d\', \'2017-01-01\', \'2019-01-01\');\n\nSELECT * FROM t1;\n+------+------------+------------+\n| name | date_1 | date_2 |\n+------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2018-12-12 |\n| c | 1999-01-01 | 2017-01-01 |\n| d | 2017-01-01 | 2019-01-01 |\n+------+------------+------------+\n\nThen run the update:\n\nUPDATE t1 FOR PORTION OF date_period\n FROM \'2000-01-01\' TO \'2018-01-01\'\nSET name = CONCAT(name,\'_original\');\n\nSELECT * FROM t1 ORDER BY name;\n+------------+------------+------------+\n| name | date_1 | date_2 |\n+------------+------------+------------+\n| a | 1999-01-01 | 2000-01-01 |\n| b | 1999-01-01 | 2000-01-01 |\n| b | 2018-01-01 | 2018-12-12 |\n| b_original | 2000-01-01 | 2018-01-01 |\n| c | 1999-01-01 | 2000-01-01 |\n| c_original | 2000-01-01 | 2017-01-01 |\n| d | 2018-01-01 | 2019-01-01 |\n| d_original | 2017-01-01 | 2018-01-01 |\n+------------+------------+------------+\n\n* a is unchanged, as the range falls entirely out of the specified portion to\nbe deleted.\n* b, with values ranging from 1999 to 2018, is split into two rows, 1999 to\n2000 and 2018-01 to 2018-12.\n* c, with values ranging from 1999 to 2017, where only the upper value falls\nwithin the portion to be deleted, has been shrunk to 1999 to 2001.\n* d, with values ranging from 2017 to 2019, where only the lower value falls\nwithin the portion to be deleted, has been shrunk to 2018 to 2019. \n* Original rows affected by the update have \"_original\" appended to the name.\n\nThe UPDATE FOR PORTION statement has the following limitations:\n\n* The operation cannot modify the two temporal columns used by the time period\n* The operation cannot reference period values in the SET expression\n* FROM...TO expressions must be constant\n\nWITHOUT OVERLAPS\n----------------\n\nMariaDB starting with 10.5.3\n----------------------------\nMariaDB 10.5 introduced a new clause, WITHOUT OVERLAPS, which allows one to\ncreate an index specifying that application time periods should not overlap.\n\nAn index constrained by WITHOUT OVERLAPS is required to be either a primary\nkey or a unique index.\n\nTake the following example, an application time period table for a booking\nsystem:\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout)\n );\n\nINSERT INTO rooms VALUES \n (1, \'Regina\', \'2020-10-01\', \'2020-10-03\'),\n (2, \'Cochise\', \'2020-10-02\', \'2020-10-05\'),\n (1, \'Nowell\', \'2020-10-03\', \'2020-10-07\'),\n (2, \'Eusebius\', \'2020-10-04\', \'2020-10-06\');\n\nOur system is not intended to permit overlapping bookings, so the fourth\nrecord above should not have been inserted. Using WITHOUT OVERLAPS in a unique\nindex (in this case based on a combination of room number and the application\ntime period) allows us to specify this constraint in the table definition.\n\nCREATE OR REPLACE TABLE rooms (\n room_number INT,\n guest_name VARCHAR(255),\n checkin DATE,\n checkout DATE,\n PERIOD FOR p(checkin,checkout),\n UNIQUE (room_number, p WITHOUT OVERLAPS)\n );\n\nINSERT INTO rooms VALUES \n (1, \'Regina\', \'2020-10-01\', \'2020-10-03\'),\n (2, \'Cochise\', \'2020-10-02\', \'2020-10-05\'),\n (1, \'Nowell\', \'2020-10-03\', \'2020-10-07\'),\n (2, \'Eusebius\', \'2020-10-04\', \'2020-10-06\');\nERROR 1062 (23000): Duplicate entry \'2-2020-10-06-2020-10-04\' for key\n\'room_number\'\n\nFurther Examples\n----------------\n\nThe implicit change from NULL to NOT NULL:\n\nCREATE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime DEFAULT NULL,\n `d2` datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\n\nSHOW CREATE TABLE t2\\G\n*************************** 1. row ***************************\n Table: t2\nCreate Table: CREATE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime NOT NULL,\n `d2` datetime NOT NULL,\n PERIOD FOR `p` (`d1`, `d2`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nDue to this constraint, trying to add a time period where null data already\nexists will fail.\n\nCREATE OR REPLACE TABLE `t2` (\n `id` int(11) DEFAULT NULL,\n `d1` datetime DEFAULT NULL,\n `d2` datetime DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\nINSERT INTO t2(id) VALUES(1);\n\nALTER TABLE t2 ADD PERIOD FOR p(d1,d2);\nERROR 1265 (01000): Data truncated for column \'d1\' at row 1\n\nURL: https://mariadb.com/kb/en/application-time-periods/','','https://mariadb.com/kb/en/application-time-periods/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (810,45,'Bitemporal Tables','MariaDB starting with 10.4.3\n----------------------------\nBitemporal tables are tables that use versioning both at the system and\napplication-time period levels.\n\nUsing Bitemporal Tables\n-----------------------\n\nTo create a bitemporal table, use:\n\nCREATE TABLE test.t3 (\n date_1 DATE,\n date_2 DATE,\n row_start TIMESTAMP(6) AS ROW START INVISIBLE,\n row_end TIMESTAMP(6) AS ROW END INVISIBLE,\n PERIOD FOR application_time(date_1, date_2),\n PERIOD FOR system_time(row_start, row_end))\nWITH SYSTEM VERSIONING;\n\nNote that, while system_time here is also a time period, it cannot be used in\nDELETE FOR PORTION or UPDATE FOR PORTION statements.\n\nDELETE FROM test.t3 \nFOR PORTION OF system_time \n FROM \'2000-01-01\' TO \'2018-01-01\';\nERROR 42000: You have an error in your SQL syntax; check the manual that\ncorresponds \n to your MariaDB server version for the right syntax to use near\n \'of system_time from \'2000-01-01\' to \'2018-01-01\'\' at line 1\n\nURL: https://mariadb.com/kb/en/bitemporal-tables/','','https://mariadb.com/kb/en/bitemporal-tables/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (811,46,'ST_AsGeoJSON','Syntax\n------\n\nST_AsGeoJSON(g[, max_decimals[, options]])\n\nDescription\n-----------\n\nReturns the given geometry g as a GeoJSON element. The optional max_decimals\nlimits the maximum number of decimals displayed.\n\nThe optional options flag can be set to 1 to add a bounding box to the output.\n\nExamples\n--------\n\nSELECT ST_AsGeoJSON(ST_GeomFromText(\'POINT(5.3 7.2)\'));\n+-------------------------------------------------+\n| ST_AsGeoJSON(ST_GeomFromText(\'POINT(5.3 7.2)\')) |\n+-------------------------------------------------+\n| {\"type\": \"Point\", \"coordinates\": [5.3, 7.2]} |\n+-------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/geojson-st_asgeojson/','','https://mariadb.com/kb/en/geojson-st_asgeojson/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (812,46,'ST_GeomFromGeoJSON','MariaDB starting with 10.2.4\n----------------------------\nST_GeomFromGeoJSON was added in MariaDB 10.2.4\n\nSyntax\n------\n\nST_GeomFromGeoJSON(g[, option])\n\nDescription\n-----------\n\nGiven a GeoJSON input g, returns a geometry object. The option specifies what\nto do if g contains geometries with coordinate dimensions higher than 2.\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| 1 | Return an error (the default) |\n+---------------------------+------------------------------------------------+\n| 2 - 4 | The document is accepted, but the coordinates |\n| | for higher coordinate dimensions are stripped |\n| | off. |\n+---------------------------+------------------------------------------------+\n\nNote that this function did not work correctly before MariaDB 10.2.8 - see\nMDEV-12180.\n\nExamples\n--------\n\nSET @j = \'{ \"type\": \"Point\", \"coordinates\": [5.3, 15.0]}\';\n\nSELECT ST_AsText(ST_GeomFromGeoJSON(@j));\n+-----------------------------------+\n| ST_AsText(ST_GeomFromGeoJSON(@j)) |\n+-----------------------------------+\n| POINT(5.3 15) |\n+-----------------------------------+\n\nURL: https://mariadb.com/kb/en/st_geomfromgeojson/','','https://mariadb.com/kb/en/st_geomfromgeojson/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (813,47,'Operator Precedence','The precedence is the order in which the SQL operators are evaluated.\n\nThe following list shows the SQL operator precedence. Operators that appear\nfirst in the list have a higher precedence. Operators which are listed\ntogether have the same precedence.\n\n* INTERVAL\n* BINARY, COLLATE\n* !\n* - (unary minus), [[bitwise-not|]] (unary bit inversion)\n* || (string concatenation)\n* ^\n* *, /, DIV, %, MOD\n* -, +\n* <<, >>\n* &\n* |\n* = (comparison), <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN\n* BETWEEN, CASE, WHEN, THEN, ELSE, END\n* NOT\n* &&, AND\n* XOR\n* || (logical or), OR\n* = (assignment), :=\n\nFunctions precedence is always higher than operators precedence.\n\nIn this page CASE refers to the CASE operator, not to the CASE statement.\n\nIf the HIGH_NOT_PRECEDENCE SQL_MODE is set, NOT has the same precedence as !.\n\nThe || operator\'s precedence, as well as its meaning, depends on the\nPIPES_AS_CONCAT SQL_MODE flag: if it is on, || can be used to concatenate\nstrings (like the CONCAT() function) and has a higher precedence.\n\nThe = operator\'s precedence depends on the context - it is higher when = is\nused as a comparison operator.\n\nParenthesis can be used to modify the operators precedence in an expression.\n\nShort-circuit evaluation\n------------------------\n\nThe AND, OR, && and || operators support short-circuit evaluation. This means\nthat, in some cases, the expression on the right of those operators is not\nevaluated, because its result cannot affect the result. In the following\ncases, short-circuit evaluation is used and x() is not evaluated:\n\n* FALSE AND x()\n* FALSE && x()\n* TRUE OR x()\n* TRUE || x()\n* NULL BETWEEN x() AND x()\n\nNote however that the short-circuit evaluation does not apply to NULL AND x().\nAlso, BETWEEN\'s right operands are not evaluated if the left operand is NULL,\nbut in all other cases all the operands are evaluated.\n\nThis is a speed optimization. Also, since functions can have side-effects,\nthis behavior can be used to choose whether execute them or not using a\nconcise syntax:\n\nSELECT some_function() OR log_error();\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 (814,48,'Addition Operator (+)','Syntax\n------\n\n+\n\nDescription\n-----------\n\nAddition.\n\nIf both operands are integers, the result is calculated with BIGINT precision.\nIf either integer is unsigned, the result is also an unsigned integer.\n\nFor real or string operands, the operand with the highest precision determines\nthe result precision.\n\nExamples\n--------\n\nSELECT 3+5;\n+-----+\n| 3+5 |\n+-----+\n| 8 |\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 (815,48,'Division Operator (/)','Syntax\n------\n\n/\n\nDescription\n-----------\n\nDivision operator. Dividing by zero will return NULL. By default, returns four\ndigits after the decimal. This is determined by the server system variable\ndiv_precision_increment which by default is four. It can be set from 0 to 30.\n\nDividing by zero returns NULL. If the ERROR_ON_DIVISION_BY_ZERO SQL_MODE is\nused (the default since MariaDB 10.2.4), a division by zero also produces a\nwarning.\n\nExamples\n--------\n\nSELECT 4/5;\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| 300/7 |\n+---------+\n| 42.8571 |\n+---------+\n\nChanging div_precision_increment for the session from the default of four to\nsix:\n\nSET div_precision_increment = 6;\n\nSELECT 300/7;\n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\n+-----------+\n\nSELECT 300/7;\n+-----------+\n| 300/7 |\n+-----------+\n| 42.857143 |\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 (816,48,'Modulo Operator (%)','Syntax\n------\n\nN % M\n\nDescription\n-----------\n\nModulo operator. Returns the remainder of N divided by M. See also MOD.\n\nExamples\n--------\n\nSELECT 1042 % 50;\n+-----------+\n| 1042 % 50 |\n+-----------+\n| 42 |\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 (817,48,'Multiplication Operator (*)','Syntax\n------\n\n*\n\nDescription\n-----------\n\nMultiplication operator.\n\nExamples\n--------\n\nSELECT 7*6;\n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n\nSELECT 1234567890*9876543210;\n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n\nSELECT 18014398509481984*18014398509481984.0;\n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n\nSELECT 18014398509481984*18014398509481984;\n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\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 (818,48,'Subtraction Operator (-)','Syntax\n------\n\n-\n\nDescription\n-----------\n\nSubtraction. The operator is also used as the unary minus for changing sign.\n\nIf both operands are integers, the result is calculated with BIGINT precision.\nIf either integer is unsigned, the result is also an unsigned integer, unless\nthe NO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case the result is\nalways signed.\n\nFor real or string operands, the operand with the highest precision determines\nthe result precision.\n\nExamples\n--------\n\nSELECT 96-9;\n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n\nSELECT 15-17;\n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n\nSELECT 3.66 + 1.333;\n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n\nUnary minus:\n\nSELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\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 (819,49,'CHANGE MASTER TO','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nCHANGE MASTER [\'connection_name\'] TO master_def [, master_def] ... \n [FOR CHANNEL \'channel_name\']\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 | MASTER_DEMOTE_TO_SLAVE = bool\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n\nDescription\n-----------\n\nThe CHANGE MASTER statement sets the options that a replica uses to connect to\nand replicate from a primary.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nto using the channel_name directly after CHANGE MASTER.\n\nMulti-Source Replication\n------------------------\n\nIf you are using multi-source replication, then you need to specify a\nconnection name when you execute CHANGE MASTER. There are two ways to do this:\n\n* Setting the default_master_connection system variable prior to executing\nCHANGE MASTER.\n* Setting the connection_name parameter when executing CHANGE MASTER.\n\ndefault_master_connection\n-------------------------\n\nSET default_master_connection = \'gandalf\';\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nconnection_name\n---------------\n\nSTOP SLAVE \'gandalf\';\nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE \'gandalf\';\n\nOptions\n-------\n\nConnection Options\n------------------\n\nMASTER_USER\n-----------\n\nThe MASTER_USER option for CHANGE MASTER defines the user account that the\nreplica will use to connect to the primary.\n\nThis user account will need the REPLICATION SLAVE privilege (or, from MariaDB\n10.5.1, the REPLICATION REPLICA on the primary.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_USER string is 96 characters until MariaDB\n10.5, and 128 characters from MariaDB 10.6.\n\nMASTER_PASSWORD\n---------------\n\nThe MASTER_USER option for CHANGE MASTER defines the password that the replica\nwill use to connect to the primary as the user account defined by the\nMASTER_USER option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_PASSWORD string is 32 characters.\n\nMASTER_HOST\n-----------\n\nThe MASTER_HOST option for CHANGE MASTER defines the hostname or IP address of\nthe primary.\n\nIf you set the value of the MASTER_HOST option to the empty string, then that\nis not the same as not setting the option\'s value at all. If you set the value\nof the MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwill fail with an error. In MariaDB 5.3 and before, if you set the value of\nthe MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwould succeed, but the subsequent START SLAVE command would fail.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nIf you set the value of the MASTER_HOST option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nThe maximum length of the MASTER_HOST string is 60 characters until MariaDB\n10.5, and 255 characters from MariaDB 10.6.\n\nMASTER_PORT\n-----------\n\nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP port of the\nprimary.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nIf you set the value of the MASTER_PORT option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nMASTER_CONNECT_RETRY\n--------------------\n\nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines how many seconds\nthat the replica will wait between connection retries. The default is 60.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\nSTART SLAVE;\n\nThe number of connection attempts is limited by the master_retry_count option.\nIt can be set either on the command-line or in a server option group in an\noption file prior to starting up the server. For example:\n\n[mariadb]\n...\nmaster_retry_count=4294967295\n\nMASTER_BIND\n-----------\n\nThe MASTER_BIND option for CHANGE MASTER is only supported by MySQL 5.6.2 and\nlater and by MySQL NDB Cluster 7.3.1 and later. This option is not supported\nby MariaDB. See MDEV-19248 for more information.\n\nThe MASTER_BIND option for CHANGE MASTER can be used on replicas that have\nmultiple network interfaces to choose which network interface the replica will\nuse to connect to the primary.\n\nMASTER_HEARTBEAT_PERIOD\n-----------------------\n\nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be used to set the\ninterval in seconds between replication heartbeats. Whenever the primary\'s\nbinary log is updated with an event, the waiting period for the next heartbeat\nis reset.\n\nThis option\'s interval argument has the following characteristics:\n\n* It is a decimal value with a range of 0 to 4294967 seconds.\n* It has a resolution of hundredths of a second.\n* Its smallest valid non-zero value is 0.001.\n* Its default value is the value of the slave_net_timeout system variable\ndivided by 2.\n* If it\'s set to 0, then heartbeats are disabled.\n\nHeartbeats are sent by the primary only if there are no unsent events in the\nbinary log file for a period longer than the interval.\n\nIf the RESET SLAVE statement is executed, then the heartbeat interval is reset\nto the default.\n\nIf the slave_net_timeout system variable is set to a value that is lower than\nthe current heartbeat interval, then a warning will be issued.\n\nTLS Options\n-----------\n\nThe TLS options are used for providing information about TLS. The options can\nbe set even on replicas that are compiled without TLS support. The TLS options\nare saved to either the default master.info file or the file that is\nconfigured by the master_info_file option, but these TLS options are ignored\nunless the replica supports TLS.\n\nSee Replication with Secure Connections for more information.\n\nMASTER_SSL\n----------\n\nThe MASTER_SSL option for CHANGE MASTER tells the replica whether to force TLS\nfor the connection. The valid values are 0 or 1.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL=1;\nSTART SLAVE;\n\nMASTER_SSL_CA\n-------------\n\nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more X509 certificates for trusted Certificate\nAuthorities (CAs) to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA string is 511 characters.\n\nMASTER_SSL_CAPATH\n-----------------\n\nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one X509\ncertificate for a trusted Certificate Authority (CA) to use for TLS. This\noption requires that you use the absolute path, not a relative path. The\ndirectory specified by this option needs to be run through the openssl rehash\ncommand. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA_PATH string is 511 characters.\n\nMASTER_SSL_CERT\n---------------\n\nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path to the X509\ncertificate file to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CERT string is 511 characters.\n\nMASTER_SSL_CRL\n--------------\n\nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more revoked X509 certificates to use for TLS. This\noption requires that you use the absolute path, not a relative path.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\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\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL string is 511 characters.\n\nMASTER_SSL_CRLPATH\n------------------\n\nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one revoked X509\ncertificate to use for TLS. This option requires that you use the absolute\npath, not a relative path. The directory specified by this variable needs to\nbe run through the openssl rehash command.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\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/\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL_PATH string is 511 characters.\n\nMASTER_SSL_KEY\n--------------\n\nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path to a private key\nfile to use for TLS. This option requires that you use the absolute path, not\na relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_KEY string is 511 characters.\n\nMASTER_SSL_CIPHER\n-----------------\n\nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the list of permitted\nciphers or cipher suites to use for TLS. Besides cipher names, if MariaDB was','','https://mariadb.com/kb/en/change-master-to/');
+update help_topic set description = CONCAT(description, '\ncompiled with OpenSSL, this option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot\nbe excluded when using OpenSSL, even by using this option. See Using TLSv1.3\nfor details. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\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\';\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CIPHER string is 511 characters.\n\nMASTER_SSL_VERIFY_SERVER_CERT\n-----------------------------\n\nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER enables server\ncertificate verification. This option is disabled by default.\n\nFor example:\n\nSTOP SLAVE;\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;\nSTART SLAVE;\n\nSee Secure Connections Overview: Server Certificate Verification for more\ninformation.\n\nBinary Log Options\n------------------\n\nThese options are related to the binary log position on the primary.\n\nMASTER_LOG_FILE\n---------------\n\nThe MASTER_LOG_FILE option for CHANGE MASTER can be used along with\nMASTER_LOG_POS to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nMASTER_LOG_POS\n--------------\n\nThe MASTER_LOG_POS option for CHANGE MASTER can be used along with\nMASTER_LOG_FILE to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nRelay Log Options\n-----------------\n\nThese options are related to the relay log position on the replica.\n\nRELAY_LOG_FILE\n--------------\n\nThe RELAY_LOG_FILE option for CHANGE MASTER can be used along with the\nRELAY_LOG_POS option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nRELAY_LOG_POS\n-------------\n\nThe RELAY_LOG_POS option for CHANGE MASTER can be used along with the\nRELAY_LOG_FILE option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nGTID Options\n------------\n\nMASTER_USE_GTID\n---------------\n\nThe MASTER_USE_GTID option for CHANGE MASTER can be used to configure the\nreplica to use the global transaction ID (GTID) when connecting to a primary.\nThe possible values are:\n\n* current_pos - Replicate in GTID mode and use gtid_current_pos as the\nposition to start downloading transactions from the primary. Deprecated from\nMariaDB 10.10. Using to transition to primary can break the replication state\nif the replica executes local transactions due to actively updating\ngtid_current_pos with gtid_binlog_pos and gtid_slave_pos. Use the new, safe,\nMASTER_DEMOTE_TO_SLAVE=<bool> option instead.\n* slave_pos - Replicate in GTID mode and use gtid_slave_pos as the position to\nstart downloading transactions from the primary. From MariaDB 10.5.1,\nreplica_pos is an alias for slave_pos.\n* no - Don\'t replicate in GTID mode.\n\nMASTER_DEMOTE_TO_SLAVE\n----------------------\n\nMariaDB starting with 10.10\n---------------------------\nUsed to transition a primary to become a replica. Replaces the old\nMASTER_USE_GTID=current_pos with a safe alternative by forcing users to set\nUsing_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once at\nCHANGE MASTER TO time. If gtid_slave_pos is more recent than gtid_binlog_pos\n(as in the case of chain replication), the replication state should be\npreserved.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\nSTART SLAVE;\n\nOr:\n\nSTOP SLAVE;\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID = slave_pos;\nSTART SLAVE;\n\nReplication Filter Options\n--------------------------\n\nAlso see Replication filters.\n\nIGNORE_SERVER_IDS\n-----------------\n\nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events that originated from certain servers.\nFiltered binary log events will not get logged to the replica’s relay log, and\nthey will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\nserver_id values. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n\nDO_DOMAIN_IDS\n-------------\n\nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica\nto only apply binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the DO_DOMAIN_IDS\noption, and the IGNORE_DOMAIN_IDS option was previously set, then you need to\nclear the value of the IGNORE_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\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 replica is replicating\nin GTID mode. Therefore, the MASTER_USE_GTID option must also be set to some\nvalue other than no in order to use this option.\n\nIGNORE_DOMAIN_IDS\n-----------------\n\nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the IGNORE_DOMAIN_IDS\noption, and the DO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\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 replica is\nreplicating in GTID mode. Therefore, the MASTER_USE_GTID option must also be\nset to some value other than no in order to use this option.\n\nDelayed Replication Options\n---------------------------\n\nMASTER_DELAY\n------------\n\nThe MASTER_DELAY option for CHANGE MASTER can be used to enable delayed\nreplication. This option specifies the time in seconds (at least) that a\nreplica should lag behind the primary up to a maximum value of 2147483647, or\nabout 68 years. Before executing an event, the replica will first wait, if\nnecessary, until the given time has passed since the event was created on the\nprimary. The result is that the replica will reflect the state of the primary\nsome time back in the past. The default is zero, no delay.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_DELAY=3600;\nSTART SLAVE;\n\nChanging Option Values\n----------------------\n\nIf you don\'t specify a given option when executing the CHANGE MASTER\nstatement, then the option keeps its old value in most cases. Most of the\ntime, there is no need to specify the options that do not need to change. For\nexample, if the password for the user account that the replica uses to connect\nto its primary has changed, but no other options need to change, then you can\njust change the MASTER_PASSWORD option by executing the following commands:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThere are some cases where options are implicitly reset, such as when the\nMASTER_HOST and MASTER_PORT options are changed.\n\nOption Persistence\n------------------\n\nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options (i.e. the binary\nlog position on the primary) and most other options are written to either the\ndefault master.info file or the file that is configured by the\nmaster_info_file option. The replica\'s I/O thread keeps this binary log\nposition updated as it downloads events only when MASTER_USE_GTID option is\nset to NO. Otherwise the file is not updated on a per event basis.\n\nThe master_info_file option can be set either on the command-line or in a\nserver option group in an option file prior to starting up the server. For\nexample:\n\n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n\nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options (i.e. the relay log\nposition) are written to either the default relay-log.info file or the file\nthat is configured by the relay_log_info_file system variable. The replica\'s\nSQL thread keeps this relay log position updated as it applies events.\n\nThe relay_log_info_file system variable can be set either on the command-line\nor in a server option group in an option file prior to starting up the server.\nFor example:\n\n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n\nGTID Persistence\n----------------\n\nIf the replica is replicating binary log events that contain GTIDs, then the\nreplica\'s SQL thread will write every GTID that it applies to the\nmysql.gtid_slave_pos table. This GTID can be inspected and modified through\nthe gtid_slave_pos system variable.\n\nIf the replica has the log_slave_updates system variable enabled and if the\nreplica has the binary log enabled, then every write by the replica\'s SQL\nthread will also go into the replica\'s binary log. This means that GTIDs of\nreplicated transactions would be reflected in the value of the gtid_binlog_pos\nsystem variable.\n\nCreating a Replica from a Backup\n--------------------------------\n\nThe CHANGE MASTER statement is useful for setting up a replica when you have a\nbackup of the primary and you also have the binary log position or GTID\nposition corresponding to the backup.\n\nAfter restoring the backup on the replica, you could execute something like\nthis to use the binary log position:\n\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nOr you could execute something like this to use the GTID position:\n\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nSee Setting up a Replication Slave with Mariabackup for more information on\nhow to do this with Mariabackup.\n\nExample') WHERE help_topic_id = 819;
+update help_topic set description = CONCAT(description, '\n-------\n\nThe following example changes the primary and primary\'s binary log\ncoordinates. This is used when you want to set up the replica to replicate the\nprimary:\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;\nSTART SLAVE;\n\nURL: https://mariadb.com/kb/en/change-master-to/') WHERE help_topic_id = 819;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (820,49,'START SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTART SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR\nCHANNEL \"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> [FOR CHANNEL \"connection_name\"]\nSTART ALL SLAVES [thread_type [, thread_type]]\n\nSTART REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> -- from 10.5.1\nSTART ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nSTART SLAVE (START REPLICA from MariaDB 10.5.1) with no thread_type options\nstarts both of the replica threads (see replication). The I/O thread reads\nevents from the primary server and stores them in the relay log. The SQL\nthread reads events from the relay log and executes them. START SLAVE requires\nthe SUPER privilege, or, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN\nprivilege.\n\nIf START SLAVE succeeds in starting the replica threads, it returns without\nany error. However, even in that case, it might be that the replica threads\nstart and then later stop (for example, because they do not manage to connect\nto the primary or read its binary log, or some other problem). START SLAVE\ndoes not warn you about this. You must check the replica\'s error log for error\nmessages generated by the replica threads, or check that they are running\nsatisfactorily with SHOW SLAVE STATUS (SHOW REPLICA STATUS from MariaDB\n10.5.1).\n\nSTART SLAVE UNTIL\n-----------------\n\nSTART SLAVE UNTIL refers to the SQL_THREAD replica position at which the\nSQL_THREAD replication will halt. If SQL_THREAD isn\'t specified both threads\nare started.\n\nSTART SLAVE UNTIL master_gtid_pos=xxx is also supported. See Global\nTransaction ID/START SLAVE UNTIL master_gtid_pos=xxx for more details.\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the START SLAVE statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after START SLAVE.\n\nSTART ALL SLAVES\n----------------\n\nSTART ALL SLAVES starts all configured replicas (replicas with master_host not\nempty) that were not started before. It will give a note for all started\nconnections. You can check the notes with SHOW WARNINGS.\n\nSTART REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTART REPLICA is an alias for START SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/start-replica/','','https://mariadb.com/kb/en/start-replica/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (821,49,'STOP SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTOP SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR CHANNEL\n\"connection_name\"]\n\nSTOP ALL SLAVES [thread_type [, thread_type]]\n\nSTOP REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\n\nSTOP ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nStops the replica threads. STOP SLAVE requires the SUPER privilege, or, from\nMariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and SQL_THREAD\noptions to name the thread or threads to be stopped. In almost all cases, one\nnever need to use the thread_type options.\n\nSTOP SLAVE waits until any current replication event group affecting one or\nmore non-transactional tables has finished executing (if there is any such\nreplication group), or until the user issues a KILL QUERY or KILL CONNECTION\nstatement.\n\nNote that STOP SLAVE doesn\'t delete the connection permanently. Next time you\nexecute START SLAVE or the MariaDB server restarts, the replica connection is\nrestored with it\'s original arguments. If you want to delete a connection, you\nshould execute RESET SLAVE.\n\nSTOP ALL SLAVES\n---------------\n\nSTOP ALL SLAVES stops all your running replicas. It will give you a note for\nevery stopped connection. You can check the notes with SHOW WARNINGS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless master, or the default master (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after STOP SLAVE.\n\nSTOP REPLICA\n------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTOP REPLICA is an alias for STOP SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/stop-replica/','','https://mariadb.com/kb/en/stop-replica/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (822,49,'RESET REPLICA/SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nRESET REPLICA [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"] --\nfrom MariaDB 10.5.1 \nRESET SLAVE [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"]\n\nDescription\n-----------\n\nRESET REPLICA/SLAVE makes the replica forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean start. It\ndeletes the master.info and relay-log.info files, all the relay log files, and\nstarts a new relay log file. To use RESET REPLICA/SLAVE, the replica threads\nmust be stopped (use STOP REPLICA/SLAVE if necessary).\n\nNote: All relay log files are deleted, even if they have not been completely\nexecuted by the slave SQL thread. (This is a condition likely to exist on a\nreplication slave if you have issued a STOP REPLICA/SLAVE statement or if the\nslave is highly loaded.)\n\nNote: RESET REPLICA does not reset the global gtid_slave_pos variable. This\nmeans that a replica server configured with CHANGE MASTER TO\nMASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring before\nthe state saved in gtid_slave_pos. If the intent is to reprocess these events,\ngtid_slave_pos must be manually reset, e.g. by executing set global\ngtid_slave_pos=\"\".\n\nConnection information stored in the master.info file is immediately reset\nusing any values specified in the corresponding startup options. This\ninformation includes values such as master host, master port, master user, and\nmaster password. If the replica SQL thread was in the middle of replicating\ntemporary tables when it was stopped, and RESET REPLICA/SLAVE is issued, these\nreplicated temporary tables are deleted on the slave.\n\nThe ALL also resets the PORT, HOST, USER and PASSWORD parameters for the\nslave. If you are using a connection name, it will permanently delete it and\nit will not show up anymore in SHOW ALL REPLICAS/SLAVE STATUS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the RESET REPLICA/SLAVE statement will apply to\nthe specified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after RESET REPLICA.\n\nRESET REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nRESET REPLICA is an alias for RESET SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/reset-replica/','','https://mariadb.com/kb/en/reset-replica/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (823,49,'RESET MASTER','RESET MASTER [TO #]\n\nDeletes all binary log files listed in the index file, resets the binary log\nindex file to be empty, and creates a new binary log file with a suffix of\n.000001.\n\nIf TO # is given, then the first new binary log file will start from number #.\n\nThis statement is for use only when the master is started for the first time,\nand should never be used if any slaves are actively replicating from the\nbinary log.\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 (824,50,'EXECUTE Statement','Syntax\n------\n\nEXECUTE stmt_name\n [USING expression[, expression] ...]\n\nMariaDB starting with 10.2.3\n----------------------------\nEXECUTE with expression as parameters was introduced in MariaDB 10.2.3. Before\nthat one could only use variables (@var_name) as parameters.\n\nDescription\n-----------\n\nAfter preparing a statement with PREPARE, you execute it with an EXECUTE\nstatement that refers to the prepared statement name. If the prepared\nstatement contains any parameter markers, you must supply a USING clause that\nlists user variables containing the values to be bound to the parameters.\nParameter values can be supplied only by user variables, and the USING clause\nmust name exactly as many variables as the number of parameter markers in the\nstatement.\n\nYou can execute a given prepared statement multiple times, passing different\nvariables to it or setting the variables to different values before each\nexecution.\n\nIf the specified statement has not been PREPAREd, an error similar to the\nfollowing is produced:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nEXECUTE\n\nExample\n-------\n\nSee example in PREPARE.\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 (825,50,'PREPARE Statement','Syntax\n------\n\nPREPARE stmt_name FROM preparable_stmt\n\nDescription\n-----------\n\nThe PREPARE statement prepares a statement and assigns it a name, stmt_name,\nby which to refer to the statement later. Statement names are not case\nsensitive. preparable_stmt is either a string literal or a user variable (not\na local variable, an SQL expression or a subquery) that contains the text of\nthe statement. The text must represent a single SQL statement, not multiple\nstatements. Within the statement, \"?\" characters can be used as parameter\nmarkers to indicate where data values are to be bound to the query later when\nyou execute it. The \"?\" characters should not be enclosed within quotes, even\nif you intend to bind them to string values. Parameter markers can be used\nonly where expressions should appear, not for SQL keywords, identifiers, and\nso forth.\n\nThe scope of a prepared statement is the session within which it is created.\nOther sessions cannot see it.\n\nIf a prepared statement with the given name already exists, it is deallocated\nimplicitly before the new statement is prepared. This means that if the new\nstatement contains an error and cannot be prepared, an error is returned and\nno statement with the given name exists.\n\nPrepared statements can be PREPAREd and EXECUTEd in a stored procedure, but\nnot in a stored function or trigger. Also, even if the statement is PREPAREd\nin a procedure, it will not be deallocated when the procedure execution ends.\n\nA prepared statement can access user-defined variables, but not local\nvariables or procedure\'s parameters.\n\nIf the prepared statement contains a syntax error, PREPARE will fail. As a\nside effect, stored procedures can use it to check if a statement is valid.\nFor 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 immediatly after\nEXECUTE, return the number of rows read or affected by the prepared\nstatements; however, if they are called after DEALLOCATE PREPARE, they provide\ninformation about this statement. If the prepared statement produces errors or\nwarnings, GET DIAGNOSTICS return information about them. DEALLOCATE PREPARE\nshouldn\'t clear the diagnostics area, unless it produces an error.\n\nA prepared statement is executed with EXECUTE and released with DEALLOCATE\nPREPARE.\n\nThe max_prepared_stmt_count server system variable determines the number of\nallowed prepared statements that can be prepared on the server. If it is set\nto 0, prepared statements are not allowed. If the limit is reached, an error\nsimilar to the following will be produced:\n\nERROR 1461 (42000): Can\'t create more than max_prepared_stmt_count statements \n (current value: 0)\n\nOracle Mode\n-----------\n\nMariaDB starting with 10.3\n--------------------------\nIn Oracle mode from MariaDB 10.3, PREPARE stmt FROM \'SELECT :1, :2\' is used,\ninstead of ?.\n\nPermitted Statements\n--------------------\n\nMariaDB starting with 10.6.2\n----------------------------\nAll statements can be prepared, except PREPARE, EXECUTE, and DEALLOCATE / DROP\nPREPARE.\n\nPrior to this, not all statements can be prepared. Only the following SQL\ncommands are permitted:\n\n* ALTER TABLE\n* ANALYZE TABLE\n* BINLOG\n* CACHE INDEX\n* CALL\n* CHANGE MASTER\n* CHECKSUM {TABLE | TABLES}\n* COMMIT\n* {CREATE | DROP} DATABASE\n* {CREATE | DROP} INDEX\n* {CREATE | RENAME | DROP} TABLE\n* {CREATE | RENAME | DROP} USER\n* {CREATE | DROP} VIEW\n* DELETE\n* DESCRIBE\n* DO\n* EXPLAIN\n* FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES | LOGS |\nSTATUS | \n MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES | QUERY CACHE |\nTABLE_STATISTICS | \n INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS}\n* GRANT\n* INSERT\n* INSTALL {PLUGIN | SONAME}\n* HANDLER READ\n* KILL\n* LOAD INDEX INTO CACHE\n* OPTIMIZE TABLE\n* REPAIR TABLE\n* REPLACE\n* RESET {MASTER | SLAVE | QUERY CACHE}\n* REVOKE\n* ROLLBACK\n* SELECT\n* SET\n* SET GLOBAL SQL_SLAVE_SKIP_COUNTER\n* SET ROLE\n* SET SQL_LOG_BIN\n* SET TRANSACTION ISOLATION LEVEL\n* SHOW EXPLAIN\n* SHOW {DATABASES | TABLES | OPEN TABLES | TABLE STATUS | COLUMNS | INDEX |\nTRIGGERS | \n EVENTS | GRANTS | CHARACTER SET | COLLATION | ENGINES | PLUGINS [SONAME] |\nPRIVILEGES | \n PROCESSLIST | PROFILE | PROFILES | VARIABLES | STATUS | WARNINGS | ERRORS |\n TABLE_STATISTICS | INDEX_STATISTICS | USER_STATISTICS | CLIENT_STATISTICS |\nAUTHORS | \n CONTRIBUTORS}\n* SHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION | TRIGGER |\nEVENT}\n* SHOW {FUNCTION | PROCEDURE} CODE\n* SHOW BINLOG EVENTS\n* SHOW SLAVE HOSTS\n* SHOW {MASTER | BINARY} LOGS\n* SHOW {MASTER | SLAVE | TABLES | INNODB | FUNCTION | PROCEDURE} STATUS\n* SLAVE {START | STOP}\n* TRUNCATE TABLE\n* SHUTDOWN\n* UNINSTALL {PLUGIN | SONAME}\n* UPDATE\n\nSynonyms are not listed here, but can be used. For example, DESC can be used\ninstead of DESCRIBE.\n\nCompound statements can be prepared too.\n\nNote that if a statement can be run in a stored routine, it will work even if\nit is called by a prepared statement. For example, SIGNAL can\'t be directly\nprepared. However, it is allowed in stored routines. If the x() procedure\ncontains SIGNAL, you can still prepare and execute the \'CALL x();\' prepared\nstatement.\n\nPREPARE supports most kinds of expressions as well, for example:\n\nPREPARE stmt FROM CONCAT(\'SELECT * FROM \', table_name);\n\nWhen PREPARE is used with a statement which is not supported, the following\nerror is produced:\n\nERROR 1295 (HY000): This command is not supported in the prepared statement\nprotocol yet\n\nExample\n-------\n\ncreate table t1 (a int,b char(10));\ninsert into t1 values (1,\"one\"),(2, \"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 parameters,\nsometimes it is necessary to dynamically compose an SQL statement. This\ntechnique is called dynamic SQL). The following example shows how to use\ndynamic 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\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 (826,50,'DEALLOCATE / DROP PREPARE','Syntax\n------\n\n{DEALLOCATE | DROP} PREPARE stmt_name\n\nDescription\n-----------\n\nTo deallocate a prepared statement produced with PREPARE, use a DEALLOCATE\nPREPARE statement that refers to the prepared statement name.\n\nA prepared statement is implicitly deallocated when a new PREPARE command is\nissued. In that case, there is no need to use DEALLOCATE.\n\nAttempting to execute a prepared statement after deallocating it results in an\nerror, as if it was not prepared at all:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nEXECUTE\n\nIf the specified statement has not been PREPAREd, an error similar to the\nfollowing will be produced:\n\nERROR 1243 (HY000): Unknown prepared statement handler (stmt_name) given to\nDEALLOCATE PREPARE\n\nExample\n-------\n\nSee example in PREPARE.\n\nURL: https://mariadb.com/kb/en/deallocate-drop-prepare/','','https://mariadb.com/kb/en/deallocate-drop-prepare/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (827,50,'EXECUTE IMMEDIATE','MariaDB starting with 10.2.3\n----------------------------\nEXECUTE IMMEDIATE was introduced in MariaDB 10.2.3.\n\nSyntax\n------\n\nEXECUTE IMMEDIATE statement\n\nDescription\n-----------\n\nEXECUTE IMMEDIATE executes a dynamic SQL statement created on the fly, which\ncan reduce performance overhead.\n\nFor example:\n\nEXECUTE IMMEDIATE \'SELECT 1\'\n\nwhich is shorthand for:\n\nprepare stmt from \"select 1\";\nexecute stmt;\ndeallocate prepare stmt;\n\nEXECUTE IMMEDIATE supports complex expressions as prepare source and\nparameters:\n\nEXECUTE IMMEDIATE CONCAT(\'SELECT COUNT(*) FROM \', \'t1\', \' WHERE a=?\') USING\n5+5;\n\nLimitations: subselects and stored function calls are not supported as a\nprepare source.\n\nThe following examples return an error:\n\nCREATE OR REPLACE FUNCTION f1() RETURNS VARCHAR(64) RETURN \'SELECT * FROM t1\';\nEXECUTE IMMEDIATE f1();\nERROR 1970 (42000): EXECUTE IMMEDIATE does not support subqueries or stored\nfunctions\n\nEXECUTE IMMEDIATE (SELECT \'SELECT * FROM t1\');\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat \n corresponds to your MariaDB server version for the right syntax 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 subqueries or stored\nfunctions\n\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING (SELECT 10);\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual\nthat \n corresponds to your MariaDB server version for the right syntax 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 \'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 @param;\n\nSET @param=(SELECT 10);\nEXECUTE IMMEDIATE \'SELECT * FROM t1 WHERE a=?\' USING @param;\n\nEXECUTE IMMEDIATE supports user variables and SP variables as 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 procedures but is\nnot allowed in stored functions.\n\nThis example uses EXECUTE IMMEDIATE inside a stored procedure:\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 function or trigger\n\nEXECUTE IMMEDIATE can use DEFAULT and IGNORE indicators as bind parameters:\n\nCREATE OR REPLACE TABLE t1 (a INT DEFAULT 10);\nEXECUTE IMMEDIATE \'INSERT INTO t1 VALUES (?)\' USING DEFAULT;\nSELECT * FROM t1;\n+------+\n| a |\n+------+\n| 10 |\n+------+\n\nEXECUTE IMMEDIATE increments the Com_execute_immediate status variable, as\nwell as the Com_stmt_prepare, Com_stmt_execute and Com_stmt_close status\nvariables.\n\nNote, EXECUTE IMMEDIATE does not increment the Com_execute_sql status\nvariable. Com_execute_sql is used only for PREPARE..EXECUTE.\n\nThis session screenshot demonstrates how EXECUTE IMMEDIATE affects status\nvariables:\n\nSELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_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 VARIABLE_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\nURL: https://mariadb.com/kb/en/execute-immediate/','','https://mariadb.com/kb/en/execute-immediate/');
insert into help_keyword values (1, 'work');
insert into help_keyword values (2, 'locks');
insert into help_keyword values (3, 'locking');
@@ -1119,25 +1124,24 @@ insert into help_relation values (265, 55);
insert into help_relation values (271, 56);
insert into help_relation values (277, 57);
insert into help_relation values (277, 58);
-insert into help_relation values (306, 59);
-insert into help_relation values (313, 60);
-insert into help_relation values (313, 61);
-insert into help_relation values (333, 62);
+insert into help_relation values (307, 59);
+insert into help_relation values (314, 60);
+insert into help_relation values (314, 61);
insert into help_relation values (334, 62);
-insert into help_relation values (335, 63);
insert into help_relation values (335, 62);
+insert into help_relation values (336, 63);
insert into help_relation values (336, 62);
insert into help_relation values (337, 62);
-insert into help_relation values (340, 2);
-insert into help_relation values (340, 3);
-insert into help_relation values (344, 62);
+insert into help_relation values (338, 62);
+insert into help_relation values (341, 2);
+insert into help_relation values (341, 3);
insert into help_relation values (345, 62);
insert into help_relation values (346, 62);
insert into help_relation values (347, 62);
insert into help_relation values (348, 62);
insert into help_relation values (349, 62);
-insert into help_relation values (356, 62);
-insert into help_relation values (358, 62);
+insert into help_relation values (350, 62);
+insert into help_relation values (357, 62);
insert into help_relation values (359, 62);
insert into help_relation values (360, 62);
insert into help_relation values (361, 62);
@@ -1180,67 +1184,68 @@ insert into help_relation values (397, 62);
insert into help_relation values (398, 62);
insert into help_relation values (399, 62);
insert into help_relation values (400, 62);
-insert into help_relation values (405, 64);
-insert into help_relation values (405, 65);
-insert into help_relation values (410, 62);
+insert into help_relation values (401, 62);
+insert into help_relation values (406, 64);
+insert into help_relation values (406, 65);
insert into help_relation values (411, 62);
-insert into help_relation values (412, 66);
-insert into help_relation values (416, 67);
-insert into help_relation values (427, 68);
-insert into help_relation values (433, 69);
+insert into help_relation values (412, 62);
+insert into help_relation values (413, 66);
+insert into help_relation values (417, 67);
+insert into help_relation values (428, 68);
insert into help_relation values (434, 69);
insert into help_relation values (435, 69);
-insert into help_relation values (440, 2);
-insert into help_relation values (440, 3);
-insert into help_relation values (455, 70);
-insert into help_relation values (462, 71);
-insert into help_relation values (462, 72);
-insert into help_relation values (468, 73);
-insert into help_relation values (468, 74);
-insert into help_relation values (625, 75);
-insert into help_relation values (635, 76);
-insert into help_relation values (654, 77);
-insert into help_relation values (660, 78);
-insert into help_relation values (667, 59);
-insert into help_relation values (682, 79);
-insert into help_relation values (691, 4);
-insert into help_relation values (693, 80);
-insert into help_relation values (700, 81);
-insert into help_relation values (701, 4);
-insert into help_relation values (705, 82);
-insert into help_relation values (711, 83);
-insert into help_relation values (715, 84);
-insert into help_relation values (715, 85);
-insert into help_relation values (715, 86);
-insert into help_relation values (716, 87);
-insert into help_relation values (717, 4);
-insert into help_relation values (718, 4);
-insert into help_relation values (719, 4);
+insert into help_relation values (436, 69);
+insert into help_relation values (441, 2);
+insert into help_relation values (441, 3);
+insert into help_relation values (456, 70);
+insert into help_relation values (463, 71);
+insert into help_relation values (463, 72);
+insert into help_relation values (469, 73);
+insert into help_relation values (469, 74);
+insert into help_relation values (626, 75);
+insert into help_relation values (636, 76);
+insert into help_relation values (655, 77);
+insert into help_relation values (661, 78);
+insert into help_relation values (669, 59);
+insert into help_relation values (685, 79);
+insert into help_relation values (694, 4);
+insert into help_relation values (696, 80);
+insert into help_relation values (703, 81);
+insert into help_relation values (704, 4);
+insert into help_relation values (708, 82);
+insert into help_relation values (714, 83);
+insert into help_relation values (718, 84);
+insert into help_relation values (718, 85);
+insert into help_relation values (718, 86);
+insert into help_relation values (719, 87);
insert into help_relation values (720, 4);
insert into help_relation values (721, 4);
insert into help_relation values (722, 4);
insert into help_relation values (723, 4);
insert into help_relation values (724, 4);
+insert into help_relation values (725, 4);
insert into help_relation values (726, 4);
insert into help_relation values (727, 4);
-insert into help_relation values (735, 4);
-insert into help_relation values (736, 88);
-insert into help_relation values (737, 89);
-insert into help_relation values (809, 90);
-insert into help_relation values (809, 91);
-insert into help_relation values (810, 92);
-insert into help_relation values (810, 93);
-insert into help_relation values (811, 94);
-insert into help_relation values (811, 95);
-insert into help_relation values (812, 96);
-insert into help_relation values (812, 97);
-insert into help_relation values (813, 98);
-insert into help_relation values (813, 99);
-insert into help_relation values (814, 100);
-insert into help_relation values (815, 101);
-insert into help_relation values (816, 102);
-insert into help_relation values (817, 103);
-insert into help_relation values (817, 104);
-insert into help_relation values (821, 105);
-insert into help_relation values (821, 106);
+insert into help_relation values (729, 4);
+insert into help_relation values (730, 4);
+insert into help_relation values (738, 4);
+insert into help_relation values (739, 88);
+insert into help_relation values (740, 89);
+insert into help_relation values (814, 90);
+insert into help_relation values (814, 91);
+insert into help_relation values (815, 92);
+insert into help_relation values (815, 93);
+insert into help_relation values (816, 94);
+insert into help_relation values (816, 95);
+insert into help_relation values (817, 96);
+insert into help_relation values (817, 97);
+insert into help_relation values (818, 98);
+insert into help_relation values (818, 99);
+insert into help_relation values (819, 100);
+insert into help_relation values (820, 101);
+insert into help_relation values (821, 102);
+insert into help_relation values (822, 103);
+insert into help_relation values (822, 104);
+insert into help_relation values (826, 105);
+insert into help_relation values (826, 106);
unlock tables;
diff --git a/scripts/sys_schema/procedures/ps_setup_save.sql b/scripts/sys_schema/procedures/ps_setup_save.sql
index a5a2197e935..b7843ecd1f2 100644
--- a/scripts/sys_schema/procedures/ps_setup_save.sql
+++ b/scripts/sys_schema/procedures/ps_setup_save.sql
@@ -80,14 +80,11 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp_setup_instruments;
DROP TEMPORARY TABLE IF EXISTS tmp_threads;
- CREATE TEMPORARY TABLE tmp_setup_actors LIKE performance_schema.setup_actors;
- CREATE TEMPORARY TABLE tmp_setup_consumers LIKE performance_schema.setup_consumers;
- CREATE TEMPORARY TABLE tmp_setup_instruments LIKE performance_schema.setup_instruments;
+ CREATE TEMPORARY TABLE tmp_setup_actors AS SELECT * FROM performance_schema.setup_actors;
+ CREATE TEMPORARY TABLE tmp_setup_consumers AS SELECT * FROM performance_schema.setup_consumers;
+ CREATE TEMPORARY TABLE tmp_setup_instruments AS SELECT * FROM performance_schema.setup_instruments;
CREATE TEMPORARY TABLE tmp_threads (THREAD_ID bigint unsigned NOT NULL PRIMARY KEY, INSTRUMENTED enum('YES','NO') NOT NULL);
- INSERT INTO tmp_setup_actors SELECT * FROM performance_schema.setup_actors;
- INSERT INTO tmp_setup_consumers SELECT * FROM performance_schema.setup_consumers;
- INSERT INTO tmp_setup_instruments SELECT * FROM performance_schema.setup_instruments;
INSERT INTO tmp_threads SELECT THREAD_ID, INSTRUMENTED FROM performance_schema.threads;
ELSE
SIGNAL SQLSTATE VALUE '90000'
diff --git a/sql-common/client.c b/sql-common/client.c
index e65367baddb..d2c6778e167 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1712,14 +1712,14 @@ static MYSQL_METHODS client_methods=
cli_use_result, /* use_result */
cli_fetch_lengths, /* fetch_lengths */
cli_flush_use_result, /* flush_use_result */
- cli_read_change_user_result /* read_change_user_result */
+ cli_read_change_user_result, /* read_change_user_result */
+ NULL /* on_close_free */
#ifndef MYSQL_SERVER
,cli_list_fields, /* list_fields */
cli_read_prepare_result, /* read_prepare_result */
cli_stmt_execute, /* stmt_execute */
cli_read_binary_rows, /* read_binary_rows */
cli_unbuffered_fetch, /* unbuffered_fetch */
- NULL, /* free_embedded_thd */
cli_read_statistics, /* read_statistics */
cli_read_query_result, /* next_result */
cli_read_binary_rows /* read_rows_from_cursor */
@@ -3321,10 +3321,8 @@ static void mysql_close_free(MYSQL *mysql)
my_free(mysql->user);
my_free(mysql->passwd);
my_free(mysql->db);
-#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100
- my_free(mysql->info_buffer);
- mysql->info_buffer= 0;
-#endif
+ if (mysql->methods && mysql->methods->on_close_free)
+ (*mysql->methods->on_close_free)(mysql);
/* Clear pointers for better safety */
mysql->host_info= mysql->user= mysql->passwd= mysql->db= 0;
}
@@ -3443,13 +3441,6 @@ void STDCALL mysql_close(MYSQL *mysql)
mysql_close_free_options(mysql);
mysql_close_free(mysql);
mysql_detach_stmt_list(&mysql->stmts, "mysql_close");
-#ifndef MYSQL_SERVER
- if (mysql->thd)
- {
- (*mysql->methods->free_embedded_thd)(mysql);
- mysql->thd= 0;
- }
-#endif
if (mysql->free_me)
my_free(mysql);
}
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 3633d9d8fba..c9aaad8d9d3 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -52,6 +52,7 @@ ENDIF()
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
+${LIBFMT_INCLUDE_DIR}
${PCRE_INCLUDES}
${ZLIB_INCLUDE_DIR}
${SSL_INCLUDE_DIRS}
@@ -97,9 +98,9 @@ SET (SQL_SOURCE
filesort.cc gstream.cc
signal_handler.cc
handler.cc
- hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
- item_create.cc item_func.cc item_geofunc.cc item_row.cc
- item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
+ hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
+ item_create.cc item_func.cc item_geofunc.cc item_row.cc
+ item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
key.cc log.cc lock.cc
log_event.cc log_event_server.cc
rpl_record.cc rpl_reporting.cc
@@ -108,33 +109,33 @@ SET (SQL_SOURCE
mysqld.cc net_serv.cc keycaches.cc
../sql-common/client_plugin.c
opt_range.cc opt_sum.cc
- ../sql-common/pack.c parse_file.cc password.c procedure.cc
+ ../sql-common/pack.c parse_file.cc password.c procedure.cc
protocol.cc records.cc repl_failsafe.cc rpl_filter.cc
session_tracker.cc
- set_var.cc
- slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
- sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
+ set_var.cc
+ slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
+ sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc
sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc
- sql_digest.cc sql_do.cc
+ sql_digest.cc sql_do.cc
sql_error.cc sql_handler.cc sql_get_diagnostics.cc
- sql_help.cc sql_insert.cc sql_lex.cc
+ sql_help.cc sql_insert.cc sql_lex.cc
sql_list.cc sql_load.cc sql_manager.cc
sql_parse.cc sql_bootstrap.cc
- sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
+ sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc debug.cc
sql_repl.cc sql_select.cc sql_show.cc sql_state.c
group_by_handler.cc derived_handler.cc select_handler.cc
sql_statistics.cc sql_string.cc lex_string.h
sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
ddl_log.cc ddl_log.h
- sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
- sql_time.cc tztime.cc unireg.cc item_xmlfunc.cc
+ sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
+ sql_time.cc tztime.cc unireg.cc item_xmlfunc.cc
uniques.cc
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
+ event_queue.cc event_db_repository.cc
+ events.cc ../sql-common/my_user.c
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
@@ -319,24 +320,24 @@ ENDIF()
# On Solaris, some extra effort is required in order to get dtrace probes
# from static libraries
-DTRACE_INSTRUMENT_STATIC_LIBS(mariadbd
+DTRACE_INSTRUMENT_STATIC_LIBS(mariadbd
"sql;mysys;mysys_ssl;${MYSQLD_STATIC_PLUGIN_LIBS}")
-
+
SET(WITH_MYSQLD_LDFLAGS "" CACHE STRING "Additional linker flags for mysqld")
MARK_AS_ADVANCED(WITH_MYSQLD_LDFLAGS)
IF(WITH_MYSQLD_LDFLAGS)
GET_TARGET_PROPERTY(MYSQLD_LINK_FLAGS mariadbd LINK_FLAGS)
IF(NOT MYSQLD_LINK_FLAGS)
- SET(MYSQLD_LINK_FLAGS)
- ENDIF()
- SET_TARGET_PROPERTIES(mariadbd PROPERTIES LINK_FLAGS
+ SET(MYSQLD_LINK_FLAGS)
+ ENDIF()
+ SET_TARGET_PROPERTIES(mariadbd PROPERTIES LINK_FLAGS
"${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
ENDIF()
-# Handle out-of-source build from source package with possibly broken
-# bison. Copy bison output to from source to build directory, if not already
+# Handle out-of-source build from source package with possibly broken
+# bison. Copy bison output to from source to build directory, if not already
# there
IF (NOT BISON_FOUND)
IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
@@ -398,6 +399,10 @@ ADD_CUSTOM_TARGET(
)
ADD_DEPENDENCIES(sql GenServerSource)
+IF(TARGET libfmt)
+ ADD_DEPENDENCIES(sql libfmt)
+ENDIF()
+
IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "")
@@ -447,9 +452,9 @@ IF(TARGET mariadbd AND (NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING
ELSE()
SET(ALL_ON_WINDOWS)
ENDIF()
- ADD_CUSTOM_TARGET(initial_database
+ ADD_CUSTOM_TARGET(initial_database
${ALL_ON_WINDOWS}
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
)
ENDIF()
@@ -458,7 +463,7 @@ IF(WIN32)
FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile)
# Create bootstrapper SQL script
- ADD_CUSTOM_COMMAND(OUTPUT
+ ADD_CUSTOM_COMMAND(OUTPUT
${my_bootstrap_sql}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/scripts
cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql+mysql_test_db.sql+mysql_sys_schema.sql ${native_outfile}
@@ -481,7 +486,7 @@ IF(WIN32)
DEPENDS comp_sql ${my_bootstrap_sql}
)
- MYSQL_ADD_EXECUTABLE(mariadb-install-db
+ MYSQL_ADD_EXECUTABLE(mariadb-install-db
mysql_install_db.cc
${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
COMPONENT Server
diff --git a/sql/backup.cc b/sql/backup.cc
index 0a5cc97f431..e38e5995845 100644
--- a/sql/backup.cc
+++ b/sql/backup.cc
@@ -35,6 +35,7 @@
#include "sql_handler.h" // mysql_ha_cleanup_no_free
#include <my_sys.h>
#include <strfunc.h> // strconvert()
+#include "wsrep_mysqld.h"
#ifdef WITH_WSREP
#include "wsrep_server_state.h"
#endif /* WITH_WSREP */
@@ -402,6 +403,9 @@ bool backup_end(THD *thd)
if (WSREP_NNULL(thd) && thd->wsrep_desynced_backup_stage)
{
Wsrep_server_state &server_state= Wsrep_server_state::instance();
+ THD_STAGE_INFO(thd, stage_waiting_flow);
+ WSREP_DEBUG("backup_end: waiting for flow control for %s",
+ wsrep_thd_query(thd));
server_state.resume_and_resync();
thd->wsrep_desynced_backup_stage= false;
}
@@ -553,7 +557,7 @@ static char *add_id_to_buffer(char *ptr, const LEX_CUSTRING *from)
tmp.str= buff;
tmp.length= MY_UUID_STRING_LENGTH;
- my_uuid2str(from->str, buff);
+ my_uuid2str(from->str, buff, 1);
return add_str_to_buffer(ptr, &tmp);
}
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc
index 8722d88ba95..2ac4e256112 100644
--- a/sql/ddl_log.cc
+++ b/sql/ddl_log.cc
@@ -77,6 +77,8 @@
#define DDL_LOG_MAGIC_LENGTH 4
/* How many times to try to execute a ddl log entry that causes crashes */
#define DDL_LOG_MAX_RETRY 3
+#define DDL_LOG_RETRY_MASK 0xFF
+#define DDL_LOG_RETRY_BITS 8
uchar ddl_log_file_magic[]=
{ (uchar) 254, (uchar) 254, (uchar) 11, (uchar) 2 };
@@ -155,7 +157,7 @@ mysql_mutex_t LOCK_gdl;
#define DDL_LOG_XID_POS 10
/* Used to store unique uuid from the .frm file */
#define DDL_LOG_UUID_POS 18
-/* ID_POS can be used to store something unique, like file size (4 bytes) */
+/* ID_POS can be used to store something unique, like file size (8 bytes) */
#define DDL_LOG_ID_POS DDL_LOG_UUID_POS + MY_UUID_SIZE
#define DDL_LOG_END_POS DDL_LOG_ID_POS + 8
@@ -335,7 +337,7 @@ static bool write_ddl_log_file_entry(uint entry_pos)
static bool update_phase(uint entry_pos, uchar phase)
{
DBUG_ENTER("update_phase");
- DBUG_PRINT("enter", ("phase: %d", (int) phase));
+ DBUG_PRINT("ddl_log", ("pos: %u phase: %u", entry_pos, (uint) phase));
DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, &phase, 1,
global_ddl_log.io_size * entry_pos +
@@ -369,6 +371,8 @@ static bool update_next_entry_pos(uint entry_pos, uint next_entry)
uchar buff[4];
DBUG_ENTER("update_next_entry_pos");
+ DBUG_PRINT("ddl_log", ("pos: %u->%u", entry_pos, next_entry));
+
int4store(buff, next_entry);
DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, buff, sizeof(buff),
global_ddl_log.io_size * entry_pos +
@@ -420,6 +424,7 @@ static bool disable_execute_entry(uint entry_pos)
{
uchar buff[1];
DBUG_ENTER("disable_execute_entry");
+ DBUG_PRINT("ddl_log", ("pos: {%u}", entry_pos));
buff[0]= DDL_LOG_IGNORE_ENTRY_CODE;
DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, buff, sizeof(buff),
@@ -1296,13 +1301,15 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
mysql_mutex_assert_owner(&LOCK_gdl);
DBUG_PRINT("ddl_log",
- ("entry type: %u action type: %u (%s) phase: %u next: %u "
+ ("pos: %u=>%u->%u type: %u action: %u (%s) phase: %u "
"handler: '%s' name: '%s' from_name: '%s' tmp_name: '%s'",
+ recovery_state.execute_entry_pos,
+ ddl_log_entry->entry_pos,
+ ddl_log_entry->next_entry,
(uint) ddl_log_entry->entry_type,
(uint) ddl_log_entry->action_type,
ddl_log_action_name[ddl_log_entry->action_type],
(uint) ddl_log_entry->phase,
- ddl_log_entry->next_entry,
ddl_log_entry->handler_name.str,
ddl_log_entry->name.str,
ddl_log_entry->from_name.str,
@@ -2470,13 +2477,13 @@ bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
error= FALSE;
DBUG_PRINT("ddl_log",
- ("entry type: %u action type: %u (%s) phase: %u next: %u "
+ ("pos: %u->%u action: %u (%s) phase: %u "
"handler: '%s' name: '%s' from_name: '%s' tmp_name: '%s'",
- (uint) ddl_log_entry->entry_type,
+ (*active_entry)->entry_pos,
+ (uint) ddl_log_entry->next_entry,
(uint) ddl_log_entry->action_type,
ddl_log_action_name[ddl_log_entry->action_type],
(uint) ddl_log_entry->phase,
- ddl_log_entry->next_entry,
ddl_log_entry->handler_name.str,
ddl_log_entry->name.str,
ddl_log_entry->from_name.str,
@@ -2510,6 +2517,7 @@ bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
@param first_entry First entry in linked list of entries
to execute.
+ @param cond_entry Check and don't execute if cond_entry is active
@param[in,out] active_entry Entry to execute, 0 = NULL if the entry
is written first time and needs to be
returned. In this case the entry written
@@ -2520,6 +2528,7 @@ bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
*/
bool ddl_log_write_execute_entry(uint first_entry,
+ uint cond_entry,
DDL_LOG_MEMORY_ENTRY **active_entry)
{
uchar *file_entry_buf= global_ddl_log.file_entry_buf;
@@ -2536,13 +2545,17 @@ bool ddl_log_write_execute_entry(uint first_entry,
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (uchar)DDL_LOG_EXECUTE_CODE;
int4store(file_entry_buf + DDL_LOG_NEXT_ENTRY_POS, first_entry);
+ int8store(file_entry_buf + DDL_LOG_ID_POS, ((ulonglong)cond_entry << DDL_LOG_RETRY_BITS));
if (!(*active_entry))
{
if (ddl_log_get_free_entry(active_entry))
DBUG_RETURN(TRUE);
got_free_entry= TRUE;
- }
+ }
+ DBUG_PRINT("ddl_log",
+ ("pos: %u=>%u",
+ (*active_entry)->entry_pos, first_entry));
if (write_ddl_log_file_entry((*active_entry)->entry_pos))
{
sql_print_error("DDL_LOG: Error writing execute entry %u",
@@ -2575,6 +2588,7 @@ bool ddl_log_increment_phase(uint entry_pos)
{
bool error;
DBUG_ENTER("ddl_log_increment_phase");
+ DBUG_PRINT("ddl_log", ("pos: %u", entry_pos));
mysql_mutex_lock(&LOCK_gdl);
error= ddl_log_increment_phase_no_lock(entry_pos);
@@ -2754,13 +2768,13 @@ int ddl_log_execute_recovery()
recovery_state.xid= ddl_log_entry.xid;
/* purecov: begin tested */
- if (ddl_log_entry.unique_id > DDL_LOG_MAX_RETRY)
+ if ((ddl_log_entry.unique_id & DDL_LOG_RETRY_MASK) > DDL_LOG_MAX_RETRY)
{
error= -1;
continue;
}
update_unique_id(i, ++ddl_log_entry.unique_id);
- if (ddl_log_entry.unique_id > DDL_LOG_MAX_RETRY)
+ if ((ddl_log_entry.unique_id & DDL_LOG_RETRY_MASK) > DDL_LOG_MAX_RETRY)
{
sql_print_error("DDL_LOG: Aborting executing entry %u after %llu "
"retries", i, ddl_log_entry.unique_id);
@@ -2769,6 +2783,15 @@ int ddl_log_execute_recovery()
}
/* purecov: end tested */
+ uint cond_entry= (uint)(ddl_log_entry.unique_id >> DDL_LOG_RETRY_BITS);
+
+ if (cond_entry && is_execute_entry_active(cond_entry))
+ {
+ if (disable_execute_entry(i))
+ error= -1;
+ continue;
+ }
+
if (ddl_log_execute_entry_no_lock(thd, ddl_log_entry.next_entry))
{
/* Real unpleasant scenario but we have to continue anyway */
@@ -2848,8 +2871,7 @@ void ddl_log_release()
Methods for DDL_LOG_STATE
*/
-static void add_log_entry(DDL_LOG_STATE *state,
- DDL_LOG_MEMORY_ENTRY *log_entry)
+void ddl_log_add_entry(DDL_LOG_STATE *state, DDL_LOG_MEMORY_ENTRY *log_entry)
{
log_entry->next_active_log_entry= state->list;
state->main_entry= state->list= log_entry;
@@ -3028,7 +3050,7 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state,
ddl_log_release_memory_entry(log_entry);
DBUG_RETURN(1);
}
- add_log_entry(ddl_state, log_entry);
+ ddl_log_add_entry(ddl_state, log_entry);
ddl_state->flags|= ddl_log_entry->flags; // Update cache
DBUG_RETURN(0);
}
@@ -3178,7 +3200,7 @@ static bool ddl_log_drop(THD *thd, DDL_LOG_STATE *ddl_state,
}
mysql_mutex_unlock(&LOCK_gdl);
- add_log_entry(ddl_state, log_entry);
+ ddl_log_add_entry(ddl_state, log_entry);
DBUG_RETURN(0);
error:
@@ -3478,7 +3500,7 @@ bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_state,
goto err;
parent_entry_pos= ddl_state->list->entry_pos;
entry_pos= first_entry->entry_pos;
- add_log_entry(ddl_state, first_entry);
+ ddl_log_add_entry(ddl_state, first_entry);
while (length)
{
@@ -3494,7 +3516,7 @@ bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_state,
if (ddl_log_get_free_entry(&next_entry))
goto err;
ddl_log_entry.next_entry= next_entry_pos= next_entry->entry_pos;
- add_log_entry(ddl_state, next_entry);
+ ddl_log_add_entry(ddl_state, next_entry);
}
else
{
@@ -3526,3 +3548,32 @@ err:
mysql_mutex_unlock(&LOCK_gdl);
DBUG_RETURN(1);
}
+
+
+/*
+ Log an delete frm file
+*/
+
+/*
+ TODO: Partitioning atomic DDL refactoring: this should be replaced with
+ ddl_log_create_table().
+*/
+bool ddl_log_delete_frm(DDL_LOG_STATE *ddl_state, const char *to_path)
+{
+ DDL_LOG_ENTRY ddl_log_entry;
+ DDL_LOG_MEMORY_ENTRY *log_entry;
+ DBUG_ENTER("ddl_log_delete_frm");
+ bzero(&ddl_log_entry, sizeof(ddl_log_entry));
+ ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
+ ddl_log_entry.next_entry= ddl_state->list ? ddl_state->list->entry_pos : 0;
+
+ lex_string_set(&ddl_log_entry.handler_name, reg_ext);
+ lex_string_set(&ddl_log_entry.name, to_path);
+
+ mysql_mutex_assert_owner(&LOCK_gdl);
+ if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
+ DBUG_RETURN(1);
+
+ ddl_log_add_entry(ddl_state, log_entry);
+ DBUG_RETURN(0);
+}
diff --git a/sql/ddl_log.h b/sql/ddl_log.h
index a2a6af76a77..9960855a813 100644
--- a/sql/ddl_log.h
+++ b/sql/ddl_log.h
@@ -262,8 +262,14 @@ int ddl_log_execute_recovery();
bool ddl_log_write_entry(DDL_LOG_ENTRY *ddl_log_entry,
DDL_LOG_MEMORY_ENTRY **active_entry);
+bool ddl_log_write_execute_entry(uint first_entry, uint cond_entry,
+ DDL_LOG_MEMORY_ENTRY** active_entry);
+inline
bool ddl_log_write_execute_entry(uint first_entry,
- DDL_LOG_MEMORY_ENTRY **active_entry);
+ DDL_LOG_MEMORY_ENTRY **active_entry)
+{
+ return ddl_log_write_execute_entry(first_entry, 0, active_entry);
+}
bool ddl_log_disable_execute_entry(DDL_LOG_MEMORY_ENTRY **active_entry);
void ddl_log_complete(DDL_LOG_STATE *ddl_log_state);
@@ -279,6 +285,7 @@ void ddl_log_release_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry);
bool ddl_log_sync();
bool ddl_log_execute_entry(THD *thd, uint first_entry);
+void ddl_log_add_entry(DDL_LOG_STATE *state, DDL_LOG_MEMORY_ENTRY *log_entry);
void ddl_log_release_entries(DDL_LOG_STATE *ddl_log_state);
bool ddl_log_rename_table(THD *thd, DDL_LOG_STATE *ddl_state,
handlerton *hton,
@@ -348,5 +355,6 @@ bool ddl_log_alter_table(THD *thd, DDL_LOG_STATE *ddl_state,
bool is_renamed);
bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_log_state,
const char *query, size_t length);
+bool ddl_log_delete_frm(DDL_LOG_STATE *ddl_state, const char *to_path);
extern mysql_mutex_t LOCK_gdl;
#endif /* DDL_LOG_INCLUDED */
diff --git a/sql/discover.cc b/sql/discover.cc
index 22d7008630a..201169357a2 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -233,7 +233,7 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta,
cur++;
}
advance(from, to, cur, skip);
- dirp->number_of_files= (uint)(to - dirp->dir_entry);
+ dirp->number_of_files= to - dirp->dir_entry;
return 0;
}
diff --git a/sql/encryption.cc b/sql/encryption.cc
index 13239b91910..3c7ba2e997b 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -109,6 +109,7 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
int finalize_encryption_plugin(st_plugin_int *plugin)
{
+ int deinit_status= 0;
bool used= plugin_ref_to_int(encryption_manager) == plugin;
if (used)
@@ -118,18 +119,15 @@ int finalize_encryption_plugin(st_plugin_int *plugin)
encryption_handler.encryption_ctx_size_func= zero_size;
}
- if (plugin && plugin->plugin->deinit && plugin->plugin->deinit(NULL))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
+ if (plugin && plugin->plugin->deinit)
+ deinit_status= plugin->plugin->deinit(NULL);
if (used)
{
plugin_unlock(NULL, encryption_manager);
encryption_manager= 0;
}
- return 0;
+ return deinit_status;
}
/******************************************************************
diff --git a/sql/field.cc b/sql/field.cc
index fbb0047e653..5e4ac02819d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -964,6 +964,51 @@ Type_handler::aggregate_for_result_traditional(const Type_handler *a,
}
+bool Field::check_assignability_from(const Type_handler *from,
+ bool ignore) const
+{
+ /*
+ Using type_handler_for_item_field() here to get the data type handler
+ on both sides. This is needed to make sure aggregation for Field
+ works the same way with how Item_field aggregates for UNION or CASE,
+ so these statements:
+ SELECT a FROM t1 UNION SELECT b FROM t1; // Item_field vs Item_field
+ UPDATE t1 SET a=b; // Field vs Item_field
+ either both return "Illegal parameter data types" or both pass
+ the data type compatibility test.
+ For MariaDB standard data types, using type_handler_for_item_field()
+ turns ENUM/SET into just CHAR.
+ */
+ Type_handler_hybrid_field_type th(type_handler()->
+ type_handler_for_item_field());
+ if (th.aggregate_for_result(from->type_handler_for_item_field()))
+ {
+ bool error= (!ignore && get_thd()->is_strict_mode()) ||
+ (type_handler()->is_scalar_type() != from->is_scalar_type());
+ /*
+ Display fully qualified column name for table columns.
+ Display non-qualified names for other things,
+ e.g. SP variables, SP return values, SP and CURSOR parameters.
+ */
+ if (table->s->db.str && table->s->table_name.str)
+ my_printf_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION,
+ "Cannot cast '%s' as '%s' in assignment of %`s.%`s.%`s",
+ MYF(error ? 0 : ME_WARNING),
+ from->name().ptr(), type_handler()->name().ptr(),
+ table->s->db.str, table->s->table_name.str,
+ field_name.str);
+ else
+ my_printf_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION,
+ "Cannot cast '%s' as '%s' in assignment of %`s",
+ MYF(error ? 0 : ME_WARNING),
+ from->name().ptr(), type_handler()->name().ptr(),
+ field_name.str);
+ return error;
+ }
+ return false;
+}
+
+
/*
Test if the given string contains important data:
not spaces for character string,
@@ -1427,18 +1472,9 @@ bool Field::sp_prepare_and_store_item(THD *thd, Item **value)
Item *expr_item;
- if (!(expr_item= thd->sp_prepare_func_item(value, 1)))
+ if (!(expr_item= thd->sp_fix_func_item_for_assignment(this, value)))
goto error;
- /*
- expr_item is now fixed, it's safe to call cmp_type()
- */
- if (expr_item->cmp_type() == ROW_RESULT)
- {
- my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
- goto error;
- }
-
/* Save the value in the field. Convert the value if needed. */
expr_item->save_in_field(this, 0);
@@ -11116,6 +11152,14 @@ Field::set_warning(Sql_condition::enum_warning_level level, uint code,
will have table == NULL.
*/
THD *thd= get_thd();
+
+ /*
+ In INPLACE ALTER, server can't know which row has generated
+ the warning, so the value of current row is supplied by the engine.
+ */
+ if (current_row)
+ thd->get_stmt_da()->reset_current_row_for_warning(current_row);
+
if (thd->count_cuted_fields > CHECK_FIELD_EXPRESSION)
{
thd->cuted_fields+= cut_increment;
diff --git a/sql/field.h b/sql/field.h
index 8d34e259fea..196dd6fcaae 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -905,6 +905,12 @@ public:
bool is_unsigned() const { return flags & UNSIGNED_FLAG; }
+ bool check_assignability_from(const Type_handler *from, bool ignore) const;
+ bool check_assignability_from(const Field *from, bool ignore) const
+ {
+ return check_assignability_from(from->type_handler(), ignore);
+ }
+
/**
Convenience definition of a copy function returned by
Field::get_copy_func()
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index b079bd7a714..f94c7190532 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -172,7 +172,7 @@ static void GCALC_DBUG_PRINT_SLICE(const char *header,
Gcalc_dyn_list::Gcalc_dyn_list(size_t blk_size, size_t sizeof_item):
- m_blk_size(blk_size - ALLOC_ROOT_MIN_BLOCK_SIZE),
+ m_blk_size(blk_size),
m_sizeof_item(ALIGN_SIZE(sizeof_item)),
m_points_per_blk((uint)((m_blk_size - PH_DATA_OFFSET) / m_sizeof_item)),
m_blk_hook(&m_first_blk),
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 688db6403b4..34cbf8f018a 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2143,7 +2143,12 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
}
DBUG_ASSERT(m_new_file == 0);
m_new_file= new_file_array;
- if (unlikely((error= copy_partitions(copied, deleted))))
+ for (i= 0; i < part_count; i++)
+ m_added_file[i]->extra(HA_EXTRA_BEGIN_ALTER_COPY);
+ error= copy_partitions(copied, deleted);
+ for (i= 0; i < part_count; i++)
+ m_added_file[i]->extra(HA_EXTRA_END_ALTER_COPY);
+ if (unlikely(error))
{
/*
Close and unlock the new temporary partitions.
@@ -3625,31 +3630,31 @@ bool ha_partition::init_partition_bitmaps()
DBUG_ENTER("ha_partition::init_partition_bitmaps");
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
- if (my_bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
+ if (my_bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1))
DBUG_RETURN(true);
/* Initialize the bitmap we use to keep track of locked partitions */
- if (my_bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_locked_partitions, NULL, m_tot_parts))
DBUG_RETURN(true);
/*
Initialize the bitmap we use to keep track of partitions which may have
something to reset in ha_reset().
*/
- if (my_bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts))
DBUG_RETURN(true);
/*
Initialize the bitmap we use to keep track of partitions which returned
HA_ERR_KEY_NOT_FOUND from index_read_map.
*/
- if (my_bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts))
DBUG_RETURN(true);
- if (bitmap_init(&m_mrr_used_partitions, NULL, m_tot_parts, TRUE))
+ if (my_bitmap_init(&m_mrr_used_partitions, NULL, m_tot_parts))
DBUG_RETURN(true);
- if (my_bitmap_init(&m_opened_partitions, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_opened_partitions, NULL, m_tot_parts))
DBUG_RETURN(true);
m_file_sample= NULL;
diff --git a/sql/handler.cc b/sql/handler.cc
index 9f37061594c..6487ccd2f92 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -581,6 +581,7 @@ static int hton_drop_table(handlerton *hton, const char *path)
int ha_finalize_handlerton(st_plugin_int *plugin)
{
+ int deinit_status= 0;
handlerton *hton= (handlerton *)plugin->data;
DBUG_ENTER("ha_finalize_handlerton");
@@ -595,18 +596,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
hton->panic(hton, HA_PANIC_CLOSE);
if (plugin->plugin->deinit)
- {
- /*
- Today we have no defined/special behavior for uninstalling
- engine plugins.
- */
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(NULL))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
- }
+ deinit_status= plugin->plugin->deinit(NULL);
free_sysvar_table_options(hton);
update_discovery_counters(hton, -1);
@@ -627,7 +617,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
my_free(hton);
end:
- DBUG_RETURN(0);
+ DBUG_RETURN(deinit_status);
}
@@ -1761,6 +1751,13 @@ int ha_commit_trans(THD *thd, bool all)
if (ha_info->ht()->prepare_commit_versioned)
{
trx_end_id= ha_info->ht()->prepare_commit_versioned(thd, &trx_start_id);
+
+ if (trx_end_id == ULONGLONG_MAX)
+ {
+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), 1);
+ goto err;
+ }
+
if (trx_end_id)
break; // FIXME: use a common ID for cross-engine transactions
}
@@ -8099,7 +8096,7 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
f->set_handler(&type_handler_timestamp2);
f->length= MAX_DATETIME_PRECISION;
}
- f->invisible= DBUG_EVALUATE_IF("sysvers_show", VISIBLE, INVISIBLE_SYSTEM);
+ f->invisible= DBUG_IF("sysvers_show") ? VISIBLE : INVISIBLE_SYSTEM;
if (f->check(thd))
return NULL;
@@ -8247,7 +8244,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (!need_check(alter_info) && !share->versioned)
return false;
- if (DBUG_EVALUATE_IF("sysvers_force", 0, share->tmp_table))
+ if (!DBUG_IF("sysvers_force") && share->tmp_table)
{
my_error(ER_VERS_NOT_SUPPORTED, MYF(0), "CREATE TEMPORARY TABLE");
return true;
diff --git a/sql/handler.h b/sql/handler.h
index f60f7956257..ad18ad8b9e4 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -838,7 +838,9 @@ typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
// Set by Sql_cmd_alter_table_truncate_partition::execute()
#define ALTER_PARTITION_TRUNCATE (1ULL << 11)
// Set for REORGANIZE PARTITION
-#define ALTER_PARTITION_TABLE_REORG (1ULL << 12)
+#define ALTER_PARTITION_TABLE_REORG (1ULL << 12)
+#define ALTER_PARTITION_CONVERT_IN (1ULL << 13)
+#define ALTER_PARTITION_CONVERT_OUT (1ULL << 14)
/*
This is master database for most of system tables. However there
@@ -1000,39 +1002,6 @@ struct xid_recovery_member
#define MIN_XID_LIST_SIZE 128
#define MAX_XID_LIST_SIZE (1024*128)
-/*
- These structures are used to pass information from a set of SQL commands
- on add/drop/change tablespace definitions to the proper hton.
-*/
-#define UNDEF_NODEGROUP 65535
-enum ts_command_type
-{
- TS_CMD_NOT_DEFINED = -1,
- CREATE_TABLESPACE = 0,
- ALTER_TABLESPACE = 1,
- CREATE_LOGFILE_GROUP = 2,
- ALTER_LOGFILE_GROUP = 3,
- DROP_TABLESPACE = 4,
- DROP_LOGFILE_GROUP = 5,
- CHANGE_FILE_TABLESPACE = 6,
- ALTER_ACCESS_MODE_TABLESPACE = 7
-};
-
-enum ts_alter_tablespace_type
-{
- TS_ALTER_TABLESPACE_TYPE_NOT_DEFINED = -1,
- ALTER_TABLESPACE_ADD_FILE = 1,
- ALTER_TABLESPACE_DROP_FILE = 2
-};
-
-enum tablespace_access_mode
-{
- TS_NOT_DEFINED= -1,
- TS_READ_ONLY = 0,
- TS_READ_WRITE = 1,
- TS_NOT_ACCESSIBLE = 2
-};
-
/* Statistics about batch operations like bulk_insert */
struct ha_copy_info
{
@@ -1043,50 +1012,6 @@ struct ha_copy_info
ha_rows updated;
};
-struct handlerton;
-class st_alter_tablespace : public Sql_alloc
-{
- public:
- const char *tablespace_name;
- const char *logfile_group_name;
- enum ts_command_type ts_cmd_type;
- enum ts_alter_tablespace_type ts_alter_tablespace_type;
- const char *data_file_name;
- const char *undo_file_name;
- const char *redo_file_name;
- ulonglong extent_size;
- ulonglong undo_buffer_size;
- ulonglong redo_buffer_size;
- ulonglong initial_size;
- ulonglong autoextend_size;
- ulonglong max_size;
- uint nodegroup_id;
- handlerton *storage_engine;
- bool wait_until_completed;
- const char *ts_comment;
- enum tablespace_access_mode ts_access_mode;
- st_alter_tablespace()
- {
- tablespace_name= NULL;
- logfile_group_name= "DEFAULT_LG"; //Default log file group
- ts_cmd_type= TS_CMD_NOT_DEFINED;
- data_file_name= NULL;
- undo_file_name= NULL;
- redo_file_name= NULL;
- extent_size= 1024*1024; //Default 1 MByte
- undo_buffer_size= 8*1024*1024; //Default 8 MByte
- redo_buffer_size= 8*1024*1024; //Default 8 MByte
- initial_size= 128*1024*1024; //Default 128 MByte
- autoextend_size= 0; //No autoextension as default
- max_size= 0; //Max size == initial size => no extension
- storage_engine= NULL;
- nodegroup_id= UNDEF_NODEGROUP;
- wait_until_completed= TRUE;
- ts_comment= NULL;
- ts_access_mode= TS_NOT_DEFINED;
- }
-};
-
/* The handler for a table type. Will be included in the TABLE structure */
struct TABLE;
@@ -1150,6 +1075,7 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len,
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA];
+struct handlerton;
#define view_pseudo_hton ((handlerton *)1)
/*
@@ -1515,8 +1441,7 @@ struct handlerton
bool (*show_status)(handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat);
uint (*partition_flags)();
alter_table_operations (*alter_table_flags)(alter_table_operations flags);
- int (*alter_tablespace)(handlerton *hton, THD *thd, st_alter_tablespace *ts_info);
- int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables,
+ int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables,
class Item *cond,
enum enum_schema_tables);
uint32 flags; /* global handler flags */
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 7b07ab620a6..35948db3d23 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -191,7 +191,7 @@ Host_entry *hostname_cache_first()
static inline Host_entry *hostname_cache_search(const char *ip_key)
{
- return hostname_cache->search((uchar *) ip_key, 0);
+ return hostname_cache->search((uchar *) ip_key, HOST_ENTRY_KEY_SIZE);
}
static void add_hostname_impl(const char *ip_key, const char *hostname,
diff --git a/sql/item.cc b/sql/item.cc
index a63ac1f1119..535fb1328d2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -55,8 +55,8 @@ const char *item_empty_name="";
const char *item_used_name= "\0";
static int save_field_in_field(Field *, bool *, Field *, bool);
-const Item_bool_static Item_false("FALSE", 0);
-const Item_bool_static Item_true("TRUE", 1);
+Item_bool_static *Item_false;
+Item_bool_static *Item_true;
/**
Compare two Items for List<Item>::add_unique()
@@ -445,7 +445,7 @@ Item::Item(THD *thd):
Item::Item():
name(null_clex_str), orig_name(0), is_expensive_cache(-1)
{
- DBUG_ASSERT(my_progname == NULL); // before main()
+ DBUG_ASSERT(!mysqld_server_started); // Created early
base_flags= item_base_t::FIXED;
with_flags= item_with_t::NONE;
null_value= 0;
@@ -4504,6 +4504,22 @@ bool Item_param::is_evaluable_expression() const
}
+bool Item_param::check_assignability_to(const Field *to, bool ignore) const
+{
+ switch (state) {
+ case SHORT_DATA_VALUE:
+ case LONG_DATA_VALUE:
+ case NULL_VALUE:
+ return to->check_assignability_from(type_handler(), ignore);
+ case NO_VALUE:
+ case IGNORE_VALUE:
+ case DEFAULT_VALUE:
+ break;
+ }
+ return false;
+}
+
+
bool Item_param::can_return_value() const
{
// There's no "default". See comments in Item_param::save_in_field().
@@ -9872,9 +9888,11 @@ void Item_trigger_field::set_required_privilege(bool rw)
bool Item_trigger_field::set_value(THD *thd, sp_rcontext * /*ctx*/, Item **it)
{
- Item *item= thd->sp_prepare_func_item(it);
+ if (fix_fields_if_needed(thd, NULL))
+ return true;
- if (!item || fix_fields_if_needed(thd, NULL))
+ Item *item= thd->sp_fix_func_item_for_assignment(field, it);
+ if (!item)
return true;
if (field->vers_sys_field())
return false;
diff --git a/sql/item.h b/sql/item.h
index 1ea748f2578..5122d361dbb 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -772,8 +772,8 @@ enum class item_base_t : item_flags_t
FIXED= (1<<2), // Was fixed with fix_fields().
IS_EXPLICIT_NAME= (1<<3), // The name of this Item was set by the user
// (or was auto generated otherwise)
- IS_IN_WITH_CYCLE= (1<<4) // This item is in CYCLE clause
- // of WITH.
+ IS_IN_WITH_CYCLE= (1<<4), // This item is in CYCLE clause of WITH.
+ AT_TOP_LEVEL= (1<<5) // At top (AND) level of item tree
};
@@ -1327,6 +1327,25 @@ public:
{
set_maybe_null(maybe_null_arg);
}
+ /*
+ Mark the item that it is a top level item, or part of a top level AND item,
+ for WHERE and ON clauses:
+ Example: ... WHERE a=5 AND b=6; Both a=5 and b=6 are top level items
+
+ This is used to indicate that there is no distinction between if the
+ value of the item is FALSE or NULL..
+ This enables Item_cond_and and subquery related items to do special
+ "top level" optimizations.
+ */
+ virtual void top_level_item()
+ {
+ base_flags|= item_base_t::AT_TOP_LEVEL;
+ }
+ /*
+ Return TRUE if this item of top WHERE level (AND/OR)
+ */
+ bool is_top_level_item() const
+ { return (bool) (base_flags & item_base_t::AT_TOP_LEVEL); }
void set_typelib(const TYPELIB *typelib) override
{
@@ -1827,6 +1846,16 @@ public:
*/
virtual bool is_evaluable_expression() const { return true; }
+ virtual bool check_assignability_to(const Field *to, bool ignore) const
+ {
+ /*
+ "this" must be neither DEFAULT/IGNORE,
+ nor Item_param bound to DEFAULT/IGNORE.
+ */
+ DBUG_ASSERT(is_evaluable_expression());
+ return to->check_assignability_from(type_handler(), ignore);
+ }
+
/**
* Check whether the item is a parameter ('?') of stored routine.
* Default implementation returns false. Method is overridden in the class
@@ -2043,25 +2072,6 @@ public:
{
return type_handler()->Item_update_null_value(this);
}
-
- /*
- Inform the item that there will be no distinction between its result
- being FALSE or NULL.
-
- NOTE
- This function will be called for eg. Items that are top-level AND-parts
- of the WHERE clause. Items implementing this function (currently
- Item_cond_and and subquery-related item) enable special optimizations
- when they are "top level".
- */
- virtual void top_level_item() {}
- /*
- Return TRUE if it is item of top WHERE level (AND/OR) and it is
- important, return FALSE if it not important (we can not use to simplify
- calculations) or not top level
- */
- virtual bool is_top_level_item() const
- { return FALSE; /* not important */}
/*
return IN/ALL/ANY subquery or NULL
*/
@@ -2666,7 +2676,7 @@ public:
bool depends_only_on(table_map view_map)
{ return marker & MARKER_FULL_EXTRACTION; }
- int get_extraction_flag()
+ int get_extraction_flag() const
{ return marker & MARKER_EXTRACTION_MASK; }
void set_extraction_flag(int16 flags)
{
@@ -4105,6 +4115,7 @@ class Item_param :public Item_basic_value,
const String *value_query_val_str(THD *thd, String* str) const;
Item *value_clone_item(THD *thd);
bool is_evaluable_expression() const override;
+ bool check_assignability_to(const Field *field, bool ignore) const override;
bool can_return_value() const;
public:
@@ -4451,11 +4462,16 @@ public:
Item_bool_static(const char *str_arg, longlong i):
Item_bool(str_arg, i) {};
+ /* Don't mark static items as top level item */
+ virtual void top_level_item() override {}
void set_join_tab_idx(uint8 join_tab_idx_arg) override
{ DBUG_ASSERT(0); }
+
+ void cleanup() override {}
};
-extern const Item_bool_static Item_false, Item_true;
+/* The following variablese are stored in a read only segment */
+extern Item_bool_static *Item_false, *Item_true;
class Item_uint :public Item_int
{
@@ -6780,6 +6796,10 @@ public:
{
str->append(STRING_WITH_LEN("default"));
}
+ bool check_assignability_to(const Field *to, bool ignore) const override
+ {
+ return false;
+ }
int save_in_field(Field *field_arg, bool) override
{
return field_arg->save_in_field_default_value(false);
@@ -6813,6 +6833,10 @@ public:
{
str->append(STRING_WITH_LEN("ignore"));
}
+ bool check_assignability_to(const Field *to, bool ignore) const override
+ {
+ return false;
+ }
int save_in_field(Field *field_arg, bool) override
{
return field_arg->save_in_field_ignore_value(false);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 74d63629fe9..8b31362a9d9 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1088,14 +1088,14 @@ int Arg_comparator::compare_row()
// NULL was compared
switch (((Item_func*)owner)->functype()) {
case Item_func::NE_FUNC:
- break; // NE never aborts on NULL even if abort_on_null is set
+ break; // NE never aborts on NULL
case Item_func::LT_FUNC:
case Item_func::LE_FUNC:
case Item_func::GT_FUNC:
case Item_func::GE_FUNC:
return -1; // <, <=, > and >= always fail on NULL
case Item_func::EQ_FUNC:
- if (((Item_func_eq*)owner)->abort_on_null)
+ if (owner->is_top_level_item())
return -1; // We do not need correct NULL returning
break;
default:
@@ -1212,12 +1212,6 @@ longlong Item_func_truth::val_int()
}
-bool Item_in_optimizer::is_top_level_item() const
-{
- return args[1]->is_top_level_item();
-}
-
-
void Item_in_optimizer::fix_after_pullout(st_select_lex *new_parent,
Item **ref, bool merge)
{
@@ -1402,7 +1396,8 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
}
base_flags|= (item_base_t::FIXED |
- (args[1]->base_flags & item_base_t::MAYBE_NULL));
+ (args[1]->base_flags & (item_base_t::MAYBE_NULL |
+ item_base_t::AT_TOP_LEVEL)));
with_flags|= (item_with_t::SUBQUERY |
args[1]->with_flags |
(args[0]->with_flags &
@@ -2088,7 +2083,7 @@ bool Item_func_between::eval_not_null_tables(void *opt_arg)
return 1;
/* not_null_tables_cache == union(T1(e),T1(e1),T1(e2)) */
- if (pred_level && !negated)
+ if (is_top_level_item() && !negated)
return 0;
/* not_null_tables_cache == union(T1(e), intersection(T1(e1),T1(e2))) */
@@ -2490,6 +2485,10 @@ bool
Item_func_if::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed() == 0);
+ /*
+ Mark that we don't care if args[0] is NULL or FALSE, we regard both cases as
+ false.
+ */
args[0]->top_level_item();
if (Item_func::fix_fields(thd, ref))
@@ -4415,7 +4414,7 @@ Item_func_in::eval_not_null_tables(void *opt_arg)
return 1;
/* not_null_tables_cache == union(T1(e),union(T1(ei))) */
- if (pred_level && negated)
+ if (is_top_level_item() && negated)
return 0;
/* not_null_tables_cache = union(T1(e),intersection(T1(ei))) */
@@ -4870,9 +4869,10 @@ bool Item_func_bit_and::fix_length_and_dec()
Item_cond::Item_cond(THD *thd, Item_cond *item)
:Item_bool_func(thd, item),
- abort_on_null(item->abort_on_null),
and_tables_cache(item->and_tables_cache)
{
+ base_flags|= (item->base_flags & item_base_t::AT_TOP_LEVEL);
+
/*
item->list will be copied by copy_andor_arguments() call
*/
@@ -4880,7 +4880,7 @@ Item_cond::Item_cond(THD *thd, Item_cond *item)
Item_cond::Item_cond(THD *thd, Item *i1, Item *i2):
- Item_bool_func(thd), abort_on_null(0)
+ Item_bool_func(thd)
{
list.push_back(i1, thd->mem_root);
list.push_back(i2, thd->mem_root);
@@ -4948,7 +4948,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
((Item_cond*) item)->list.empty();
item= *li.ref(); // new current item
}
- if (abort_on_null)
+ if (is_top_level_item())
item->top_level_item();
/*
@@ -4975,7 +4975,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
if (item->can_eval_in_optimize() && !item->with_sp_var() &&
!cond_has_datetime_is_null(item))
{
- if (item->eval_const_cond() == is_and_cond && top_level())
+ if (item->eval_const_cond() == is_and_cond && is_top_level_item())
{
/*
a. This is "... AND true_cond AND ..."
@@ -5032,7 +5032,7 @@ Item_cond::eval_not_null_tables(void *opt_arg)
if (item->can_eval_in_optimize() && !item->with_sp_var() &&
!cond_has_datetime_is_null(item))
{
- if (item->eval_const_cond() == is_and_cond && top_level())
+ if (item->eval_const_cond() == is_and_cond && is_top_level_item())
{
/*
a. This is "... AND true_cond AND ..."
@@ -5496,17 +5496,18 @@ void Item_cond_and::mark_as_condition_AND_part(TABLE_LIST *embedding)
Evaluation of AND(expr, expr, expr ...).
@note
- abort_if_null is set for AND expressions for which we don't care if the
- result is NULL or 0. This is set for:
+ There are AND expressions for which we don't care if the
+ result is NULL or 0. This is the case for:
- WHERE clause
- HAVING clause
- IF(expression)
+ For these we mark them as "top_level_items"
@retval
1 If all expressions are true
@retval
- 0 If all expressions are false or if we find a NULL expression and
- 'abort_on_null' is set.
+ 0 If any of the expressions are false or if we find a NULL expression and
+ this is a top_level_item.
@retval
NULL if all expression are either 1 or NULL
*/
@@ -5522,8 +5523,8 @@ longlong Item_cond_and::val_int()
{
if (!item->val_bool())
{
- if (abort_on_null || !(null_value= item->null_value))
- return 0; // return FALSE
+ if (is_top_level_item() || !(null_value= item->null_value))
+ return 0;
}
}
return null_value ? 0 : 1;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index d0cbc492a20..2d4b73cc6d8 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -411,7 +411,6 @@ public:
void set_join_tab_idx(uint8 join_tab_idx_arg) override
{ args[1]->set_join_tab_idx(join_tab_idx_arg); }
void get_cache_parameters(List<Item> &parameters) override;
- bool is_top_level_item() const override;
bool eval_not_null_tables(void *opt_arg) override;
bool find_not_null_fields(table_map allowed) override;
void fix_after_pullout(st_select_lex *new_parent, Item **ref,
@@ -631,12 +630,8 @@ public:
class Item_func_not :public Item_bool_func
{
- bool abort_on_null;
public:
- Item_func_not(THD *thd, Item *a):
- Item_bool_func(thd, a), abort_on_null(FALSE) {}
- void top_level_item() override { abort_on_null= 1; }
- bool is_top_level_item() const override { return abort_on_null; }
+ Item_func_not(THD *thd, Item *a): Item_bool_func(thd, a) {}
longlong val_int() override;
enum Functype functype() const override { return NOT_FUNC; }
LEX_CSTRING func_name_cstring() const override
@@ -755,11 +750,10 @@ public:
class Item_func_eq :public Item_bool_rowready_func2
{
- bool abort_on_null;
public:
Item_func_eq(THD *thd, Item *a, Item *b):
Item_bool_rowready_func2(thd, a, b),
- abort_on_null(false), in_equality_no(UINT_MAX)
+ in_equality_no(UINT_MAX)
{}
longlong val_int() override;
enum Functype functype() const override { return EQ_FUNC; }
@@ -770,7 +764,6 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("=") };
return name;
}
- void top_level_item() override { abort_on_null= true; }
Item *negated_item(THD *thd) override;
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields,
@@ -956,15 +949,12 @@ protected:
DTCollation cmp_collation;
public:
bool negated; /* <=> the item represents NOT <func> */
- bool pred_level; /* <=> [NOT] <func> is used on a predicate level */
public:
Item_func_opt_neg(THD *thd, Item *a, Item *b, Item *c):
- Item_bool_func(thd, a, b, c), negated(0), pred_level(0) {}
+ Item_bool_func(thd, a, b, c), negated(0) {}
Item_func_opt_neg(THD *thd, List<Item> &list):
- Item_bool_func(thd, list), negated(0), pred_level(0) {}
+ Item_bool_func(thd, list), negated(0) {}
public:
- void top_level_item() override { pred_level= 1; }
- bool is_top_level_item() const override { return pred_level; }
Item *neg_transformer(THD *thd) override
{
negated= !negated;
@@ -2803,11 +2793,9 @@ public:
class Item_func_isnotnull :public Item_func_null_predicate
{
- bool abort_on_null;
public:
Item_func_isnotnull(THD *thd, Item *a):
- Item_func_null_predicate(thd, a), abort_on_null(0)
- { }
+ Item_func_null_predicate(thd, a) {}
longlong val_int() override;
enum Functype functype() const override { return ISNOTNULL_FUNC; }
LEX_CSTRING func_name_cstring() const override
@@ -2817,10 +2805,9 @@ public:
}
enum precedence precedence() const override { return CMP_PRECEDENCE; }
table_map not_null_tables() const override
- { return abort_on_null ? not_null_tables_cache : 0; }
+ { return is_top_level_item() ? not_null_tables_cache : 0; }
Item *neg_transformer(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
- void top_level_item() override { abort_on_null=1; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isnotnull>(thd, this); }
};
@@ -3131,17 +3118,19 @@ class Item_cond :public Item_bool_func
{
protected:
List<Item> list;
- bool abort_on_null;
table_map and_tables_cache;
public:
- /* Item_cond() is only used to create top level items */
- Item_cond(THD *thd): Item_bool_func(thd), abort_on_null(1)
- { const_item_cache=0; }
+ Item_cond(THD *thd): Item_bool_func(thd)
+ {
+ /* Item_cond() is only used to create top level items */
+ top_level_item();
+ const_item_cache=0;
+ }
Item_cond(THD *thd, Item *i1, Item *i2);
Item_cond(THD *thd, Item_cond *item);
Item_cond(THD *thd, List<Item> &nlist):
- Item_bool_func(thd), list(nlist), abort_on_null(0) {}
+ Item_bool_func(thd), list(nlist) {}
bool add(Item *item, MEM_ROOT *root)
{
DBUG_ASSERT(item);
@@ -3188,8 +3177,6 @@ public:
List<Item> &fields, uint flags) override;
friend int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
COND **conds);
- void top_level_item() override { abort_on_null=1; }
- bool top_level() { return abort_on_null; }
void copy_andor_arguments(THD *thd, Item_cond *item);
bool walk(Item_processor processor, bool walk_subquery, void *arg) override;
Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override;
@@ -3546,7 +3533,7 @@ public:
}
enum precedence precedence() const override { return AND_PRECEDENCE; }
table_map not_null_tables() const override
- { return abort_on_null ? not_null_tables_cache: and_tables_cache; }
+ { return is_top_level_item() ? not_null_tables_cache: and_tables_cache; }
Item *copy_andor_structure(THD *thd) override;
Item *neg_transformer(THD *thd) override;
void mark_as_condition_AND_part(TABLE_LIST *embedding) override;
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 1562cab61ed..640e536641a 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -918,6 +918,32 @@ protected:
};
+class Create_func_json_normalize : public Create_func_arg1
+{
+public:
+ virtual Item *create_1_arg(THD *thd, Item *arg1);
+
+ static Create_func_json_normalize s_singleton;
+
+protected:
+ Create_func_json_normalize() {}
+ virtual ~Create_func_json_normalize() {}
+};
+
+
+class Create_func_json_equals : public Create_func_arg2
+{
+public:
+ virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
+
+ static Create_func_json_equals s_singleton;
+
+protected:
+ Create_func_json_equals() {}
+ virtual ~Create_func_json_equals() {}
+};
+
+
class Create_func_json_exists : public Create_func_arg2
{
public:
@@ -1639,6 +1665,15 @@ protected:
virtual ~Create_func_name_const() {}
};
+class Create_func_natural_sort_key : public Create_func_arg1
+{
+public:
+ virtual Item *create_1_arg(THD *thd, Item *arg1) override;
+ static Create_func_natural_sort_key s_singleton;
+protected:
+ Create_func_natural_sort_key() {}
+ virtual ~Create_func_natural_sort_key() {}
+};
class Create_func_nullif : public Create_func_arg2
{
@@ -1944,6 +1979,16 @@ protected:
virtual ~Create_func_sec_to_time() {}
};
+class Create_func_sformat : public Create_native_func
+{
+public:
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
+ static Create_func_sformat s_singleton;
+protected:
+ Create_func_sformat() {}
+ virtual ~Create_func_sformat() {}
+};
class Create_func_sha : public Create_func_arg1
{
@@ -2285,30 +2330,6 @@ protected:
};
-class Create_func_uuid : public Create_func_arg0
-{
-public:
- virtual Item *create_builder(THD *thd);
-
- static Create_func_uuid s_singleton;
-
-protected:
- Create_func_uuid() {}
- virtual ~Create_func_uuid() {}
-};
-
-class Create_func_sys_guid : public Create_func_arg0
-{
-public:
- virtual Item *create_builder(THD *thd);
-
- static Create_func_sys_guid s_singleton;
-
-protected:
- Create_func_sys_guid() {}
- virtual ~Create_func_sys_guid() {}
-};
-
class Create_func_uuid_short : public Create_func_arg0
{
public:
@@ -3657,6 +3678,25 @@ Create_func_isnull::create_1_arg(THD *thd, Item *arg1)
return new (thd->mem_root) Item_func_isnull(thd, arg1);
}
+Create_func_json_normalize Create_func_json_normalize::s_singleton;
+
+Item*
+Create_func_json_normalize::create_1_arg(THD *thd, Item *arg1)
+{
+ status_var_increment(thd->status_var.feature_json);
+ return new (thd->mem_root) Item_func_json_normalize(thd, arg1);
+}
+
+
+Create_func_json_equals Create_func_json_equals::s_singleton;
+
+Item*
+Create_func_json_equals::create_2_arg(THD *thd, Item *arg1, Item *arg2)
+{
+ status_var_increment(thd->status_var.feature_json);
+ return new (thd->mem_root) Item_func_json_equals(thd, arg1, arg2);
+}
+
Create_func_json_exists Create_func_json_exists::s_singleton;
@@ -4658,6 +4698,12 @@ Create_func_md5::create_1_arg(THD *thd, Item *arg1)
return new (thd->mem_root) Item_func_md5(thd, arg1);
}
+Create_func_natural_sort_key Create_func_natural_sort_key::s_singleton;
+
+Item *Create_func_natural_sort_key::create_1_arg(THD *thd, Item* arg1)
+{
+ return new (thd->mem_root) Item_func_natural_sort_key(thd, arg1);
+}
Create_func_monthname Create_func_monthname::s_singleton;
@@ -5026,6 +5072,26 @@ Create_func_sec_to_time::create_1_arg(THD *thd, Item *arg1)
return new (thd->mem_root) Item_func_sec_to_time(thd, arg1);
}
+Create_func_sformat Create_func_sformat::s_singleton;
+
+Item*
+Create_func_sformat::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
+{
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ if (unlikely(arg_count < 1))
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str);
+ return NULL;
+ }
+
+ return new (thd->mem_root) Item_func_sformat(thd, *item_list);
+}
+
Create_func_sha Create_func_sha::s_singleton;
@@ -5344,29 +5410,6 @@ Create_func_unix_timestamp::create_native(THD *thd, const LEX_CSTRING *name,
}
-Create_func_uuid Create_func_uuid::s_singleton;
-
-Item*
-Create_func_uuid::create_builder(THD *thd)
-{
- DBUG_ENTER("Create_func_uuid::create");
- thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
- thd->lex->safe_to_cache_query= 0;
- DBUG_RETURN(new (thd->mem_root) Item_func_uuid(thd, 0));
-}
-
-Create_func_sys_guid Create_func_sys_guid::s_singleton;
-
-Item*
-Create_func_sys_guid::create_builder(THD *thd)
-{
- DBUG_ENTER("Create_func_sys_guid::create");
- thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
- thd->lex->safe_to_cache_query= 0;
- DBUG_RETURN(new (thd->mem_root) Item_func_uuid(thd, 1));
-}
-
-
Create_func_uuid_short Create_func_uuid_short::s_singleton;
Item*
@@ -5613,6 +5656,7 @@ Native_func_registry func_array[] =
{ { STRING_WITH_LEN("JSON_CONTAINS_PATH") }, BUILDER(Create_func_json_contains_path)},
{ { STRING_WITH_LEN("JSON_DEPTH") }, BUILDER(Create_func_json_depth)},
{ { STRING_WITH_LEN("JSON_DETAILED") }, BUILDER(Create_func_json_detailed)},
+ { { STRING_WITH_LEN("JSON_EQUALS") }, BUILDER(Create_func_json_equals)},
{ { STRING_WITH_LEN("JSON_EXISTS") }, BUILDER(Create_func_json_exists)},
{ { STRING_WITH_LEN("JSON_EXTRACT") }, BUILDER(Create_func_json_extract)},
{ { STRING_WITH_LEN("JSON_INSERT") }, BUILDER(Create_func_json_insert)},
@@ -5622,6 +5666,7 @@ Native_func_registry func_array[] =
{ { STRING_WITH_LEN("JSON_MERGE") }, BUILDER(Create_func_json_merge)},
{ { STRING_WITH_LEN("JSON_MERGE_PATCH") }, BUILDER(Create_func_json_merge_patch)},
{ { STRING_WITH_LEN("JSON_MERGE_PRESERVE") }, BUILDER(Create_func_json_merge)},
+ { { STRING_WITH_LEN("JSON_NORMALIZE") }, BUILDER(Create_func_json_normalize)},
{ { STRING_WITH_LEN("JSON_QUERY") }, BUILDER(Create_func_json_query)},
{ { STRING_WITH_LEN("JSON_QUOTE") }, BUILDER(Create_func_json_quote)},
{ { STRING_WITH_LEN("JSON_OBJECT") }, BUILDER(Create_func_json_object)},
@@ -5662,6 +5707,7 @@ Native_func_registry func_array[] =
{ { STRING_WITH_LEN("MD5") }, BUILDER(Create_func_md5)},
{ { STRING_WITH_LEN("MONTHNAME") }, BUILDER(Create_func_monthname)},
{ { STRING_WITH_LEN("NAME_CONST") }, BUILDER(Create_func_name_const)},
+ { {STRING_WITH_LEN("NATURAL_SORT_KEY")}, BUILDER(Create_func_natural_sort_key)},
{ { STRING_WITH_LEN("NVL") }, BUILDER(Create_func_ifnull)},
{ { STRING_WITH_LEN("NVL2") }, BUILDER(Create_func_nvl2)},
{ { STRING_WITH_LEN("NULLIF") }, BUILDER(Create_func_nullif)},
@@ -5691,6 +5737,7 @@ Native_func_registry func_array[] =
{ { STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim)},
{ { STRING_WITH_LEN("RTRIM_ORACLE") }, BUILDER(Create_func_rtrim_oracle)},
{ { STRING_WITH_LEN("SEC_TO_TIME") }, BUILDER(Create_func_sec_to_time)},
+ { { STRING_WITH_LEN("SFORMAT") }, BUILDER(Create_func_sformat)},
{ { STRING_WITH_LEN("SHA") }, BUILDER(Create_func_sha)},
{ { STRING_WITH_LEN("SHA1") }, BUILDER(Create_func_sha)},
{ { STRING_WITH_LEN("SHA2") }, BUILDER(Create_func_sha2)},
@@ -5706,7 +5753,6 @@ Native_func_registry func_array[] =
BUILDER(Create_func_substr_oracle)},
{ { STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)},
{ { STRING_WITH_LEN("SUBTIME") }, BUILDER(Create_func_subtime)},
- { { STRING_WITH_LEN("SYS_GUID") }, BUILDER(Create_func_sys_guid)},
{ { STRING_WITH_LEN("TAN") }, BUILDER(Create_func_tan)},
{ { STRING_WITH_LEN("TIMEDIFF") }, BUILDER(Create_func_timediff)},
{ { STRING_WITH_LEN("TIME_FORMAT") }, BUILDER(Create_func_time_format)},
@@ -5722,7 +5768,6 @@ Native_func_registry func_array[] =
{ { STRING_WITH_LEN("UNIX_TIMESTAMP") }, BUILDER(Create_func_unix_timestamp)},
{ { STRING_WITH_LEN("UPDATEXML") }, BUILDER(Create_func_xml_update)},
{ { STRING_WITH_LEN("UPPER") }, BUILDER(Create_func_ucase)},
- { { STRING_WITH_LEN("UUID") }, BUILDER(Create_func_uuid)},
{ { STRING_WITH_LEN("UUID_SHORT") }, BUILDER(Create_func_uuid_short)},
{ { STRING_WITH_LEN("VERSION") }, BUILDER(Create_func_version)},
{ { STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)},
diff --git a/sql/item_func.cc b/sql/item_func.cc
index eb499b429cd..d01099512f6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1007,7 +1007,8 @@ err:
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
ER_THD(thd, ER_WARN_DATA_OUT_OF_RANGE),
- name.str, 1L);
+ name.str,
+ thd->get_stmt_da()->current_row_for_warning());
return dec;
}
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 1dc511e8da9..37980319d41 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -518,6 +518,66 @@ longlong Item_func_json_valid::val_int()
}
+bool Item_func_json_equals::fix_length_and_dec()
+{
+ if (Item_bool_func::fix_length_and_dec())
+ return TRUE;
+ set_maybe_null();
+ return FALSE;
+}
+
+
+longlong Item_func_json_equals::val_int()
+{
+ longlong result= 0;
+
+ String a_tmp, b_tmp;
+
+ String *a= args[0]->val_json(&a_tmp);
+ String *b= args[1]->val_json(&b_tmp);
+
+ DYNAMIC_STRING a_res;
+ if (init_dynamic_string(&a_res, NULL, 0, 0))
+ {
+ null_value= 1;
+ return 1;
+ }
+
+ DYNAMIC_STRING b_res;
+ if (init_dynamic_string(&b_res, NULL, 0, 0))
+ {
+ dynstr_free(&a_res);
+ null_value= 1;
+ return 1;
+ }
+
+ if ((null_value= args[0]->null_value || args[1]->null_value))
+ {
+ null_value= 1;
+ goto end;
+ }
+
+ if (json_normalize(&a_res, a->ptr(), a->length(), a->charset()))
+ {
+ null_value= 1;
+ goto end;
+ }
+
+ if (json_normalize(&b_res, b->ptr(), b->length(), b->charset()))
+ {
+ null_value= 1;
+ goto end;
+ }
+
+ result= strcmp(a_res.str, b_res.str) ? 0 : 1;
+
+end:
+ dynstr_free(&b_res);
+ dynstr_free(&a_res);
+ return result;
+}
+
+
bool Item_func_json_exists::fix_length_and_dec()
{
if (Item_bool_func::fix_length_and_dec())
@@ -1107,7 +1167,7 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
case JSON_VALUE_OBJECT:
case JSON_VALUE_ARRAY:
case JSON_VALUE_FALSE:
- case JSON_VALUE_UNINITALIZED:
+ case JSON_VALUE_UNINITIALIZED:
case JSON_VALUE_NULL:
int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
return to;
@@ -4077,3 +4137,48 @@ String* Item_func_json_objectagg::val_str(String* str)
}
+String *Item_func_json_normalize::val_str(String *buf)
+{
+ String tmp;
+ String *raw_json= args[0]->val_str(&tmp);
+
+ DYNAMIC_STRING normalized_json;
+ if (init_dynamic_string(&normalized_json, NULL, 0, 0))
+ {
+ null_value= 1;
+ return NULL;
+ }
+
+ null_value= args[0]->null_value;
+ if (null_value)
+ goto end;
+
+ if (json_normalize(&normalized_json,
+ raw_json->ptr(), raw_json->length(),
+ raw_json->charset()))
+ {
+ null_value= 1;
+ goto end;
+ }
+
+ buf->length(0);
+ if (buf->append(normalized_json.str, normalized_json.length))
+ {
+ null_value= 1;
+ goto end;
+ }
+
+end:
+ dynstr_free(&normalized_json);
+ return null_value ? NULL : buf;
+}
+
+
+bool Item_func_json_normalize::fix_length_and_dec()
+{
+ collation.set(&my_charset_utf8mb4_bin);
+ /* 0 becomes 0.0E0, thus one character becomes 5 chars */
+ fix_char_length_ulonglong((ulonglong) args[0]->max_char_length() * 5);
+ set_maybe_null();
+ return FALSE;
+}
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index 6cdd8851663..70993228241 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -107,6 +107,23 @@ public:
};
+class Item_func_json_equals: public Item_bool_func
+{
+public:
+ Item_func_json_equals(THD *thd, Item *a, Item *b):
+ Item_bool_func(thd, a, b) {}
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("json_equals") };
+ return name;
+ }
+ bool fix_length_and_dec() override;
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_json_equals>(thd, this); }
+ longlong val_int() override;
+};
+
+
class Item_func_json_exists: public Item_bool_func
{
protected:
@@ -440,6 +457,24 @@ public:
{ return get_item_copy<Item_func_json_merge_patch>(thd, this); }
};
+
+class Item_func_json_normalize: public Item_json_func
+{
+public:
+ Item_func_json_normalize(THD *thd, Item *a):
+ Item_json_func(thd, a) {}
+ String *val_str(String *) override;
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("json_normalize") };
+ return name;
+ }
+ bool fix_length_and_dec() override;
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_json_normalize>(thd, this); }
+};
+
+
class Item_func_json_length: public Item_long_func
{
bool check_arguments() const override
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 7eee96b3a19..bdae9b78bb4 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -55,6 +55,11 @@ C_MODE_END
#include <sql_repl.h>
#include "sql_statistics.h"
+/* fmtlib include (https://fmt.dev/). */
+#define FMT_STATIC_THOUSANDS_SEPARATOR ','
+#define FMT_HEADER_ONLY 1
+#include "fmt/format-inl.h"
+
size_t username_char_length= USERNAME_CHAR_LENGTH;
/*
@@ -1303,6 +1308,138 @@ bool Item_func_replace::fix_length_and_dec()
return FALSE;
}
+/*
+ this is done in the constructor to be in the same memroot as
+ the item itself
+*/
+Item_func_sformat::Item_func_sformat(THD *thd, List<Item> &list)
+ : Item_str_func(thd, list)
+{
+ val_arg= new (thd->mem_root) String[arg_count];
+}
+
+
+bool Item_func_sformat::fix_length_and_dec()
+{
+ if (!val_arg)
+ return TRUE;
+
+ ulonglong char_length= 0;
+
+ uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
+ MY_COLL_ALLOW_COERCIBLE_CONV |
+ MY_COLL_ALLOW_NUMERIC_CONV;
+
+ if (Type_std_attributes::agg_item_collations(collation, func_name_cstring(),
+ args, arg_count, flags, 1))
+ return TRUE;
+
+ DTCollation c= collation;
+ if (c.collation->mbminlen > 1)
+ c.collation= &my_charset_utf8mb4_bin;
+
+ for (uint i=0 ; i < arg_count ; i++)
+ {
+ char_length+= args[i]->max_char_length();
+ if (args[i]->result_type() == STRING_RESULT &&
+ Type_std_attributes::agg_item_set_converter(c, func_name_cstring(),
+ args+i, 1, flags, 1))
+ return TRUE;
+ }
+
+ fix_char_length_ulonglong(char_length);
+ return FALSE;
+}
+
+/*
+ allow fmt to take String arguments directly.
+ Inherit from string_view, so all string formatting works.
+ but {:p} doesn't, because it's not char*, not a pointer.
+*/
+namespace fmt {
+ template <> struct formatter<String>: formatter<string_view> {
+ template <typename FormatContext>
+ auto format(String c, FormatContext& ctx) -> decltype(ctx.out()) {
+ string_view name = { c.ptr(), c.length() };
+ return formatter<string_view>::format(name, ctx);
+ };
+ };
+};
+
+/*
+ SFORMAT(format_string, ...)
+ This function receives a formatting specification string and N parameters
+ (N >= 0), and it returns string formatted using the rules the user passed
+ in the specification. It uses fmtlib (https://fmt.dev/).
+*/
+String *Item_func_sformat::val_str(String *res)
+{
+ DBUG_ASSERT(fixed());
+ using ctx= fmt::format_context;
+ String *fmt_arg= NULL;
+ String *parg= NULL;
+ fmt::format_args::format_arg *vargs= NULL;
+
+ null_value= true;
+ if (!(fmt_arg= args[0]->val_str(res)))
+ return NULL;
+
+ if (!(vargs= new fmt::format_args::format_arg[arg_count - 1]))
+ return NULL;
+
+ /* Creates the array of arguments for vformat */
+ for (uint carg= 1; carg < arg_count; carg++)
+ {
+ switch (args[carg]->result_type())
+ {
+ case INT_RESULT:
+ vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_int());
+ break;
+ case DECIMAL_RESULT: // TODO
+ case REAL_RESULT:
+ if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
+ vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
+ else
+ vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
+ break;
+ case STRING_RESULT:
+ if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
+ {
+ delete [] vargs;
+ return NULL;
+ }
+ vargs[carg-1]= fmt::detail::make_arg<ctx>(*parg);
+ break;
+ case TIME_RESULT: // TODO
+ case ROW_RESULT: // TODO
+ default:
+ DBUG_ASSERT(0);
+ delete [] vargs;
+ return NULL;
+ }
+ }
+
+ null_value= false;
+ /* Create the string output */
+ try
+ {
+ auto text = fmt::vformat(fmt_arg->c_ptr_safe(),
+ fmt::format_args(vargs, arg_count-1));
+ res->length(0);
+ res->set_charset(collation.collation);
+ res->append(text.c_str(), text.size(), fmt_arg->charset());
+ }
+ catch (const fmt::format_error &ex)
+ {
+ THD *thd= current_thd;
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_SFORMAT_ERROR,
+ ER_THD(thd, WARN_SFORMAT_ERROR), ex.what());
+ null_value= true;
+ }
+ delete [] vargs;
+ return null_value ? NULL : res;
+}
/*********************************************************************/
bool Item_func_regexp_replace::fix_length_and_dec()
@@ -4382,26 +4519,6 @@ err:
#endif
-String *Item_func_uuid::val_str(String *str)
-{
- DBUG_ASSERT(fixed());
- uchar guid[MY_UUID_SIZE];
- size_t length= (without_separators ?
- MY_UUID_ORACLE_STRING_LENGTH :
- MY_UUID_STRING_LENGTH);
-
- str->alloc(length+1);
- str->length(length);
- str->set_charset(system_charset_info);
- my_uuid(guid);
- if (without_separators)
- my_uuid2str_oracle(guid, (char *)str->ptr());
- else
- my_uuid2str(guid, (char *)str->ptr());
- return str;
-}
-
-
Item_func_dyncol_create::Item_func_dyncol_create(THD *thd, List<Item> &args,
DYNCALL_CREATE_DEF *dfs):
Item_str_func(thd, args), defs(dfs), vals(0), keys_num(NULL), keys_str(NULL),
@@ -5307,6 +5424,282 @@ String *Item_temptable_rowid::val_str(String *str)
return &str_value;
}
+/**
+ Helper routine to encode length prefix
+ in natsort_encode_numeric_string().
+
+ The idea is so that bigger input numbers correspond
+ lexicographically bigger output strings.
+
+ Note, that in real use the number would typically
+ small, as it only computes variable *length prefixes*.
+
+ @param[in] n - the number
+ @param[in] s - output string
+
+ @return - length of encoding
+
+ Here is how encoding works
+
+ - n is from 0 to 8
+ Output string calculated as '0'+n (range '0' - '8')
+
+ - n is from 9 to 17
+ Output calculated as concat('9', '0' + n -9)'
+ Output range: '90'-'98'
+
+ -n is from 18 to 26
+ Output calculated as concat('99', '0' + n -18)'
+ Output range '990'-'998'
+
+ - n is from 27 to SIZE_T_MAX
+ Output starts with '999',
+ then log10(n) is encoded as 2-digit decimal number
+ then the number itself is added.
+ Example : for 28 key is concat('999', '01' , '28')
+ i.e '9990128'
+
+ Key length is 5 + ceil(log10(n))
+
+ Output range is
+ (64bit)'9990128' - '9991918446744073709551615'
+ (32bit)'9990128' - '999094294967295'
+*/
+
+/* Largest length of encoded string.*/
+static size_t natsort_encode_length_max(size_t n)
+{
+ return (n < 27) ? n/9+1 : 26;
+}
+
+static void natsort_encode_length(size_t n, String* out)
+{
+ if (n < 27)
+ {
+ if (n >= 9)
+ out->fill(out->length() + n/9,'9');
+ out->append(char(n % 9 + '0'));
+ return;
+ }
+
+ size_t log10n= 0;
+ for (size_t tmp= n / 10; tmp; tmp/= 10)
+ log10n++;
+ out->fill(out->length() + 3, '9');
+ out->append('0' + (char) (log10n / 10));
+ out->append('0' + (char) (log10n % 10));
+ out->append_ulonglong(n);
+}
+
+enum class NATSORT_ERR
+{
+ SUCCESS= 0,
+ KEY_TOO_LARGE= 1,
+ ALLOC_ERROR= 2
+};
+
+/*
+ Encode numeric string for natural sorting.
+
+ @param[in] in - start of the numeric string
+ skipping leading zeros
+
+ @param[in] n_digits - length of the string,
+ in characters, not counting leading zeros.
+
+ @param[out] out - String to write to. The string should
+ have enough preallocated space to fit the encoded key.
+
+ @return
+ NATSORT_ERR::SUCCESS - success
+ NATSORT_ERR::KEY_TOO_LARGE - out string does not have enough
+ space left to accomodate the key.
+
+
+ The resulting encoding of the numeric string is then
+
+ CONCAT(natsort_encode_length(n_digits), in)
+*/
+static NATSORT_ERR natsort_encode_numeric_string(const char *in,
+ size_t n_digits,
+ String *out)
+{
+ DBUG_ASSERT(in);
+ DBUG_ASSERT(n_digits);
+
+ if (out->length() + natsort_encode_length_max(n_digits - 1) + n_digits >
+ out->alloced_length())
+ return NATSORT_ERR::KEY_TOO_LARGE;
+
+ natsort_encode_length(n_digits - 1, out);
+ out->append(in, n_digits);
+ return NATSORT_ERR::SUCCESS;
+}
+
+/*
+ Calculate max size of the natsort key.
+
+ A digit in string expands to 2 chars length_prefix , and the digit
+
+ With even length L=2N, the largest key corresponds to input string
+ in form REPEAT(<digit><letter>,N) and the length of a key is
+ 2N + N = 3N
+
+ With odd input length L=2N+1, largest key is built by appending
+ a digit at the end, with key length 3N+2
+
+*/
+static size_t natsort_max_key_size(size_t input_size)
+{
+ return input_size + (input_size + 1)/2 ;
+}
+
+/**
+ Convert a string to natural sort key.
+ @param[in] in - input string
+ @param[out] out - output string
+ @param[in] max_key_size - the maximum size of the output
+ key, in bytes.
+ @return NATSORT_ERR::SUCCESS - successful completion
+ NATSORT_ERR::ALLOC_ERROR - memory allocation error
+ NATSORT_ERR::KEY_TOO_LARGE - resulting key would exceed max_key_size
+*/
+static NATSORT_ERR to_natsort_key(const String *in, String *out,
+ size_t max_key_size)
+{
+ size_t n_digits= 0;
+ size_t n_lead_zeros= 0;
+ size_t num_start;
+ size_t reserve_length= std::min(
+ natsort_max_key_size(in->length()) + MAX_BIGINT_WIDTH + 2, max_key_size);
+
+ out->length(0);
+ out->set_charset(in->charset());
+
+ if (out->alloc((uint32) reserve_length))
+ return NATSORT_ERR::ALLOC_ERROR;
+
+ for (size_t pos= 0;; pos++)
+ {
+ char c= pos < in->length() ? (*in)[pos] : 0;
+ bool is_digit= (c >= '0' && c <= '9');
+ if (!is_digit && (n_digits || n_lead_zeros))
+ {
+ /* Handle end of digits run.*/
+ if (!n_digits)
+ {
+ /*We only have zeros.*/
+ n_lead_zeros--;
+ num_start= pos - 1;
+ n_digits= 1;
+ }
+ NATSORT_ERR err= natsort_encode_numeric_string(
+ in->ptr() + num_start, n_digits, out);
+ if (err != NATSORT_ERR::SUCCESS)
+ return err;
+
+ /* Reset state.*/
+ n_digits= 0;
+ num_start= size_t(-1);
+ n_lead_zeros= 0;
+ }
+
+ if (pos == in->length())
+ break;
+
+ if (!is_digit)
+ {
+ if (out->length() == max_key_size)
+ return NATSORT_ERR::KEY_TOO_LARGE;
+ out->append(c);
+ }
+ else if (c == '0' && !n_digits)
+ n_lead_zeros++;
+ else if (!n_digits++)
+ num_start= pos;
+ }
+ return NATSORT_ERR::SUCCESS;
+}
+
+String *Item_func_natural_sort_key::val_str(String *out)
+{
+ String *in= args[0]->val_str();
+ if (args[0]->null_value || !in)
+ {
+ null_value= true;
+ return nullptr;
+ }
+ NATSORT_ERR err= NATSORT_ERR::SUCCESS;
+ CHARSET_INFO *cs= in->charset();
+ ulong max_allowed_packet= current_thd->variables.max_allowed_packet;
+ uint errs;
+ String tmp;
+ /*
+ to_natsort_key() only support charsets where digits are represented by
+ a single byte in range 0x30-0x39. Almost everything is OK, just utf16/32
+ won't do. Full ASCII compatibility is not required, so that SJIS and SWE7
+ are fine.
+ */
+ if (cs->mbminlen != 1)
+ {
+ if (tmp.copy(in, &my_charset_utf8mb4_bin, &errs))
+ goto error_exit;
+ in= &tmp;
+ }
+
+ err= to_natsort_key(in, out, max_allowed_packet / cs->mbminlen);
+
+ if (err != NATSORT_ERR::SUCCESS)
+ {
+ if (err == NATSORT_ERR::KEY_TOO_LARGE)
+ {
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
+ max_allowed_packet);
+ }
+ goto error_exit;
+ }
+
+ if (cs->mbminlen != 1)
+ {
+ /* output string is now utf8, convert to input charset.*/
+ if (tmp.copy(out, cs, &errs) || out->copy(tmp))
+ goto error_exit;
+ }
+ null_value= false;
+ return out;
+
+error_exit:
+ null_value= true;
+ return nullptr;
+}
+
+bool Item_func_natural_sort_key::fix_length_and_dec(void)
+{
+ if (agg_arg_charsets_for_string_result(collation, args, 1))
+ return true;
+ DBUG_ASSERT(collation.collation != NULL);
+ uint32 max_char_len=
+ (uint32) natsort_max_key_size(args[0]->max_char_length());
+ fix_char_length(max_char_len);
+
+ set_maybe_null(args[0]->maybe_null() ||
+ max_char_len * collation.collation->mbmaxlen >
+ current_thd->variables.max_allowed_packet);
+ return false;
+}
+
+/**
+ Disable use in stored virtual functions. Temporarily(?), until
+ the encoding is stable.
+*/
+bool Item_func_natural_sort_key::check_vcol_func_processor(void *arg)
+{
+ return mark_unsupported_function(func_name(), "()", arg,
+ VCOL_NON_DETERMINISTIC);
+}
+
#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
#include "wsrep_server_state.h"
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index d0bdbeabaa5..c183f1c1ac2 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -271,6 +271,25 @@ public:
{ return get_item_copy<Item_func_aes_decrypt>(thd, this); }
};
+class Item_func_natural_sort_key : public Item_str_func
+{
+public:
+ Item_func_natural_sort_key(THD *thd, Item *a)
+ : Item_str_func(thd, a){};
+ String *val_str(String *) override;
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("natural_sort_key")};
+ return name;
+ }
+ bool fix_length_and_dec(void) override;
+ Item *get_copy(THD *thd) override
+ {
+ return get_item_copy<Item_func_natural_sort_key>(thd, this);
+ }
+
+ bool check_vcol_func_processor(void *arg) override;
+};
class Item_func_concat :public Item_str_func
{
@@ -586,6 +605,23 @@ public:
{ return get_item_copy<Item_func_substr>(thd, this); }
};
+class Item_func_sformat :public Item_str_func
+{
+ String *val_arg;
+public:
+ Item_func_sformat(THD *thd, List<Item> &list);
+ ~Item_func_sformat() { delete [] val_arg; }
+ String *val_str(String*) override;
+ bool fix_length_and_dec() override;
+ LEX_CSTRING func_name_cstring() const override
+ {
+ static LEX_CSTRING name= {STRING_WITH_LEN("sformat") };
+ return name;
+ }
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_sformat>(thd, this); }
+};
+
class Item_func_substr_oracle :public Item_func_substr
{
protected:
@@ -1995,40 +2031,6 @@ public:
};
-class Item_func_uuid: public Item_str_func
-{
- /* Set if uuid should be returned without separators (Oracle sys_guid) */
- bool without_separators;
-public:
-Item_func_uuid(THD *thd, bool without_separators_arg): Item_str_func(thd),
- without_separators(without_separators_arg)
- {}
- bool fix_length_and_dec() override
- {
- collation.set(DTCollation_numeric());
- fix_char_length(without_separators ? MY_UUID_ORACLE_STRING_LENGTH :
- MY_UUID_STRING_LENGTH);
- return FALSE;
- }
- bool const_item() const override { return false; }
- table_map used_tables() const override { return RAND_TABLE_BIT; }
- LEX_CSTRING func_name_cstring() const override
- {
- static LEX_CSTRING mariadb_name= {STRING_WITH_LEN("uuid") };
- static LEX_CSTRING oracle_name= {STRING_WITH_LEN("sys_guid") };
- return without_separators ? oracle_name : mariadb_name;
- }
- String *val_str(String *) override;
- bool check_vcol_func_processor(void *arg) override
- {
- return mark_unsupported_function(func_name(), "()", arg,
- VCOL_NON_DETERMINISTIC);
- }
- Item *get_copy(THD *thd) override
- { return get_item_copy<Item_func_uuid>(thd, this); }
-};
-
-
class Item_func_dyncol_create: public Item_str_func
{
protected:
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 860ba1dbf91..f509e00b8f6 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1577,7 +1577,7 @@ bool Item_singlerow_subselect::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t
Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex):
- Item_subselect(thd), upper_not(NULL), abort_on_null(0),
+ Item_subselect(thd), upper_not(NULL),
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
@@ -1662,7 +1662,6 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
func= func_creator(all_arg);
init(select_lex, new (thd->mem_root) select_exists_subselect(thd, this));
max_columns= 1;
- abort_on_null= 0;
reset();
//if test_limit will fail then error will be reported to client
test_limit(select_lex->master_unit());
@@ -2237,8 +2236,11 @@ bool Item_allany_subselect::is_maxmin_applicable(JOIN *join)
Check if max/min optimization applicable: It is top item of
WHERE condition.
*/
- return (abort_on_null || (upper_item && upper_item->is_top_level_item())) &&
- !(join->select_lex->master_unit()->uncacheable & ~UNCACHEABLE_EXPLAIN) && !func->eqne_op();
+ return ((is_top_level_item() ||
+ (upper_item && upper_item->is_top_level_item())) &&
+ !(join->select_lex->master_unit()->uncacheable &
+ ~UNCACHEABLE_EXPLAIN) &&
+ !func->eqne_op());
}
@@ -2308,7 +2310,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
ref_pointer_array[0],
{STRING_WITH_LEN("<ref>")},
field_name));
- if (!abort_on_null && left_expr->maybe_null())
+ if (!is_top_level_item() && left_expr->maybe_null())
{
/*
We can encounter "NULL IN (SELECT ...)". Wrap the added condition
@@ -2341,7 +2343,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
Item *orig_item= item;
item= func->create(thd, expr, item);
- if (!abort_on_null && orig_item->maybe_null())
+ if (!is_top_level_item() && orig_item->maybe_null())
{
having= new (thd->mem_root) Item_is_not_null_test(thd, this, having);
if (left_expr->maybe_null())
@@ -2363,7 +2365,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
If we may encounter NULL IN (SELECT ...) and care whether subquery
result is NULL or FALSE, wrap condition in a trig_cond.
*/
- if (!abort_on_null && left_expr->maybe_null())
+ if (!is_top_level_item() && left_expr->maybe_null())
{
disable_cond_guard_for_const_null_left_expr(0);
if (!(item= new (thd->mem_root) Item_func_trig_cond(thd, item,
@@ -2393,7 +2395,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
&select_lex->ref_pointer_array[0],
no_matter_name,
field_name));
- if (!abort_on_null && left_expr->maybe_null())
+ if (!is_top_level_item() && left_expr->maybe_null())
{
disable_cond_guard_for_const_null_left_expr(0);
if (!(new_having= new (thd->mem_root)
@@ -2592,7 +2594,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
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() &&
+ if (!is_top_level_item() && left_expr->element_index(i)->maybe_null() &&
get_cond_guard(i))
{
disable_cond_guard_for_const_null_left_expr(i);
@@ -2611,7 +2613,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
ref_pointer_array[i],
no_matter_name,
list_ref));
- if (!abort_on_null && left_expr->element_index(i)->maybe_null() &&
+ if (!is_top_level_item() && left_expr->element_index(i)->maybe_null() &&
get_cond_guard(i) )
{
disable_cond_guard_for_const_null_left_expr(i);
@@ -2652,7 +2654,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
ref_pointer_array[i],
no_matter_name,
list_ref));
- if (!abort_on_null && select_lex->ref_pointer_array[i]->maybe_null())
+ if (!is_top_level_item() && select_lex->ref_pointer_array[i]->maybe_null())
{
Item *having_col_item=
new (thd->mem_root)
@@ -2684,7 +2686,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
}
*having_item= and_items(thd, *having_item, having_col_item);
}
- if (!abort_on_null && left_expr->element_index(i)->maybe_null() &&
+ if (!is_top_level_item() && left_expr->element_index(i)->maybe_null() &&
get_cond_guard(i))
{
if (!(item= new (thd->mem_root)
@@ -3655,7 +3657,7 @@ bool Item_in_subselect::init_cond_guards()
{
DBUG_ASSERT(thd);
uint cols_num= left_expr->cols();
- if (!abort_on_null && !pushed_cond_guards &&
+ if (!is_top_level_item() && !pushed_cond_guards &&
(left_expr->maybe_null() || cols_num > 1))
{
if (!(pushed_cond_guards= (bool*)thd->alloc(sizeof(bool) * cols_num)))
@@ -4241,9 +4243,9 @@ bool subselect_uniquesubquery_engine::copy_ref_key(bool skip_constants)
- NULL if select produces empty row set
- FALSE otherwise.
- In some cases (IN subselect is a top level item, i.e. abort_on_null==TRUE)
- the caller doesn't distinguish between NULL and FALSE result and we just
- return FALSE.
+ In some cases (IN subselect is a top level item, i.e.
+ is_top_level_item() == TRUE, the caller doesn't distinguish between NULL and
+ FALSE result and we just return FALSE.
Otherwise we make a full table scan to see if there is at least one
matching row.
@@ -5098,7 +5100,7 @@ my_bitmap_init_memroot(MY_BITMAP *map, uint n_bits, MEM_ROOT *mem_root)
if (!(bitmap_buf= (my_bitmap_map*) alloc_root(mem_root,
bitmap_buffer_size(n_bits))) ||
- my_bitmap_init(map, bitmap_buf, n_bits, FALSE))
+ my_bitmap_init(map, bitmap_buf, n_bits))
return TRUE;
bitmap_clear_all(map);
return FALSE;
@@ -5987,7 +5989,7 @@ bool Ordered_key::alloc_keys_buffers()
lookup offset.
*/
/* Notice that max_null_row is max array index, we need count, so +1. */
- if (my_bitmap_init(&null_key, NULL, (uint)(max_null_row + 1), FALSE))
+ if (my_bitmap_init(&null_key, NULL, (uint)(max_null_row + 1)))
return TRUE;
cur_key_idx= HA_POS_ERROR;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 69154fef8e8..4b672243ee0 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -372,7 +372,6 @@ class Item_exists_subselect :public Item_subselect
protected:
Item_func_not *upper_not;
bool value; /* value of this item (boolean: exists/not-exists) */
- bool abort_on_null;
void init_length_and_dec();
bool select_prepare_to_be_in();
@@ -396,7 +395,7 @@ public:
Item_exists_subselect(THD *thd_arg, st_select_lex *select_lex);
Item_exists_subselect(THD *thd_arg):
- Item_subselect(thd_arg), upper_not(NULL), abort_on_null(0),
+ Item_subselect(thd_arg), upper_not(NULL),
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{}
@@ -423,8 +422,6 @@ public:
bool fix_length_and_dec() override;
void print(String *str, enum_query_type query_type) override;
bool select_transformer(JOIN *join) override;
- void top_level_item() override { abort_on_null=1; }
- bool is_top_level_item() const override { return abort_on_null; }
bool exists2in_processor(void *opt_arg) override;
Item* expr_cache_insert_transformer(THD *thd, uchar *unused) override;
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 2f4d34afc6d..a130be4f973 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -1232,13 +1232,13 @@ my_xpath_keyword(MY_XPATH *x,
static Item *create_func_true(MY_XPATH *xpath, Item **args, uint nargs)
{
- return (Item*) &Item_true;
+ return (Item*) Item_true;
}
static Item *create_func_false(MY_XPATH *xpath, Item **args, uint nargs)
{
- return (Item*) &Item_false;
+ return (Item*) Item_false;
}
diff --git a/sql/json_table.cc b/sql/json_table.cc
index 65fe3c9a659..21782a9f14b 100644
--- a/sql/json_table.cc
+++ b/sql/json_table.cc
@@ -886,8 +886,7 @@ TABLE *create_table_for_function(THD *thd, TABLE_LIST *sql_table)
my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
- my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
- FALSE);
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count);
table->read_set= &table->def_read_set;
bitmap_clear_all(table->read_set);
table->alias_name_used= true;
diff --git a/sql/lex.h b/sql/lex.h
index cbf9d9d51b2..4ce88ccc2ee 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -110,6 +110,7 @@ SYMBOL symbols[] = {
{ "CHAIN", SYM(CHAIN_SYM)},
{ "CHANGE", SYM(CHANGE)},
{ "CHANGED", SYM(CHANGED)},
+ { "CHANNEL", SYM(CHANNEL_SYM)},
{ "CHAR", SYM(CHAR_SYM)},
{ "CHARACTER", SYM(CHAR_SYM)},
{ "CHARSET", SYM(CHARSET)},
@@ -567,6 +568,8 @@ SYMBOL symbols[] = {
{ "ROWTYPE", SYM(ROWTYPE_MARIADB_SYM)},
{ "ROW_COUNT", SYM(ROW_COUNT_SYM)},
{ "ROW_FORMAT", SYM(ROW_FORMAT_SYM)},
+ /** sql_function and condition_property_name for GET DIAGNOSTICS */
+ { "ROW_NUMBER", SYM(ROW_NUMBER_SYM)},
{ "RTREE", SYM(RTREE_SYM)},
{ "SAVEPOINT", SYM(SAVEPOINT_SYM)},
{ "SCHEDULE", SYM(SCHEDULE_SYM)},
@@ -781,7 +784,6 @@ SYMBOL sql_functions[] = {
{ "PERCENTILE_CONT", SYM(PERCENTILE_CONT_SYM)},
{ "PERCENTILE_DISC", SYM(PERCENTILE_DISC_SYM)},
{ "RANK", SYM(RANK_SYM)},
- { "ROW_NUMBER", SYM(ROW_NUMBER_SYM)},
{ "SESSION_USER", SYM(USER_SYM)},
{ "STD", SYM(STD_SYM)},
{ "STDDEV", SYM(STD_SYM)},
diff --git a/sql/lock.cc b/sql/lock.cc
index 1099a5c2fb1..0767b787bec 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2020, MariaDB
+ Copyright (c) 2020, 2021, 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
@@ -1141,6 +1141,9 @@ void Global_read_lock::unlock_global_read_lock(THD *thd)
else if (WSREP_NNULL(thd) &&
server_state.state() == Wsrep_server_state::s_synced)
{
+ THD_STAGE_INFO(thd, stage_waiting_flow);
+ WSREP_DEBUG("unlock_global_read_lock: waiting for flow control for %s",
+ wsrep_thd_query(thd));
server_state.resume_and_resync();
wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED;
}
diff --git a/sql/log.cc b/sql/log.cc
index b8f8d3daae7..282db568621 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2664,12 +2664,11 @@ static void setup_windows_event_source()
static int find_uniq_filename(char *name, ulong min_log_number_to_use,
ulong *last_used_log_number)
{
- uint i;
char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info;
struct fileinfo *file_info;
ulong max_found= 0, next= 0, number= 0;
- size_t buf_length, length;
+ size_t i, buf_length, length;
char *start, *end;
int error= 0;
DBUG_ENTER("find_uniq_filename");
@@ -3000,7 +2999,7 @@ int MYSQL_BIN_LOG::generate_new_name(char *new_name, const char *log_name,
fn_format(new_name, log_name, mysql_data_home, "", 4);
if (!fn_ext(log_name)[0])
{
- if (DBUG_EVALUATE_IF("binlog_inject_new_name_error", TRUE, FALSE) ||
+ if (DBUG_IF("binlog_inject_new_name_error") ||
unlikely(find_uniq_filename(new_name, next_log_number,
&last_used_log_number)))
{
@@ -3571,7 +3570,7 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
mysql_file_seek(index_file_nr, 0L, MY_SEEK_END, MYF(0)),
0, MYF(MY_WME | MY_WAIT_IF_FULL),
m_key_file_log_index_cache) ||
- DBUG_EVALUATE_IF("fault_injection_openning_index", 1, 0))
+ DBUG_IF("fault_injection_openning_index"))
{
/*
TODO: all operations creating/deleting the index file or a log, should
@@ -3597,7 +3596,7 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
open_purge_index_file(FALSE) ||
purge_index_entry(NULL, NULL, need_mutex) ||
close_purge_index_file() ||
- DBUG_EVALUATE_IF("fault_injection_recovering_index", 1, 0))
+ DBUG_IF("fault_injection_recovering_index"))
{
sql_print_error("MYSQL_BIN_LOG::open_index_file failed to sync the index "
"file.");
@@ -3666,7 +3665,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
if (open_purge_index_file(TRUE) ||
register_create_index_entry(log_file_name) ||
sync_purge_index_file() ||
- DBUG_EVALUATE_IF("fault_injection_registering_index", 1, 0))
+ DBUG_IF("fault_injection_registering_index"))
{
/**
TODO:
@@ -3948,7 +3947,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
As this is a new log file, we write the file name to the index
file. As every time we write to the index file, we sync it.
*/
- if (DBUG_EVALUATE_IF("fault_injection_updating_index", 1, 0) ||
+ if (DBUG_IF("fault_injection_updating_index") ||
my_b_write(&index_file, (uchar*) log_file_name,
strlen(log_file_name)) ||
my_b_write(&index_file, (uchar*) "\n", 1) ||
@@ -5361,8 +5360,8 @@ int MYSQL_BIN_LOG::new_file_impl()
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) ||
+ if ((DBUG_IF("fault_injection_new_file_rotate_event") &&
+ (error= close_on_error= TRUE)) ||
(error= write_event(&r)))
{
DBUG_EXECUTE_IF("fault_injection_new_file_rotate_event", errno= 2;);
@@ -6775,7 +6774,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
Write the event.
*/
if (write_event(event_info, cache_data, file) ||
- DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
+ DBUG_IF("injecting_fault_writing"))
goto err;
error= 0;
@@ -7557,9 +7556,9 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
if (likely(is_open()))
{
prev_binlog_id= current_binlog_id;
- if (likely(
- !(error= DBUG_EVALUATE_IF("incident_event_write_error", 1,
- write_incident_already_locked(thd)))) &&
+ if (likely(!(error= DBUG_IF("incident_event_write_error")
+ ? 1
+ : write_incident_already_locked(thd))) &&
likely(!(error= flush_and_sync(0))))
{
update_binlog_end_pos();
@@ -8552,7 +8551,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
DEBUG_SYNC(leader->thd, "commit_loop_entry_commit_ordered");
++num_commits;
if (current->cache_mngr->using_xa && likely(!current->error) &&
- DBUG_EVALUATE_IF("skip_commit_ordered", 0, 1))
+ !DBUG_IF("skip_commit_ordered"))
{
mysql_mutex_lock(&current->thd->LOCK_thd_data);
run_commit_ordered(current->thd, current->all);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 53785a89f1e..856e4e1cb7f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3347,8 +3347,7 @@ Rows_log_event::Rows_log_event(const uchar *buf, uint event_len,
/* 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)))
+ m_width)))
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
memcpy(m_cols.bitmap, ptr_after_width, (m_width + 7) / 8);
@@ -3372,8 +3371,7 @@ Rows_log_event::Rows_log_event(const uchar *buf, uint event_len,
/* 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)))
+ m_width)))
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
memcpy(m_cols_ai.bitmap, ptr_after_width, (m_width + 7) / 8);
diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc
index f63761ffa3f..b955b7a0f57 100644
--- a/sql/log_event_client.cc
+++ b/sql/log_event_client.cc
@@ -1184,7 +1184,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
}
/* Copying rows from the end to the begining into event */
- for (uint i= rows_arr.elements; i > 0; --i)
+ for (size_t i= rows_arr.elements; i > 0; --i)
{
LEX_STRING *one_row= dynamic_element(&rows_arr, i - 1, LEX_STRING*);
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 4e6b9e3f1c8..1990103598e 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1156,8 +1156,7 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
/* 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)))
+ m_width)))
{
/* Cols can be zero if this is a dummy binrows event */
if (likely(cols != NULL))
@@ -1232,8 +1231,7 @@ Old_rows_log_event::Old_rows_log_event(const uchar *buf, uint event_len,
/* 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)))
+ m_width)))
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
memcpy(m_cols.bitmap, ptr_after_width, (m_width + 7) / 8);
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
index 66a39cc9e66..e22ad48489c 100644
--- a/sql/log_event_server.cc
+++ b/sql/log_event_server.cc
@@ -471,7 +471,7 @@ static void cleanup_load_tmpdir(LEX_CSTRING *connection_name)
{
MY_DIR *dirp;
FILEINFO *file;
- uint i;
+ size_t i;
char dir[FN_REFLEN], fname[FN_REFLEN];
char prefbuf[31 + MAX_CONNECTION_NAME* MAX_FILENAME_MBWIDTH + 1];
DBUG_ENTER("cleanup_load_tmpdir");
@@ -492,7 +492,7 @@ static void cleanup_load_tmpdir(LEX_CSTRING *connection_name)
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++)
+ for (i=0 ; i < dirp->number_of_files; i++)
{
file=dirp->dir_entry+i;
if (is_prefix(file->name, prefbuf))
@@ -5232,8 +5232,7 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
/* 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)))
+ m_width)))
{
/* Cols can be zero if this is a dummy binrows event */
if (likely(cols != NULL))
@@ -6463,7 +6462,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
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->table_id= DBUG_IF("inject_tblmap_same_id_maps_diff_table") ? 0 : m_table_id;
table_list->updating= 1;
table_list->required_type= TABLE_TYPE_NORMAL;
@@ -6703,7 +6702,7 @@ void Table_map_log_event::init_metadata_fields()
if (binlog_row_metadata == BINLOG_ROW_METADATA_FULL)
{
- if (DBUG_EVALUATE_IF("dont_log_column_name", 0, init_column_name_field()) ||
+ if ((!DBUG_IF("dont_log_column_name") && 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() ||
@@ -8285,8 +8284,7 @@ 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)))
+ m_width)))
{
/* Cols can be zero if this is a dummy binrows event */
if (likely(cols != NULL))
diff --git a/sql/mdl.cc b/sql/mdl.cc
index f1c9c6e0444..c7cdb639827 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -2328,6 +2328,20 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
DBUG_RETURN(TRUE);
}
+#ifdef WITH_WSREP
+ if (WSREP(get_thd()))
+ {
+ THD* requester= get_thd();
+ bool requester_toi= wsrep_thd_is_toi(requester) || wsrep_thd_is_applying(requester);
+ WSREP_DEBUG("::acquire_lock is TOI %d for %s", requester_toi,
+ wsrep_thd_query(requester));
+ if (requester_toi)
+ THD_STAGE_INFO(requester, stage_waiting_ddl);
+ else
+ THD_STAGE_INFO(requester, stage_waiting_isolation);
+ }
+#endif /* WITH_WSREP */
+
lock->m_waiting.add_ticket(ticket);
/*
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 988ffd678f4..04b1f65715b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -370,6 +370,7 @@ uint volatile global_disable_checkpoint;
ulong slow_start_timeout;
#endif
static MEM_ROOT startup_root;
+MEM_ROOT read_only_root;
/**
@brief 'grant_option' is used to indicate if privileges needs
@@ -641,7 +642,23 @@ struct system_variables max_system_variables;
struct system_status_var global_status_var;
MY_TMPDIR mysql_tmpdir_list;
-MY_BITMAP temp_pool;
+static MY_BITMAP temp_pool;
+static mysql_mutex_t LOCK_temp_pool;
+
+void temp_pool_clear_bit(uint bit)
+{
+ mysql_mutex_lock(&LOCK_temp_pool);
+ bitmap_clear_bit(&temp_pool, bit);
+ mysql_mutex_unlock(&LOCK_temp_pool);
+}
+
+uint temp_pool_set_next()
+{
+ mysql_mutex_lock(&LOCK_temp_pool);
+ uint res= bitmap_set_next(&temp_pool);
+ mysql_mutex_unlock(&LOCK_temp_pool);
+ return res;
+}
CHARSET_INFO *system_charset_info, *files_charset_info ;
CHARSET_INFO *national_charset_info, *table_alias_charset;
@@ -888,7 +905,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_manager, key_LOCK_backup_log,
key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started,
- key_LOCK_status,
+ key_LOCK_status, key_LOCK_temp_pool,
key_LOCK_system_variables_hash, key_LOCK_thd_data, key_LOCK_thd_kill,
key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
@@ -946,6 +963,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_hash_filo_lock, "hash_filo::lock", 0},
{ &key_LOCK_active_mi, "LOCK_active_mi", PSI_FLAG_GLOBAL},
{ &key_LOCK_backup_log, "LOCK_backup_log", PSI_FLAG_GLOBAL},
+ { &key_LOCK_temp_pool, "LOCK_temp_pool", 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},
@@ -1510,6 +1528,16 @@ static void end_ssl();
#ifndef EMBEDDED_LIBRARY
+extern Atomic_counter<uint32_t> local_connection_thread_count;
+
+uint THD_count::connection_thd_count()
+{
+ return value() -
+ binlog_dump_thread_count -
+ local_connection_thread_count;
+}
+
+
/****************************************************************************
** Code to end mysqld
****************************************************************************/
@@ -1537,10 +1565,9 @@ static my_bool kill_thread_phase_1(THD *thd, int *n_threads_awaiting_ack)
++(*n_threads_awaiting_ack)))
return 0;
- if (DBUG_EVALUATE_IF("only_kill_system_threads", !thd->system_thread, 0))
+ if (DBUG_IF("only_kill_system_threads") && !thd->system_thread)
return 0;
- if (DBUG_EVALUATE_IF("only_kill_system_threads_no_loop",
- !thd->system_thread, 0))
+ if (DBUG_IF("only_kill_system_threads_no_loop") && !thd->system_thread)
return 0;
thd->awake(KILL_SERVER_HARD);
@@ -1772,12 +1799,13 @@ static void close_connections(void)
*/
DBUG_PRINT("info", ("THD_count: %u", THD_count::value()));
- for (int i= 0; (THD_count::value() - binlog_dump_thread_count -
- n_threads_awaiting_ack) &&
- i < 1000 &&
- DBUG_EVALUATE_IF("only_kill_system_threads_no_loop", 0, 1);
- i++)
+ for (int i= 0; THD_count::connection_thd_count() - n_threads_awaiting_ack
+ && i < 1000; i++)
+ {
+ if (DBUG_IF("only_kill_system_threads_no_loop"))
+ break;
my_sleep(20000);
+ }
if (global_system_variables.log_warnings)
server_threads.iterate(warn_threads_active_after_phase_1);
@@ -1791,19 +1819,18 @@ static void close_connections(void)
#endif
/* All threads has now been aborted */
DBUG_PRINT("quit", ("Waiting for threads to die (count=%u)",
- THD_count::value() - binlog_dump_thread_count -
- n_threads_awaiting_ack));
+ THD_count::connection_thd_count() - n_threads_awaiting_ack));
- while ((THD_count::value() - binlog_dump_thread_count -
- n_threads_awaiting_ack) &&
- DBUG_EVALUATE_IF("only_kill_system_threads_no_loop", 0, 1))
+ while (THD_count::connection_thd_count() - n_threads_awaiting_ack)
{
+ if (DBUG_IF("only_kill_system_threads_no_loop"))
+ break;
my_sleep(1000);
}
/* Kill phase 2 */
server_threads.iterate(kill_thread_phase_2);
- for (uint64 i= 0; THD_count::value(); i++)
+ for (uint64 i= 0; THD_count::value() > local_connection_thread_count; i++)
{
/*
This time the warnings are emitted within the loop to provide a
@@ -2015,6 +2042,8 @@ static void clean_up(bool print_message)
mysql_library_end();
finish_client_errs();
free_root(&startup_root, MYF(0));
+ protect_root(&read_only_root, PROT_READ | PROT_WRITE);
+ free_root(&read_only_root, MYF(0));
cleanup_errmsgs();
free_error_messages();
/* Tell main we are ready */
@@ -2094,6 +2123,7 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_active_mi);
mysql_rwlock_destroy(&LOCK_ssl_refresh);
mysql_mutex_destroy(&LOCK_backup_log);
+ mysql_mutex_destroy(&LOCK_temp_pool);
mysql_rwlock_destroy(&LOCK_sys_init_connect);
mysql_rwlock_destroy(&LOCK_sys_init_slave);
mysql_mutex_destroy(&LOCK_global_system_variables);
@@ -3289,7 +3319,7 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
{
if (unlikely(MyFlags & ME_FATAL))
thd->is_fatal_error= 1;
- (void) thd->raise_condition(error, NULL, level, str);
+ (void) thd->raise_condition(error, "\0\0\0\0\0", level, str);
}
else
mysql_audit_general(0, MYSQL_AUDIT_GENERAL_ERROR, error, str);
@@ -3403,7 +3433,6 @@ SHOW_VAR com_status_vars[]= {
{"alter_server", STMT_STATUS(SQLCOM_ALTER_SERVER)},
{"alter_sequence", STMT_STATUS(SQLCOM_ALTER_SEQUENCE)},
{"alter_table", STMT_STATUS(SQLCOM_ALTER_TABLE)},
- {"alter_tablespace", STMT_STATUS(SQLCOM_ALTER_TABLESPACE)},
{"alter_user", STMT_STATUS(SQLCOM_ALTER_USER)},
{"analyze", STMT_STATUS(SQLCOM_ANALYZE)},
{"assign_to_keycache", STMT_STATUS(SQLCOM_ASSIGN_TO_KEYCACHE)},
@@ -3777,6 +3806,8 @@ static int init_early_variables()
set_malloc_size_cb(my_malloc_size_cb_func);
global_status_var.global_memory_used= 0;
init_alloc_root(PSI_NOT_INSTRUMENTED, &startup_root, 1024, 0, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &read_only_root, 1024, 0,
+ MYF(MY_ROOT_USE_MPROTECT));
return 0;
}
@@ -4291,7 +4322,7 @@ static int init_common_variables()
#endif /* defined(ENABLED_DEBUG_SYNC) */
#if (ENABLE_TEMP_POOL)
- if (use_temp_pool && my_bitmap_init(&temp_pool,0,1024,1))
+ if (use_temp_pool && my_bitmap_init(&temp_pool,0,1024))
return 1;
#else
use_temp_pool= 0;
@@ -4418,6 +4449,7 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_commit_ordered, &LOCK_commit_ordered,
MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_backup_log, &LOCK_backup_log, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_LOCK_temp_pool, &LOCK_temp_pool, MY_MUTEX_INIT_FAST);
#ifdef HAVE_OPENSSL
mysql_mutex_init(key_LOCK_des_key_file,
@@ -5100,6 +5132,7 @@ static int init_server_components()
init_global_table_stats();
init_global_index_stats();
+ init_update_queries();
/* Allow storage engine to give real error messages */
if (unlikely(ha_init_errors()))
@@ -5107,6 +5140,9 @@ static int init_server_components()
tc_log= 0; // ha_initialize_handlerton() needs that
+ if (!opt_abort && ddl_log_initialize())
+ unireg_abort(1);
+
if (plugin_init(&remaining_argc, remaining_argv,
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
(opt_abort ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
@@ -5350,9 +5386,6 @@ static int init_server_components()
}
#endif
- if (ddl_log_initialize())
- unireg_abort(1);
-
tc_log= get_tc_log_implementation();
if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file))
@@ -5436,12 +5469,15 @@ static int init_server_components()
ft_init_stopwords();
init_max_user_conn();
- init_update_queries();
init_global_user_stats();
init_global_client_stats();
if (!opt_bootstrap)
servers_init(0);
init_status_vars();
+ Item_false= new (&read_only_root) Item_bool_static("FALSE", 0);
+ Item_true= new (&read_only_root) Item_bool_static("TRUE", 1);
+ DBUG_ASSERT(Item_false);
+
DBUG_RETURN(0);
}
@@ -5805,6 +5841,9 @@ int mysqld_main(int argc, char **argv)
}
#endif /* WITH_WSREP */
+ /* Protect read_only_root against writes */
+ protect_root(&read_only_root, PROT_READ);
+
if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
@@ -9230,6 +9269,14 @@ PSI_stage_info stage_starting= { 0, "starting", 0};
PSI_stage_info stage_waiting_for_flush= { 0, "Waiting for non trans tables to be flushed", 0};
PSI_stage_info stage_waiting_for_ddl= { 0, "Waiting for DDLs", 0};
+#ifdef WITH_WSREP
+// Aditional Galera thread states
+PSI_stage_info stage_waiting_isolation= { 0, "Waiting to execute in isolation", 0};
+PSI_stage_info stage_waiting_certification= {0, "Waiting for certification", 0};
+PSI_stage_info stage_waiting_ddl= {0, "Waiting for TOI DDL", 0};
+PSI_stage_info stage_waiting_flow= {0, "Waiting for flow control", 0};
+#endif /* WITH_WSREP */
+
PSI_memory_key key_memory_DATE_TIME_FORMAT;
PSI_memory_key key_memory_DDL_LOG_MEMORY_ENTRY;
PSI_memory_key key_memory_Event_queue_element_for_exec_names;
@@ -9449,6 +9496,13 @@ PSI_stage_info *all_server_stages[]=
& stage_reading_semi_sync_ack,
& stage_waiting_for_deadlock_kill,
& stage_starting
+#ifdef WITH_WSREP
+ ,
+ & stage_waiting_isolation,
+ & stage_waiting_certification,
+ & stage_waiting_ddl,
+ & stage_waiting_flow
+#endif /* WITH_WSREP */
};
PSI_socket_key key_socket_tcpip, key_socket_unix, key_socket_client_connection;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 599d4ff1491..13a44ac94f5 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2020, MariaDB Corporation.
+ Copyright (c) 2010, 2021, 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
@@ -100,7 +100,9 @@ extern CHARSET_INFO *error_message_charset_info;
extern CHARSET_INFO *character_set_filesystem;
-extern MY_BITMAP temp_pool;
+void temp_pool_clear_bit(uint bit);
+uint temp_pool_set_next();
+
extern bool opt_large_files;
extern bool opt_update_log, opt_bin_log, opt_error_log, opt_bin_log_compress;
extern uint opt_bin_log_compress_min_len;
@@ -677,6 +679,13 @@ extern PSI_stage_info stage_slave_background_process_request;
extern PSI_stage_info stage_slave_background_wait_request;
extern PSI_stage_info stage_waiting_for_deadlock_kill;
extern PSI_stage_info stage_starting;
+#ifdef WITH_WSREP
+// Aditional Galera thread states
+extern PSI_stage_info stage_waiting_isolation;
+extern PSI_stage_info stage_waiting_certification;
+extern PSI_stage_info stage_waiting_ddl;
+extern PSI_stage_info stage_waiting_flow;
+#endif /* WITH_WSREP */
#ifdef HAVE_PSI_STATEMENT_INTERFACE
/**
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 44e8e2c878c..28d98ea5ced 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1308,7 +1308,7 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
*create_error= 1;
}
else
- my_bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE);
+ my_bitmap_init(&column_bitmap, bitmap, head->s->fields);
DBUG_VOID_RETURN;
}
@@ -2579,7 +2579,7 @@ static int fill_used_fields_bitmap(PARAM *param)
param->fields_bitmap_size= table->s->column_bitmap_size;
if (!(tmp= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)) ||
- my_bitmap_init(&param->needed_fields, tmp, table->s->fields, FALSE))
+ my_bitmap_init(&param->needed_fields, tmp, table->s->fields))
return 1;
bitmap_copy(&param->needed_fields, table->read_set);
@@ -3370,7 +3370,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
my_bitmap_map* buf;
if (!(buf= (my_bitmap_map*)thd->alloc(table->s->column_bitmap_size)))
DBUG_RETURN(TRUE);
- my_bitmap_init(&handled_columns, buf, table->s->fields, FALSE);
+ my_bitmap_init(&handled_columns, buf, table->s->fields);
/*
Calculate the selectivity of the range conditions supported by indexes.
@@ -4158,7 +4158,7 @@ static int find_used_partitions_imerge_list(PART_PRUNE_PARAM *ppar,
*/
return find_used_partitions_imerge(ppar, merges.head());
}
- my_bitmap_init(&all_merges, bitmap_buf, n_bits, FALSE);
+ my_bitmap_init(&all_merges, bitmap_buf, n_bits);
bitmap_set_prefix(&all_merges, n_bits);
List_iterator<SEL_IMERGE> it(merges);
@@ -4814,8 +4814,7 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
uint32 bufsize= bitmap_buffer_size(ppar->part_info->num_subparts);
if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
return TRUE;
- my_bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
- FALSE);
+ my_bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts);
}
range_par->key_parts= key_part;
Field **field= (ppar->part_fields)? part_info->part_field_array :
@@ -5642,7 +5641,7 @@ bool create_fields_bitmap(PARAM *param, MY_BITMAP *fields_bitmap)
if (!(bitmap_buf= (my_bitmap_map *) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return TRUE;
- if (my_bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields, FALSE))
+ if (my_bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields))
return TRUE;
return FALSE;
@@ -6554,7 +6553,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
DBUG_RETURN(NULL);
if (my_bitmap_init(&ror_scan->covered_fields, bitmap_buf,
- param->table->s->fields, FALSE))
+ param->table->s->fields))
DBUG_RETURN(NULL);
bitmap_clear_all(&ror_scan->covered_fields);
@@ -6671,8 +6670,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param)
if (!(buf= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return NULL;
- if (my_bitmap_init(&info->covered_fields, buf, param->table->s->fields,
- FALSE))
+ if (my_bitmap_init(&info->covered_fields, buf, param->table->s->fields))
return NULL;
info->is_covering= FALSE;
info->index_scan_costs= 0.0;
@@ -7317,7 +7315,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
param->fields_bitmap_size);
if (!covered_fields->bitmap ||
my_bitmap_init(covered_fields, covered_fields->bitmap,
- param->table->s->fields, FALSE))
+ param->table->s->fields))
DBUG_RETURN(0);
bitmap_clear_all(covered_fields);
@@ -12629,10 +12627,10 @@ int QUICK_RANGE_SELECT::reset()
if (!mrr_buf_desc)
empty_buf.buffer= empty_buf.buffer_end= empty_buf.end_of_used_area= NULL;
-
- error= file->multi_range_read_init(&seq_funcs, (void*)this, ranges.elements,
- mrr_flags, mrr_buf_desc? mrr_buf_desc:
- &empty_buf);
+
+ error= file->multi_range_read_init(&seq_funcs, (void*)this,
+ (uint)ranges.elements, mrr_flags,
+ mrr_buf_desc? mrr_buf_desc: &empty_buf);
err:
/* Restore bitmaps set on entry */
if (in_ror_merged_scan)
@@ -12744,7 +12742,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
}
}
- uint count= ranges.elements - (uint)(cur_range - (QUICK_RANGE**) ranges.buffer);
+ size_t count= ranges.elements - (size_t)(cur_range - (QUICK_RANGE**) ranges.buffer);
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
@@ -12789,7 +12787,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
DBUG_RETURN(result);
}
- uint count= ranges.elements - (uint)(cur_range - (QUICK_RANGE**) ranges.buffer);
+ size_t count= ranges.elements - (size_t)(cur_range - (QUICK_RANGE**) ranges.buffer);
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
@@ -12830,9 +12828,9 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
bool QUICK_RANGE_SELECT::row_in_ranges()
{
QUICK_RANGE *res;
- uint min= 0;
- uint max= ranges.elements - 1;
- uint mid= (max + min)/2;
+ size_t min= 0;
+ size_t max= ranges.elements - 1;
+ size_t mid= (max + min)/2;
while (min != max)
{
@@ -15818,7 +15816,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
DBUG_ASSERT(min_max_ranges.elements > 0);
- for (uint range_idx= min_max_ranges.elements; range_idx > 0; range_idx--)
+ for (size_t range_idx= min_max_ranges.elements; range_idx > 0; range_idx--)
{ /* Search from the right-most range to the left. */
get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx - 1);
@@ -16365,7 +16363,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_dump(int indent, bool verbose)
}
if (min_max_ranges.elements > 0)
{
- fprintf(DBUG_FILE, "%*susing %d quick_ranges for MIN/MAX:\n",
+ fprintf(DBUG_FILE, "%*susing %zu quick_ranges for MIN/MAX:\n",
indent, "", min_max_ranges.elements);
}
}
diff --git a/sql/opt_split.cc b/sql/opt_split.cc
index 18710e85624..85e2df2dbb3 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -707,7 +707,7 @@ double spl_postjoin_oper_cost(THD *thd, double join_record_count, uint rec_len)
void JOIN::add_keyuses_for_splitting()
{
uint i;
- uint idx;
+ size_t idx;
KEYUSE_EXT *keyuse_ext;
KEYUSE_EXT keyuse_ext_end;
double oper_cost;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index b971c96cda2..4148065c7ee 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4564,7 +4564,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
STEP 1: Get temporary table name
*/
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
- temp_pool_slot = bitmap_lock_set_next(&temp_pool);
+ temp_pool_slot = temp_pool_set_next();
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
sprintf(path, "%s-subquery-%lx-%i", tmp_file_prefix,
@@ -4601,7 +4601,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
NullS))
{
if (temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
+ temp_pool_clear_bit(temp_pool_slot);
DBUG_RETURN(TRUE);
}
strmov(tmpname,path);
@@ -4811,7 +4811,7 @@ 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);
+ temp_pool_clear_bit(temp_pool_slot);
DBUG_RETURN(TRUE); /* purecov: inspected */
}
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index a6f0ac24719..8c4720bdec4 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -1070,7 +1070,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
void *buf;
if (!(buf= thd->alloc(bitmap_buffer_size(offset))) ||
- my_bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
+ my_bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset))
{
DBUG_RETURN(TRUE); /* purecov: inspected */
}
diff --git a/sql/partition_element.h b/sql/partition_element.h
index e0a519065cc..c551baa3092 100644
--- a/sql/partition_element.h
+++ b/sql/partition_element.h
@@ -111,7 +111,6 @@ public:
ha_rows part_min_rows;
longlong range_value;
const char *partition_name;
- const char *tablespace_name;
struct st_ddl_log_memory_entry *log_entry;
const char* part_comment;
const char* data_file_name;
@@ -129,7 +128,7 @@ public:
partition_element()
: part_max_rows(0), part_min_rows(0), range_value(0),
- partition_name(NULL), tablespace_name(NULL),
+ partition_name(NULL),
log_entry(NULL), part_comment(NULL),
data_file_name(NULL), index_file_name(NULL),
engine_type(NULL), connect_string(null_clex_str), part_state(PART_NORMAL),
@@ -143,7 +142,6 @@ public:
: part_max_rows(part_elem->part_max_rows),
part_min_rows(part_elem->part_min_rows),
range_value(0), partition_name(NULL),
- tablespace_name(part_elem->tablespace_name),
log_entry(NULL),
part_comment(part_elem->part_comment),
data_file_name(part_elem->data_file_name),
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 3eb73b5e16a..091c065194a 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2455,7 +2455,7 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
partition_element *new_part_elem= new_part_it++;
/*
The following must match:
- partition_name, tablespace_name, data_file_name, index_file_name,
+ partition_name, data_file_name, index_file_name,
engine_type, part_max_rows, part_min_rows, nodegroup_id.
(max_value, signed_flag, has_null_value only on partition level,
RANGE/LIST)
@@ -2541,9 +2541,7 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
if (strcmp_null(sub_part_elem->data_file_name,
new_sub_part_elem->data_file_name) ||
strcmp_null(sub_part_elem->index_file_name,
- new_sub_part_elem->index_file_name) ||
- strcmp_null(sub_part_elem->tablespace_name,
- new_sub_part_elem->tablespace_name))
+ new_sub_part_elem->index_file_name))
DBUG_RETURN(false);
} while (++j < num_subparts);
@@ -2559,9 +2557,7 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
if (strcmp_null(part_elem->data_file_name,
new_part_elem->data_file_name) ||
strcmp_null(part_elem->index_file_name,
- new_part_elem->index_file_name) ||
- strcmp_null(part_elem->tablespace_name,
- new_part_elem->tablespace_name))
+ new_part_elem->index_file_name))
DBUG_RETURN(false);
}
} while (++i < num_parts);
diff --git a/sql/partition_info.h b/sql/partition_info.h
index aebb81ff9c5..287aa6d2200 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -83,7 +83,7 @@ struct Vers_part_info : public Sql_alloc
See generate_partition_syntax() for details of how the data is used
in partition expression.
*/
-class partition_info : public Sql_alloc
+class partition_info : public DDL_LOG_STATE, public Sql_alloc
{
public:
/*
@@ -162,10 +162,6 @@ public:
Item *item_free_list;
- struct st_ddl_log_memory_entry *first_log_entry;
- struct st_ddl_log_memory_entry *exec_log_entry;
- struct st_ddl_log_memory_entry *frm_log_entry;
-
/*
Bitmaps of partitions used by the current query.
* read_partitions - partitions to be used for reading.
@@ -305,7 +301,6 @@ public:
part_field_buffers(NULL), subpart_field_buffers(NULL),
restore_part_field_ptrs(NULL), restore_subpart_field_ptrs(NULL),
part_expr(NULL), subpart_expr(NULL), item_free_list(NULL),
- first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL),
bitmaps_are_initialized(FALSE),
list_array(NULL), vers_info(NULL), err_value(0),
part_info_string(NULL),
@@ -327,6 +322,7 @@ public:
is_auto_partitioned(FALSE),
has_null_value(FALSE), column_list(FALSE)
{
+ bzero((DDL_LOG_STATE *) this, sizeof(DDL_LOG_STATE));
all_fields_in_PF.clear_all();
all_fields_in_PPF.clear_all();
all_fields_in_SPF.clear_all();
@@ -433,8 +429,13 @@ public:
return NULL;
}
uint next_part_no(uint new_parts) const;
+
+ int gen_part_type(THD *thd, String *str) const;
};
+void part_type_error(THD *thd, partition_info *work_part_info,
+ const char *part_type, partition_info *tab_part_info);
+
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
bool check_partition_dirs(partition_info *part_info);
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index fce5f260639..2124980693a 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -249,8 +249,9 @@ rpl_slave_state::rpl_slave_state()
{
mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state,
MY_MUTEX_INIT_SLOW);
- my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32, offsetof(element, domain_id),
- sizeof(uint32), NULL, rpl_slave_state_free_element, HASH_UNIQUE);
+ my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32,
+ offsetof(element, domain_id), sizeof(element::domain_id),
+ NULL, rpl_slave_state_free_element, HASH_UNIQUE);
my_init_dynamic_array(PSI_INSTRUMENT_ME, &gtid_sort_array, sizeof(rpl_gtid),
8, 8, MYF(0));
}
@@ -366,7 +367,8 @@ rpl_slave_state::get_element(uint32 domain_id)
{
struct element *elem;
- elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id, 0);
+ elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id,
+ sizeof(domain_id));
if (elem)
return elem;
@@ -402,7 +404,8 @@ rpl_slave_state::put_back_list(list_element *list)
list_element *next= list->next;
if ((!e || e->domain_id != list->domain_id) &&
- !(e= (element *)my_hash_search(&hash, (const uchar *)&list->domain_id, 0)))
+ !(e= (element *)my_hash_search(&hash, (const uchar *)&list->domain_id,
+ sizeof(list->domain_id))))
{
err= 1;
goto end;
@@ -1107,8 +1110,8 @@ rpl_slave_state::iterate(int (*cb)(rpl_gtid *, void *), void *data,
bool locked= false;
my_hash_init(PSI_INSTRUMENT_ME, &gtid_hash, &my_charset_bin, 32,
- offsetof(rpl_gtid, domain_id), sizeof(uint32), NULL, NULL,
- HASH_UNIQUE);
+ offsetof(rpl_gtid, domain_id), sizeof(rpl_gtid::domain_id),
+ NULL, NULL, HASH_UNIQUE);
for (i= 0; i < num_extra; ++i)
if (extra_gtids[i].server_id == global_system_variables.server_id &&
my_hash_insert(&gtid_hash, (uchar *)(&extra_gtids[i])))
@@ -1143,7 +1146,8 @@ rpl_slave_state::iterate(int (*cb)(rpl_gtid *, void *), void *data,
}
/* Check if we have something newer in the extra list. */
- rec= my_hash_search(&gtid_hash, (const uchar *)&best_gtid.domain_id, 0);
+ rec= my_hash_search(&gtid_hash, (const uchar *)&best_gtid.domain_id,
+ sizeof(best_gtid.domain_id));
if (rec)
{
gtid= (rpl_gtid *)rec;
@@ -1243,7 +1247,8 @@ rpl_slave_state::domain_to_gtid(uint32 domain_id, rpl_gtid *out_gtid)
uint64 best_sub_id;
mysql_mutex_lock(&LOCK_slave_state);
- elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id, 0);
+ elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id,
+ sizeof(domain_id));
if (!elem || !(list= elem->list))
{
mysql_mutex_unlock(&LOCK_slave_state);
@@ -1477,8 +1482,9 @@ rpl_slave_state::alloc_gtid_pos_table(LEX_CSTRING *table_name, void *hton,
void rpl_binlog_state::init()
{
- my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32, offsetof(element, domain_id),
- sizeof(uint32), NULL, my_free, HASH_UNIQUE);
+ my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32,
+ offsetof(element, domain_id), sizeof(element::domain_id),
+ NULL, my_free, HASH_UNIQUE);
my_init_dynamic_array(PSI_INSTRUMENT_ME, &gtid_sort_array, sizeof(rpl_gtid), 8, 8, MYF(0));
mysql_mutex_init(key_LOCK_binlog_state, &LOCK_binlog_state,
MY_MUTEX_INIT_SLOW);
@@ -1580,7 +1586,8 @@ rpl_binlog_state::update_nolock(const struct rpl_gtid *gtid, bool strict)
element *elem;
if ((elem= (element *)my_hash_search(&hash,
- (const uchar *)(&gtid->domain_id), 0)))
+ (const uchar *)(&gtid->domain_id),
+ sizeof(gtid->domain_id))))
{
if (strict && elem->last_gtid && elem->last_gtid->seq_no >= gtid->seq_no)
{
@@ -1628,7 +1635,8 @@ rpl_binlog_state::update_with_next_gtid(uint32 domain_id, uint32 server_id,
gtid->server_id= server_id;
mysql_mutex_lock(&LOCK_binlog_state);
- if ((elem= (element *)my_hash_search(&hash, (const uchar *)(&domain_id), 0)))
+ if ((elem= (element *)my_hash_search(&hash, (const uchar *)(&domain_id),
+ sizeof(domain_id))))
{
gtid->seq_no= ++elem->seq_no_counter;
if (!elem->update_element(gtid))
@@ -1667,7 +1675,8 @@ rpl_binlog_state::element::update_element(const rpl_gtid *gtid)
}
lookup_gtid= (rpl_gtid *)
- my_hash_search(&hash, (const uchar *)&gtid->server_id, 0);
+ my_hash_search(&hash, (const uchar *)&gtid->server_id,
+ sizeof(gtid->server_id));
if (lookup_gtid)
{
lookup_gtid->seq_no= gtid->seq_no;
@@ -1705,8 +1714,8 @@ rpl_binlog_state::alloc_element_nolock(const rpl_gtid *gtid)
{
elem->domain_id= gtid->domain_id;
my_hash_init(PSI_INSTRUMENT_ME, &elem->hash, &my_charset_bin, 32,
- offsetof(rpl_gtid, server_id), sizeof(uint32), NULL, my_free,
- HASH_UNIQUE);
+ offsetof(rpl_gtid, server_id), sizeof(rpl_gtid::domain_id),
+ NULL, my_free, HASH_UNIQUE);
elem->last_gtid= lookup_gtid;
elem->seq_no_counter= gtid->seq_no;
memcpy(lookup_gtid, gtid, sizeof(*lookup_gtid));
@@ -1741,7 +1750,8 @@ rpl_binlog_state::check_strict_sequence(uint32 domain_id, uint32 server_id,
mysql_mutex_lock(&LOCK_binlog_state);
if ((elem= (element *)my_hash_search(&hash,
- (const uchar *)(&domain_id), 0)) &&
+ (const uchar *)(&domain_id),
+ sizeof(domain_id))) &&
elem->last_gtid && elem->last_gtid->seq_no >= seq_no)
{
if (!no_error)
@@ -1769,7 +1779,8 @@ rpl_binlog_state::bump_seq_no_if_needed(uint32 domain_id, uint64 seq_no)
int res;
mysql_mutex_lock(&LOCK_binlog_state);
- if ((elem= (element *)my_hash_search(&hash, (const uchar *)(&domain_id), 0)))
+ if ((elem= (element *)my_hash_search(&hash, (const uchar *)(&domain_id),
+ sizeof(domain_id))))
{
if (elem->seq_no_counter < seq_no)
elem->seq_no_counter= seq_no;
@@ -1787,8 +1798,8 @@ rpl_binlog_state::bump_seq_no_if_needed(uint32 domain_id, uint64 seq_no)
elem->domain_id= domain_id;
my_hash_init(PSI_INSTRUMENT_ME, &elem->hash, &my_charset_bin, 32,
- offsetof(rpl_gtid, server_id), sizeof(uint32), NULL, my_free,
- HASH_UNIQUE);
+ offsetof(rpl_gtid, server_id), sizeof(rpl_gtid::server_id),
+ NULL, my_free, HASH_UNIQUE);
elem->last_gtid= NULL;
elem->seq_no_counter= seq_no;
if (0 == my_hash_insert(&hash, (const uchar *)elem))
@@ -1892,9 +1903,11 @@ rpl_gtid *
rpl_binlog_state::find_nolock(uint32 domain_id, uint32 server_id)
{
element *elem;
- if (!(elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id, 0)))
+ if (!(elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id,
+ sizeof(domain_id))))
return NULL;
- return (rpl_gtid *)my_hash_search(&elem->hash, (const uchar *)&server_id, 0);
+ return (rpl_gtid *)my_hash_search(&elem->hash, (const uchar *)&server_id,
+ sizeof(server_id));
}
rpl_gtid *
@@ -1914,7 +1927,8 @@ rpl_binlog_state::find_most_recent(uint32 domain_id)
rpl_gtid *gtid= NULL;
mysql_mutex_lock(&LOCK_binlog_state);
- elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id, 0);
+ elem= (element *)my_hash_search(&hash, (const uchar *)&domain_id,
+ sizeof(domain_id));
if (elem && elem->last_gtid)
gtid= elem->last_gtid;
mysql_mutex_unlock(&LOCK_binlog_state);
@@ -2183,7 +2197,8 @@ rpl_binlog_state::drop_domain(DYNAMIC_ARRAY *ids,
ptr_domain_id= (uint32*) dynamic_array_ptr(ids, i);
elem= (rpl_binlog_state::element *)
- my_hash_search(&hash, (const uchar *) ptr_domain_id, 0);
+ my_hash_search(&hash, (const uchar *) ptr_domain_id,
+ sizeof(ptr_domain_id[0]));
if (!elem)
{
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -2244,7 +2259,7 @@ slave_connection_state::slave_connection_state()
{
my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32,
offsetof(entry, gtid) + offsetof(rpl_gtid, domain_id),
- sizeof(uint32), NULL, my_free, HASH_UNIQUE);
+ sizeof(rpl_gtid::domain_id), NULL, my_free, HASH_UNIQUE);
my_init_dynamic_array(PSI_INSTRUMENT_ME, &gtid_sort_array, sizeof(rpl_gtid), 8, 8, MYF(0));
}
@@ -2299,7 +2314,8 @@ slave_connection_state::load(const char *slave_request, size_t len)
return 1;
}
if ((e= (const entry *)
- my_hash_search(&hash, (const uchar *)(&gtid->domain_id), 0)))
+ my_hash_search(&hash, (const uchar *)(&gtid->domain_id),
+ sizeof(gtid->domain_id))))
{
my_error(ER_DUPLICATE_GTID_DOMAIN, MYF(0), gtid->domain_id,
gtid->server_id, (ulonglong)gtid->seq_no, e->gtid.domain_id,
@@ -2366,7 +2382,8 @@ slave_connection_state::load(rpl_slave_state *state,
slave_connection_state::entry *
slave_connection_state::find_entry(uint32 domain_id)
{
- return (entry *) my_hash_search(&hash, (const uchar *)(&domain_id), 0);
+ return (entry *) my_hash_search(&hash, (const uchar *)(&domain_id),
+ sizeof(domain_id));
}
@@ -2384,7 +2401,8 @@ int
slave_connection_state::update(const rpl_gtid *in_gtid)
{
entry *e;
- uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id), 0);
+ uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id),
+ sizeof(in_gtid->domain_id));
if (rec)
{
e= (entry *)rec;
@@ -2409,7 +2427,8 @@ slave_connection_state::update(const rpl_gtid *in_gtid)
void
slave_connection_state::remove(const rpl_gtid *in_gtid)
{
- uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id), 0);
+ uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id),
+ sizeof(in_gtid->domain_id));
#ifdef DBUG_ASSERT_EXISTS
bool err;
rpl_gtid *slave_gtid= &((entry *)rec)->gtid;
@@ -2426,7 +2445,8 @@ slave_connection_state::remove(const rpl_gtid *in_gtid)
void
slave_connection_state::remove_if_present(const rpl_gtid *in_gtid)
{
- uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id), 0);
+ uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id),
+ sizeof(in_gtid->domain_id));
if (rec)
my_hash_delete(&hash, rec);
}
@@ -2870,7 +2890,8 @@ void
gtid_waiting::init()
{
my_hash_init(PSI_INSTRUMENT_ME, &hash, &my_charset_bin, 32,
- offsetof(hash_element, domain_id), sizeof(uint32), NULL,
+ offsetof(hash_element, domain_id),
+ sizeof(hash_element::domain_id), NULL,
free_hash_element, HASH_UNIQUE);
mysql_mutex_init(key_LOCK_gtid_waiting, &LOCK_gtid_waiting, 0);
}
@@ -2903,7 +2924,8 @@ gtid_waiting::get_entry(uint32 domain_id)
{
hash_element *e;
- if ((e= (hash_element *)my_hash_search(&hash, (const uchar *)&domain_id, 0)))
+ if ((e= (hash_element *)my_hash_search(&hash, (const uchar *)&domain_id,
+ sizeof(domain_id))))
return e;
if (!(e= (hash_element *)my_malloc(PSI_INSTRUMENT_ME, sizeof(*e), MYF(MY_WME))))
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 8322bcd3042..7b438b3efbe 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -750,7 +750,7 @@ int flush_master_info(Master_info* mi,
(1 + mi->ignore_server_ids.elements), MYF(MY_WME));
if (!ignore_server_ids_buf)
DBUG_RETURN(1); /* error */
- ulong cur_len= sprintf(ignore_server_ids_buf, "%u",
+ ulong cur_len= sprintf(ignore_server_ids_buf, "%zu",
mi->ignore_server_ids.elements);
for (ulong i= 0; i < mi->ignore_server_ids.elements; i++)
{
@@ -1456,11 +1456,32 @@ bool Master_info_index::add_master_info(Master_info *mi, bool write_to_file)
atomic
*/
-bool Master_info_index::remove_master_info(Master_info *mi)
+bool Master_info_index::remove_master_info(Master_info *mi, bool clear_log_files)
{
+ char tmp_name[FN_REFLEN];
DBUG_ENTER("remove_master_info");
mysql_mutex_assert_owner(&LOCK_active_mi);
+ if (clear_log_files)
+ {
+ /* This code is only executed when change_master() failes to create a new master info */
+
+ // Delete any temporary relay log files that could have been created by change_master()
+ mi->rli.relay_log.reset_logs(current_thd, 0, (rpl_gtid*) 0, 0, 0);
+ /* Delete master-'connection'.info */
+ create_logfile_name_with_suffix(tmp_name,
+ sizeof(tmp_name),
+ master_info_file, 0,
+ &mi->cmp_connection_name);
+ my_delete(tmp_name, MYF(0));
+ /* Delete relay-log-'connection'.info */
+ create_logfile_name_with_suffix(tmp_name,
+ sizeof(tmp_name),
+ relay_log_info_file, 0,
+ &mi->cmp_connection_name);
+ my_delete(tmp_name, MYF(0));
+ }
+
// Delete Master_info and rewrite others to file
if (!my_hash_delete(&master_info_hash, (uchar*) mi))
{
@@ -1917,7 +1938,7 @@ char *Domain_id_filter::as_string(enum_list_type type)
return NULL;
// Store the total number of elements followed by the individual elements.
- size_t cur_len= sprintf(buf, "%u", ids->elements);
+ size_t cur_len= sprintf(buf, "%zu", ids->elements);
sz-= cur_len;
for (uint i= 0; i < ids->elements; i++)
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 1377a816d48..5b0088ca65a 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -404,7 +404,7 @@ public:
bool check_duplicate_master_info(LEX_CSTRING *connection_name,
const char *host, uint port);
bool add_master_info(Master_info *mi, bool write_to_file);
- bool remove_master_info(Master_info *mi);
+ bool remove_master_info(Master_info *mi, bool clear_log_files);
Master_info *get_master_info(const LEX_CSTRING *connection_name,
Sql_condition::enum_warning_level warning);
bool start_all_slaves(THD *thd);
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 5e32565cca7..962da9b46af 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -811,9 +811,7 @@ do_retry:
{
mysql_mutex_lock(&entry->LOCK_parallel_entry);
if (entry->stop_on_error_sub_id == (uint64) ULONGLONG_MAX ||
-#ifndef DBUG_OFF
- (DBUG_EVALUATE_IF("simulate_mdev_12746", 1, 0)) ||
-#endif
+ DBUG_IF("simulate_mdev_12746") ||
rgi->gtid_sub_id < entry->stop_on_error_sub_id)
{
register_wait_for_prior_event_group_commit(rgi, entry);
@@ -2357,7 +2355,8 @@ rpl_parallel::find(uint32 domain_id)
struct rpl_parallel_entry *e;
if (!(e= (rpl_parallel_entry *)my_hash_search(&domain_hash,
- (const uchar *)&domain_id, 0)))
+ (const uchar *)&domain_id,
+ sizeof(domain_id))))
{
/* Allocate a new, empty one. */
ulong count= opt_slave_domain_parallel_threads;
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 064299c6822..42607fbadcf 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1632,7 +1632,8 @@ scan_one_gtid_slave_pos_table(THD *thd, HASH *hash, DYNAMIC_ARRAY *array,
goto end;
}
- if ((rec= my_hash_search(hash, (const uchar *)&domain_id, 0)))
+ if ((rec= my_hash_search(hash, (const uchar *)&domain_id,
+ sizeof(domain_id))))
{
entry= (struct gtid_pos_element *)rec;
if (entry->sub_id >= sub_id)
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 9ea8bb3b822..04a2efb3750 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -338,7 +338,7 @@ bool event_checksum_test(uchar *event_buf, ulong event_len,
DBUG_ASSERT(event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT);
event_buf[FLAGS_OFFSET]= (uchar) flags;
}
- res= DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, computed != incoming);
+ res= (DBUG_IF("simulate_checksum_test_failure") || computed != incoming);
}
return res;
}
diff --git a/sql/semisync_master_ack_receiver.cc b/sql/semisync_master_ack_receiver.cc
index b65b7824a0e..b54ad58d153 100644
--- a/sql/semisync_master_ack_receiver.cc
+++ b/sql/semisync_master_ack_receiver.cc
@@ -72,7 +72,7 @@ bool Ack_receiver::start()
m_status= ST_UP;
- if (DBUG_EVALUATE_IF("rpl_semisync_simulate_create_thread_failure", 1, 0) ||
+ if (DBUG_IF("rpl_semisync_simulate_create_thread_failure") ||
pthread_attr_init(&attr) != 0 ||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE) != 0 ||
#ifndef _WIN32
@@ -247,7 +247,7 @@ void Ack_receiver::run()
{
mysql_mutex_unlock(&m_mutex);
- ret= DBUG_EVALUATE_IF("rpl_semisync_simulate_select_error", -1, ret);
+ ret= DBUG_IF("rpl_semisync_simulate_select_error") ? -1 : ret;
if (ret == -1 && errno != EINTR)
sql_print_information("Failed to wait on semi-sync sockets, "
diff --git a/sql/semisync_slave.cc b/sql/semisync_slave.cc
index 3e7578b6a53..788aab78911 100644
--- a/sql/semisync_slave.cc
+++ b/sql/semisync_slave.cc
@@ -63,7 +63,7 @@ int Repl_semi_sync_slave::slave_read_sync_header(const uchar *header,
if (rpl_semi_sync_slave_status)
{
- if (DBUG_EVALUATE_IF("semislave_corrupt_log", 0, 1)
+ if (!DBUG_IF("semislave_corrupt_log")
&& header[0] == k_packet_magic_num)
{
semi_sync_need_reply = (header[1] & k_packet_flag_sync);
@@ -144,7 +144,7 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql)
bool ret= (!mysql_real_connect(kill_mysql, mysql->host,
mysql->user, mysql->passwd,0, mysql->port, mysql->unix_socket, 0));
- if (DBUG_EVALUATE_IF("semisync_slave_failed_kill", 1, 0) || ret)
+ if (DBUG_IF("semisync_slave_failed_kill") || ret)
{
sql_print_information("cannot connect to master to kill slave io_thread's "
"connection");
@@ -198,8 +198,7 @@ int Repl_semi_sync_slave::request_transmit(Master_info *mi)
}
row= mysql_fetch_row(res);
- if (DBUG_EVALUATE_IF("master_not_support_semisync", 1, 0)
- || !row)
+ if (DBUG_IF("master_not_support_semisync") || !row)
{
/* Master does not support semi-sync */
sql_print_warning("Master server does not support semi-sync, "
@@ -260,7 +259,7 @@ int Repl_semi_sync_slave::slave_reply(Master_info *mi)
name_len + REPLY_BINLOG_NAME_OFFSET);
if (!reply_res)
{
- reply_res = DBUG_EVALUATE_IF("semislave_failed_net_flush", 1, net_flush(net));
+ reply_res = (DBUG_IF("semislave_failed_net_flush") || net_flush(net));
if (reply_res)
sql_print_error("Semi-sync slave net_flush() reply failed");
rpl_semi_sync_slave_send_ack++;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 3dd97527433..aa9ec5ab5ca 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -85,7 +85,7 @@ uint sys_var_elements()
int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags)
{
- uint saved_elements= long_options->elements;
+ size_t saved_elements= long_options->elements;
DBUG_ENTER("sys_var_add_options");
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 53814b16578..45a09ea62f1 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -1788,7 +1788,7 @@ ER_TOO_LONG_KEY 42000 S1009
spa "Declaración de clave demasiado larga. La máxima longitud de clave es de %d"
swe "För lång nyckel. Högsta tillåtna nyckellängd är %d"
ukr "Зазначений ключ задовгий. Ðайбільша довжина ключа %d байтів"
-ER_KEY_COLUMN_DOES_NOT_EXITS 42000 S1009
+ER_KEY_COLUMN_DOES_NOT_EXIST 42000 S1009
chi "索引列'%-.192s'ä¸åœ¨è¡¨é‡Œ"
cze "KlíÄový sloupec '%-.192s' v tabulce neexistuje"
dan "Nøglefeltet '%-.192s' eksisterer ikke i tabellen"
@@ -6638,12 +6638,12 @@ ER_PARTITION_MGMT_ON_NONPARTITIONED
ER_FEATURE_NOT_SUPPORTED_WITH_PARTITIONING
eng "Partitioned tables do not support %s"
spa "Las tablas particionadas no soportan %s"
-ER_DROP_PARTITION_NON_EXISTENT
- chi "分区列表错误%-.64s"
- eng "Error in list of partitions to %-.64s"
- ger "Fehler in der Partitionsliste bei %-.64s"
- spa "Error en lista de particiones para %-.64s"
- swe "Fel i listan av partitioner att %-.64s"
+ER_PARTITION_DOES_NOT_EXIST
+ chi "分区å称或分区列表错误"
+ eng "Wrong partition name or partition list"
+ ger "Falscher Name einer Partition oder Fehler in der Partitionsliste"
+ spa "Error en lista de particiones"
+ swe "Fel namn av en partition eller fel i listan av partitioner"
ER_DROP_LAST_PARTITION
chi "无法删除所有分区,请使用删除表"
eng "Cannot remove all partitions, use DROP TABLE instead"
@@ -9773,9 +9773,9 @@ ER_UNUSED_23
spa "Nunca debería vd de ver esto"
ER_PARTITION_WRONG_TYPE
- chi "错误的分区类型,预期类型:%`s"
- eng "Wrong partitioning type, expected type: %`s"
- spa "Tipo de partición equivocada, tipo esperado: %`s"
+ chi "错误分区类型%`s,应当是%`s"
+ eng "Wrong partition type %`s for partitioning by %`s"
+ spa "Tipo de partición equivocada %`s para particionado mediante %`s"
WARN_VERS_PART_FULL
chi "版本化表%`s.%`s:partition%`s已满,添加更多历å²åˆ†åŒº(out of %s)"
@@ -10060,3 +10060,9 @@ ER_REMOVED_ORPHAN_TRIGGER
ER_STORAGE_ENGINE_DISABLED
eng "Storage engine %s is disabled"
spa "El motor de almacenaje %s está desactivado"
+WARN_SFORMAT_ERROR
+ eng "SFORMAT error: %s"
+ER_PARTITION_CONVERT_SUBPARTITIONED
+ eng "Convert partition is not supported for subpartitioned table."
+ER_PROVIDER_NOT_LOADED
+ eng "MariaDB tried to use the %s, but its provider plugin is not loaded"
diff --git a/sql/slave.cc b/sql/slave.cc
index 289441d9cab..361e77f2d04 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -788,7 +788,7 @@ bool init_slave_skip_errors(const char* arg)
if (!arg || !*arg) // No errors defined
goto end;
- if (unlikely(my_bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0)))
+ if (my_bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR))
DBUG_RETURN(1);
use_slave_mask= 1;
@@ -2329,11 +2329,11 @@ past_checksum:
/* Announce MariaDB slave capabilities. */
DBUG_EXECUTE_IF("simulate_slave_capability_none", goto after_set_capability;);
{
- int rc= DBUG_EVALUATE_IF("simulate_slave_capability_old_53",
+ int rc= DBUG_IF("simulate_slave_capability_old_53") ?
mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
- STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE))),
+ STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_ANNOTATE))) :
mysql_real_query(mysql, STRING_WITH_LEN("SET @mariadb_slave_capability="
- STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE))));
+ STRINGIFY_ARG(MARIA_SLAVE_CAPABILITY_MINE)));
if (unlikely(rc))
{
err_code= mysql_errno(mysql);
@@ -4678,7 +4678,7 @@ pthread_handler_t handle_slave_io(void *arg)
}
thd->variables.wsrep_on= 0;
- if (DBUG_EVALUATE_IF("failed_slave_start", 1, 0)
+ if (DBUG_IF("failed_slave_start")
|| repl_semisync_slave.slave_start(mi))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
@@ -4955,7 +4955,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
(!repl_semisync_slave.get_slave_enabled() ||
(!(mi->semi_ack & SEMI_SYNC_SLAVE_DELAY_SYNC) ||
(mi->semi_ack & (SEMI_SYNC_NEED_ACK)))) &&
- (DBUG_EVALUATE_IF("failed_flush_master_info", 1, 0) ||
+ (DBUG_IF("failed_flush_master_info") ||
flush_master_info(mi, TRUE, TRUE)))
{
sql_print_error("Failed to flush master info file");
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0fec4c9f3d7..ab362603c7e 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -412,6 +412,26 @@ Item *THD::sp_fix_func_item(Item **it_addr)
/**
+ Prepare an Item for evaluation as an assignment source,
+ for assignment to the given target.
+
+ @param to - the assignment target
+ @param it_addr - a pointer on item refernce
+
+ @retval - NULL on error
+ @retval - a prepared item pointer on success
+*/
+Item *THD::sp_fix_func_item_for_assignment(const Field *to, Item **it_addr)
+{
+ DBUG_ENTER("THD::sp_fix_func_item_for_assignment");
+ Item *res= sp_fix_func_item(it_addr);
+ if (res && (!res->check_assignability_to(to, false)))
+ DBUG_RETURN(res);
+ DBUG_RETURN(NULL);
+}
+
+
+/**
Evaluate an expression and store the result in the field.
@param result_field the field to store the result
@@ -4072,7 +4092,7 @@ sp_instr_jump_if_not::exec_core(THD *thd, uint *nextp)
Item *it;
int res;
- it= thd->sp_prepare_func_item(&m_expr);
+ it= thd->sp_prepare_func_item(&m_expr, 1);
if (! it)
{
res= -1;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index eee5212679f..3c3cb093400 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -561,7 +561,7 @@ public:
{ return m_flags & MODIFIES_DATA; }
inline uint instructions()
- { return m_instr.elements; }
+ { return (uint)m_instr.elements; }
inline sp_instr *
last_instruction()
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index c4c19dd39f6..d2fe53a2431 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -518,7 +518,8 @@ bool sp_rcontext::handle_sql_condition(THD *thd,
found_condition=
new (callers_arena->mem_root) Sql_condition(callers_arena->mem_root,
da->get_error_condition_identity(),
- da->message());
+ da->message(),
+ da->current_row_for_warning());
}
}
else if (da->current_statement_warn_count())
@@ -714,7 +715,7 @@ Item_cache *sp_rcontext::create_case_expr_holder(THD *thd,
bool sp_rcontext::set_case_expr(THD *thd, int case_expr_id,
Item **case_expr_item_ptr)
{
- Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr);
+ Item *case_expr_item= thd->sp_prepare_func_item(case_expr_item_ptr, 1);
if (!case_expr_item)
return true;
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 0e0e8921f86..ea669b2d1d8 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -111,15 +111,18 @@ public:
/// Text message.
char *message;
+ /** Row number where the condition has happened */
+ ulong m_row_number;
+
/// The constructor.
///
/// @param _sql_condition The SQL condition.
/// @param arena Query arena for SP
- Sql_condition_info(const Sql_condition *_sql_condition,
- Query_arena *arena)
+ Sql_condition_info(const Sql_condition *_sql_condition, Query_arena *arena)
:Sql_condition_identity(*_sql_condition)
{
message= strdup_root(arena->mem_root, _sql_condition->get_message_text());
+ m_row_number= _sql_condition->m_row_number;
}
};
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 5cad34de076..90776566458 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2224,14 +2224,14 @@ static bool has_validation_plugins()
MariaDB_PASSWORD_VALIDATION_PLUGIN, NULL);
}
-struct validation_data { const LEX_CSTRING *user, *password; };
+struct validation_data { const LEX_CSTRING *user, *password, *host; };
static my_bool do_validate(THD *, plugin_ref plugin, void *arg)
{
struct validation_data *data= (struct validation_data *)arg;
struct st_mariadb_password_validation *handler=
(st_mariadb_password_validation *)plugin_decl(plugin)->info;
- if (handler->validate_password(data->user, data->password))
+ if (handler->validate_password(data->user, data->password, data->host))
{
my_error(ER_NOT_VALID_PASSWORD, MYF(0), plugin_ref_to_int(plugin)->name.str);
return true;
@@ -2241,12 +2241,14 @@ static my_bool do_validate(THD *, plugin_ref plugin, void *arg)
static bool validate_password(THD *thd, const LEX_CSTRING &user,
+ const LEX_CSTRING &host,
const LEX_CSTRING &pwtext, bool has_hash)
{
if (pwtext.length || !has_hash)
{
struct validation_data data= { &user,
- pwtext.str ? &pwtext : &empty_clex_str };
+ pwtext.str ? &pwtext : &empty_clex_str,
+ &host };
if (plugin_foreach(NULL, do_validate,
MariaDB_PASSWORD_VALIDATION_PLUGIN, &data))
{
@@ -2299,6 +2301,7 @@ static int set_user_salt(ACL_USER::AUTH *auth, plugin_ref plugin)
not loaded, if the auth_string is invalid, if the password is not applicable
*/
static int set_user_auth(THD *thd, const LEX_CSTRING &user,
+ const LEX_CSTRING &host,
ACL_USER::AUTH *auth, const LEX_CSTRING &pwtext)
{
const char *plugin_name= auth->plugin.str;
@@ -2330,7 +2333,7 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user,
}
if (info->hash_password &&
- validate_password(thd, user, pwtext, auth->auth_string.length))
+ validate_password(thd, user, host, pwtext, auth->auth_string.length))
{
res= ER_NOT_VALID_PASSWORD;
goto end;
@@ -3440,7 +3443,9 @@ static int acl_user_update(THD *thd, ACL_USER *acl_user, uint nauth,
auth->auth_str);
if (fix_user_plugin_ptr(work_copy + i))
work_copy[i].plugin= safe_lexcstrdup_root(&acl_memroot, auth->plugin);
- if (set_user_auth(thd, acl_user->user, work_copy + i, auth->pwtext))
+ if (set_user_auth(thd, acl_user->user,
+ {acl_user->host.hostname, acl_user->hostname_length},
+ work_copy + i, auth->pwtext))
return 1;
}
}
@@ -3708,14 +3713,14 @@ static void init_check_host(void)
(my_hash_get_key) check_get_key, 0, 0);
if (!allow_all_hosts)
{
- for (uint i=0 ; i < acl_users.elements ; i++)
+ for (size_t i=0 ; i < acl_users.elements ; i++)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (strchr(acl_user->host.hostname,wild_many) ||
strchr(acl_user->host.hostname,wild_one) ||
acl_user->host.ip_mask)
{ // Has wildcard
- uint j;
+ size_t j;
for (j=0 ; j < acl_wild_hosts.elements ; j++)
{ // Check if host already exists
acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,j,
@@ -3834,7 +3839,7 @@ static bool add_role_user_mapping(const char *uname, const char *hname,
static void remove_ptr_from_dynarray(DYNAMIC_ARRAY *array, void *ptr)
{
bool found __attribute__((unused))= false;
- for (uint i= 0; i < array->elements; i++)
+ for (size_t i= 0; i < array->elements; i++)
{
if (ptr == *dynamic_element(array, i, void**))
{
@@ -3883,7 +3888,7 @@ static void rebuild_role_grants(void)
/*
Reset every user's and role's role_grants array
*/
- for (uint i=0; i < acl_users.elements; i++) {
+ for (size_t i=0; i < acl_users.elements; i++) {
ACL_USER *user= dynamic_element(&acl_users, i, ACL_USER *);
reset_dynamic(&user->role_grants);
}
@@ -3909,7 +3914,7 @@ bool acl_check_host(const char *host, const char *ip)
mysql_mutex_unlock(&acl_cache->lock);
return 0; // Found host
}
- for (uint i=0 ; i < acl_wild_hosts.elements ; i++)
+ for (size_t i=0 ; i < acl_wild_hosts.elements ; i++)
{
acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,i,acl_host_and_ip*);
if (compare_hostname(acl, host, ip))
@@ -4066,7 +4071,8 @@ bool change_password(THD *thd, LEX_USER *user)
{
auth= acl_user->auth[i];
auth.auth_string= safe_lexcstrdup_root(&acl_memroot, user->auth->auth_str);
- int r= set_user_auth(thd, user->user, &auth, user->auth->pwtext);
+ int r= set_user_auth(thd, user->user, user->host,
+ &auth, user->auth->pwtext);
if (r == ER_SET_PASSWORD_AUTH_PLUGIN)
password_plugin= auth.plugin.str;
else if (r)
@@ -4359,14 +4365,18 @@ static ACL_USER * find_user_wild(const char *host, const char *user, const char
*/
static ACL_ROLE *find_acl_role(const char *role)
{
+ size_t length= strlen(role);
DBUG_ENTER("find_acl_role");
DBUG_PRINT("enter",("role: '%s'", role));
DBUG_PRINT("info", ("Hash elements: %ld", acl_roles.records));
mysql_mutex_assert_owner(&acl_cache->lock);
+ if (!length)
+ DBUG_RETURN(NULL);
+
ACL_ROLE *r= (ACL_ROLE *)my_hash_search(&acl_roles, (uchar *)role,
- strlen(role));
+ length);
DBUG_RETURN(r);
}
@@ -5118,7 +5128,7 @@ acl_update_proxy_user(ACL_PROXY_USER *new_value, bool is_revoke)
mysql_mutex_assert_owner(&acl_cache->lock);
DBUG_ENTER("acl_update_proxy_user");
- for (uint i= 0; i < acl_proxy_users.elements; i++)
+ for (size_t i= 0; i < acl_proxy_users.elements; i++)
{
ACL_PROXY_USER *acl_user=
dynamic_element(&acl_proxy_users, i, ACL_PROXY_USER *);
@@ -6396,7 +6406,7 @@ static int traverse_role_graph_impl(ACL_USER_BASE *user, void *context,
end:
/* Cleanup */
- for (uint i= 0; i < to_clear.elements(); i++)
+ for (size_t i= 0; i < to_clear.elements(); i++)
{
ACL_USER_BASE *current= to_clear.at(i);
DBUG_ASSERT(current->flags & (ROLE_EXPLORED | ROLE_ON_STACK | ROLE_OPENED));
@@ -6464,7 +6474,7 @@ static bool merge_role_global_privileges(ACL_ROLE *grantee)
DBUG_EXECUTE_IF("role_merge_stats", role_global_merges++;);
- for (uint i= 0; i < grantee->role_grants.elements; i++)
+ for (size_t i= 0; i < grantee->role_grants.elements; i++)
{
ACL_ROLE *r= *dynamic_element(&grantee->role_grants, i, ACL_ROLE**);
grantee->access|= r->access;
@@ -6603,8 +6613,8 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
if (update_flags & 4)
{
// Remove elements marked for deletion.
- uint count= 0;
- for(uint i= 0; i < acl_dbs.elements(); i++)
+ size_t count= 0;
+ for(size_t i= 0; i < acl_dbs.elements(); i++)
{
ACL_DB *acl_db= &acl_dbs.at(i);
if (acl_db->sort)
@@ -6966,7 +6976,7 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)),
if (data->what != PRIVS_TO_MERGE::GLOBAL)
{
role_hash.insert(grantee);
- for (uint i= 0; i < grantee->role_grants.elements; i++)
+ for (size_t i= 0; i < grantee->role_grants.elements; i++)
role_hash.insert(*dynamic_element(&grantee->role_grants, i, ACL_ROLE**));
}
@@ -9552,7 +9562,7 @@ static bool show_role_grants(THD *thd, const char *hostname,
ACL_USER_BASE *acl_entry,
char *buff, size_t buffsize)
{
- uint counter;
+ size_t counter;
Protocol *protocol= thd->protocol;
LEX_CSTRING host= {const_cast<char*>(hostname), strlen(hostname)};
@@ -9665,7 +9675,7 @@ static bool show_database_privileges(THD *thd, const char *username,
privilege_t want_access(NO_ACL);
Protocol *protocol= thd->protocol;
- for (uint i=0 ; i < acl_dbs.elements() ; i++)
+ for (size_t i=0 ; i < acl_dbs.elements() ; i++)
{
const char *user, *host;
@@ -10354,14 +10364,14 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
if (drop)
{
// delete the role from cross-reference arrays
- for (uint i=0; i < acl_role->role_grants.elements; i++)
+ for (size_t i=0; i < acl_role->role_grants.elements; i++)
{
ACL_ROLE *grant= *dynamic_element(&acl_role->role_grants,
i, ACL_ROLE**);
remove_ptr_from_dynarray(&grant->parent_grantee, acl_role);
}
- for (uint i=0; i < acl_role->parent_grantee.elements; i++)
+ for (size_t i=0; i < acl_role->parent_grantee.elements; i++)
{
ACL_USER_BASE *grantee= *dynamic_element(&acl_role->parent_grantee,
i, ACL_USER_BASE**);
@@ -10388,7 +10398,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
/* Get the number of elements in the in-memory structure. */
switch (struct_no) {
case USER_ACL:
- elements= acl_users.elements;
+ elements= int(acl_users.elements);
break;
case DB_ACL:
elements= int(acl_dbs.elements());
@@ -10414,7 +10424,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
elements= grant_name_hash->records;
break;
case PROXY_USERS_ACL:
- elements= acl_proxy_users.elements;
+ elements= int(acl_proxy_users.elements);
break;
case ROLES_MAPPINGS_HASH:
roles_mappings_hash= &acl_roles_mappings;
@@ -12274,11 +12284,11 @@ SHOW_VAR acl_statistics[] = {
{"procedure_grants", (char*)&proc_priv_hash.records, SHOW_ULONG},
{"package_spec_grants", (char*)&package_spec_priv_hash.records, SHOW_ULONG},
{"package_body_grants", (char*)&package_body_priv_hash.records, SHOW_ULONG},
- {"proxy_users", (char*)&acl_proxy_users.elements, SHOW_UINT},
+ {"proxy_users", (char*)&acl_proxy_users.elements, SHOW_SIZE_T},
{"role_grants", (char*)&acl_roles_mappings.records, SHOW_ULONG},
{"roles", (char*)&acl_roles.records, SHOW_ULONG},
{"table_grants", (char*)&column_priv_hash.records, SHOW_ULONG},
- {"users", (char*)&acl_users.elements, SHOW_UINT},
+ {"users", (char*)&acl_users.elements, SHOW_SIZE_T},
#endif
{NullS, NullS, SHOW_LONG},
};
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 39a5b7ff0db..e0b324e6342 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -657,8 +657,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->store(operator_name, system_charset_info);
protocol->store(&error_clex_str, system_charset_info);
length= my_snprintf(buff, sizeof(buff),
- ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT),
- table_name.str);
+ ER_THD(thd, ER_PARTITION_DOES_NOT_EXIST));
protocol->store(buff, length, system_charset_info);
if(protocol->write())
goto err;
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index a21933892de..0479b26b056 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -427,6 +427,8 @@ bool Sql_cmd_alter_table::execute(THD *thd)
as for RENAME TO, as being done by SQLCOM_RENAME_TABLE
*/
if ((alter_info.partition_flags & ALTER_PARTITION_DROP) ||
+ (alter_info.partition_flags & ALTER_PARTITION_CONVERT_IN) ||
+ (alter_info.partition_flags & ALTER_PARTITION_CONVERT_OUT) ||
(alter_info.flags & ALTER_RENAME))
priv_needed|= DROP_ACL;
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index d91984d4b26..bf1edd4c964 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -250,13 +250,15 @@ public:
const LEX_CSTRING *new_db_arg, const LEX_CSTRING *new_name_arg);
/**
- @return true if the table is moved to another database, false otherwise.
+ @return true if the table is moved to another database or a new table
+ created by ALTER_PARTITION_CONVERT_OUT, false otherwise.
*/
bool is_database_changed() const
{ return (new_db.str != db.str); };
/**
- @return true if the table is renamed, false otherwise.
+ @return true if the table is renamed or a new table created by
+ ALTER_PARTITION_CONVERT_OUT, false otherwise.
*/
bool is_table_renamed() const
{ return (is_database_changed() || new_name.str != table_name.str); };
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 8610e971016..85a53ae1a6f 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -114,19 +114,19 @@ template <class Elem> class Dynamic_array
{
DYNAMIC_ARRAY array;
public:
- Dynamic_array(PSI_memory_key psi_key, uint prealloc=16, uint increment=16)
+ Dynamic_array(PSI_memory_key psi_key, size_t prealloc=16, size_t increment=16)
{
init(psi_key, prealloc, increment);
}
- Dynamic_array(MEM_ROOT *root, uint prealloc=16, uint increment=16)
+ Dynamic_array(MEM_ROOT *root, size_t prealloc=16, size_t increment=16)
{
void *init_buffer= alloc_root(root, sizeof(Elem) * prealloc);
- init_dynamic_array2(root->m_psi_key, &array, sizeof(Elem), init_buffer,
- prealloc, increment, MYF(0));
+ init_dynamic_array2(root->psi_key, &array, sizeof(Elem), init_buffer,
+ prealloc, increment, MYF(0));
}
- void init(PSI_memory_key psi_key, uint prealloc=16, uint increment=16)
+ void init(PSI_memory_key psi_key, size_t prealloc=16, size_t increment=16)
{
init_dynamic_array2(psi_key, &array, sizeof(Elem), 0, prealloc, increment, MYF(0));
}
@@ -217,7 +217,7 @@ public:
void del(size_t idx)
{
DBUG_ASSERT(idx <= array.max_element);
- delete_dynamic_element(&array, (uint)idx);
+ delete_dynamic_element(&array, idx);
}
size_t elements() const
@@ -228,7 +228,7 @@ public:
void elements(size_t num_elements)
{
DBUG_ASSERT(num_elements <= array.max_element);
- array.elements= (uint)num_elements;
+ array.elements= num_elements;
}
void clear()
@@ -236,7 +236,7 @@ public:
elements(0);
}
- void set(uint idx, const Elem &el)
+ void set(size_t idx, const Elem &el)
{
set_dynamic(&array, &el, idx);
}
@@ -248,7 +248,7 @@ public:
bool reserve(size_t new_size)
{
- return allocate_dynamic(&array, (uint)new_size);
+ return allocate_dynamic(&array, new_size);
}
@@ -260,7 +260,7 @@ public:
if (new_size > old_size)
{
- set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1));
+ set_dynamic(&array, (uchar*)&default_val, new_size - 1);
/*for (size_t i= old_size; i != new_size; i++)
{
at(i)= default_val;
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc
index 6ee6ede31b8..c9c59c1b849 100644
--- a/sql/sql_audit.cc
+++ b/sql/sql_audit.cc
@@ -348,14 +348,11 @@ static my_bool calc_class_mask(THD *thd, plugin_ref plugin, void *arg)
*/
int finalize_audit_plugin(st_plugin_int *plugin)
{
+ int deinit_status= 0;
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
- if (plugin->plugin->deinit && plugin->plugin->deinit(NULL))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- DBUG_EXECUTE("finalize_audit_plugin", return 1; );
- }
+ if (plugin->plugin->deinit)
+ deinit_status= plugin->plugin->deinit(NULL);
plugin->data= NULL;
bzero(&event_class_mask, sizeof(event_class_mask));
@@ -374,7 +371,7 @@ int finalize_audit_plugin(st_plugin_int *plugin)
bmove(mysql_global_audit_mask, event_class_mask, sizeof(event_class_mask));
mysql_mutex_unlock(&LOCK_audit_mask);
- return 0;
+ return deinit_status;
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5de9782fd09..4142540fa88 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -6037,7 +6037,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length,
if (field)
{
if (field->invisible == INVISIBLE_FULL &&
- DBUG_EVALUATE_IF("test_completely_invisible", 0, 1))
+ !DBUG_IF("test_completely_invisible"))
DBUG_RETURN((Field*)0);
if (field->invisible == INVISIBLE_SYSTEM &&
@@ -7433,7 +7433,7 @@ store_top_level_join_columns(THD *thd, TABLE_LIST *table_ref,
/* Add a TRUE condition to outer joins that have no common columns. */
if (table_ref_2->outer_join &&
!table_ref_1->on_expr && !table_ref_2->on_expr)
- table_ref_2->on_expr= (Item*) &Item_true;
+ table_ref_2->on_expr= (Item*) Item_true;
/* Change this table reference to become a leaf for name resolution. */
if (left_neighbor)
@@ -9009,7 +9009,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr,
my_bool mysql_rm_tmp_tables(void)
{
- uint i, idx;
+ size_t i, idx;
char path[FN_REFLEN], *tmpdir, path_copy[FN_REFLEN];
MY_DIR *dirp;
FILEINFO *file;
@@ -9031,7 +9031,7 @@ my_bool mysql_rm_tmp_tables(void)
/* Remove all SQLxxx tables from directory */
- for (idx=0 ; idx < (uint) dirp->number_of_files ; idx++)
+ for (idx=0 ; idx < dirp->number_of_files ; idx++)
{
file=dirp->dir_entry+idx;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6276b00b939..876a59c542d 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -294,7 +294,7 @@ bool Foreign_key::validate(List<Create_field> &table_fields)
&sql_field->field_name)) {}
if (!sql_field)
{
- my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXIST, MYF(0), column->field_name.str);
DBUG_RETURN(TRUE);
}
if (type == Key::FOREIGN_KEY && sql_field->vcol_info)
@@ -752,8 +752,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
will be re-initialized in init_for_queries().
*/
init_sql_alloc(key_memory_thd_main_mem_root,
- &main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
- MYF(MY_THREAD_SPECIFIC));
+ &main_mem_root, 64, 0, MYF(MY_THREAD_SPECIFIC));
/*
Allocation of user variables for binary logging is always done with main
@@ -965,10 +964,8 @@ Internal_error_handler *THD::pop_internal_handler()
void THD::raise_error(uint sql_errno)
{
const char* msg= ER_THD(this, sql_errno);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_ERROR,
- msg);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_ERROR, msg);
}
void THD::raise_error_printf(uint sql_errno, ...)
@@ -981,20 +978,16 @@ void THD::raise_error_printf(uint sql_errno, ...)
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_ERROR,
- ebuff);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_ERROR, ebuff);
DBUG_VOID_RETURN;
}
void THD::raise_warning(uint sql_errno)
{
const char* msg= ER_THD(this, sql_errno);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_WARN,
- msg);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_WARN, msg);
}
void THD::raise_warning_printf(uint sql_errno, ...)
@@ -1007,10 +1000,8 @@ void THD::raise_warning_printf(uint sql_errno, ...)
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_WARN,
- ebuff);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_WARN, ebuff);
DBUG_VOID_RETURN;
}
@@ -1021,10 +1012,8 @@ void THD::raise_note(uint sql_errno)
if (!(variables.option_bits & OPTION_SQL_NOTES))
DBUG_VOID_RETURN;
const char* msg= ER_THD(this, sql_errno);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_NOTE,
- msg);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_NOTE, msg);
DBUG_VOID_RETURN;
}
@@ -1040,21 +1029,20 @@ void THD::raise_note_printf(uint sql_errno, ...)
va_start(args, sql_errno);
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
va_end(args);
- (void) raise_condition(sql_errno,
- NULL,
- Sql_condition::WARN_LEVEL_NOTE,
- ebuff);
+ (void) raise_condition(sql_errno, "\0\0\0\0\0",
+ Sql_condition::WARN_LEVEL_NOTE, ebuff);
DBUG_VOID_RETURN;
}
-Sql_condition* THD::raise_condition(uint sql_errno,
- const char* sqlstate,
- Sql_condition::enum_warning_level level,
- const Sql_user_condition_identity &ucid,
- const char* msg)
+Sql_condition* THD::raise_condition(const Sql_condition *cond)
{
+ uint sql_errno= cond->get_sql_errno();
+ const char *sqlstate= cond->get_sqlstate();
+ Sql_condition::enum_warning_level level= cond->get_level();
+ const char *msg= cond->get_message_text();
+
Diagnostics_area *da= get_stmt_da();
- Sql_condition *cond= NULL;
+ Sql_condition *raised= NULL;
DBUG_ENTER("THD::raise_condition");
DBUG_ASSERT(level < Sql_condition::WARN_LEVEL_END);
@@ -1082,22 +1070,18 @@ Sql_condition* THD::raise_condition(uint sql_errno,
sql_errno= ER_UNKNOWN_ERROR;
if (msg == NULL)
msg= ER_THD(this, sql_errno);
- if (sqlstate == NULL)
+ if (!*sqlstate)
sqlstate= mysql_errno_to_sqlstate(sql_errno);
- if ((level == Sql_condition::WARN_LEVEL_WARN) &&
- really_abort_on_warning())
+ if ((level == Sql_condition::WARN_LEVEL_WARN) && really_abort_on_warning())
{
- /*
- FIXME:
- push_warning and strict SQL_MODE case.
- */
+ /* FIXME: push_warning and strict SQL_MODE case. */
level= Sql_condition::WARN_LEVEL_ERROR;
}
if (!is_fatal_error &&
- handle_condition(sql_errno, sqlstate, &level, msg, &cond))
- DBUG_RETURN(cond);
+ handle_condition(sql_errno, sqlstate, &level, msg, &raised))
+ goto ret;
switch (level) {
case Sql_condition::WARN_LEVEL_NOTE:
@@ -1122,8 +1106,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
With wsrep we allow converting BF abort error to warning if
errors are ignored.
*/
- if (!is_fatal_error &&
- no_errors &&
+ if (!is_fatal_error && no_errors &&
(wsrep_trx().bf_aborted() || wsrep_retry_counter))
{
WSREP_DEBUG("BF abort error converted to warning");
@@ -1134,7 +1117,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
if (!da->is_error())
{
set_row_count_func(-1);
- da->set_error_status(sql_errno, msg, sqlstate, ucid, cond);
+ da->set_error_status(sql_errno, msg, sqlstate, *cond, raised);
}
}
}
@@ -1149,9 +1132,13 @@ Sql_condition* THD::raise_condition(uint sql_errno,
if (likely(!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY ||
sql_errno == ER_OUTOFMEMORY))))
{
- cond= da->push_warning(this, sql_errno, sqlstate, level, ucid, msg);
+ raised= da->push_warning(this, sql_errno, sqlstate, level, *cond, msg,
+ cond->m_row_number);
}
- DBUG_RETURN(cond);
+ret:
+ if (raised)
+ raised->copy_opt_attributes(cond);
+ DBUG_RETURN(raised);
}
extern "C"
@@ -1313,10 +1300,7 @@ void THD::init()
wsrep_desynced_backup_stage= false;
#endif /* WITH_WSREP */
- if (variables.sql_log_bin)
- variables.option_bits|= OPTION_BIN_LOG;
- else
- variables.option_bits&= ~OPTION_BIN_LOG;
+ set_binlog_bit();
select_commands= update_commands= other_commands= 0;
/* Set to handle counting of aborted connections */
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e07d91edf75..59a9aeb964c 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -566,7 +566,8 @@ typedef enum enum_diag_condition_item_name
DIAG_CURSOR_NAME= 9,
DIAG_MESSAGE_TEXT= 10,
DIAG_MYSQL_ERRNO= 11,
- LAST_DIAG_SET_PROPERTY= DIAG_MYSQL_ERRNO
+ DIAG_ROW_NUMBER= 12,
+ LAST_DIAG_SET_PROPERTY= DIAG_ROW_NUMBER
} Diag_condition_item_name;
/**
@@ -1137,6 +1138,7 @@ struct THD_count
{
static Atomic_counter<uint32_t> count;
static uint value() { return static_cast<uint>(count); }
+ static uint connection_thd_count();
THD_count() { count++; }
~THD_count() { count--; }
};
@@ -3102,8 +3104,8 @@ public:
{
bzero((char*)this, sizeof(*this));
implicit_xid.null();
- init_sql_alloc(key_memory_thd_transactions, &mem_root,
- ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
+ init_sql_alloc(key_memory_thd_transactions, &mem_root, 256,
+ 0, MYF(MY_THREAD_SPECIFIC));
}
} default_transaction, *transaction;
Global_read_lock global_read_lock;
@@ -3273,6 +3275,13 @@ public:
auto_inc_intervals_forced.empty(); // in case of multiple SET INSERT_ID
auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0);
}
+ inline void set_binlog_bit()
+ {
+ if (variables.sql_log_bin)
+ variables.option_bits |= OPTION_BIN_LOG;
+ else
+ variables.option_bits &= ~OPTION_BIN_LOG;
+ }
ulonglong limit_found_rows;
@@ -3969,6 +3978,11 @@ public:
user_time= t;
set_time();
}
+ inline void force_set_time(my_time_t t, ulong sec_part)
+ {
+ start_time= system_time.sec= t;
+ start_time_sec_part= system_time.sec_part= sec_part;
+ }
/*
this is only used by replication and BINLOG command.
usecs > TIME_MAX_SECOND_PART means "was not in binlog"
@@ -3980,15 +3994,9 @@ public:
else
{
if (sec_part <= TIME_MAX_SECOND_PART)
- {
- start_time= system_time.sec= t;
- start_time_sec_part= system_time.sec_part= sec_part;
- }
+ force_set_time(t, sec_part);
else if (t != system_time.sec)
- {
- start_time= system_time.sec= t;
- start_time_sec_part= system_time.sec_part= 0;
- }
+ force_set_time(t, 0);
else
{
start_time= t;
@@ -4854,45 +4862,17 @@ private:
@param msg the condition message text
@return The condition raised, or NULL
*/
- Sql_condition*
- raise_condition(uint sql_errno,
- const char* sqlstate,
- Sql_condition::enum_warning_level level,
- const char* msg)
+ Sql_condition* raise_condition(uint sql_errno, const char* sqlstate,
+ Sql_condition::enum_warning_level level, const char* msg)
{
- return raise_condition(sql_errno, sqlstate, level,
- Sql_user_condition_identity(), msg);
+ Sql_condition cond(NULL, // don't strdup the msg
+ Sql_condition_identity(sql_errno, sqlstate, level,
+ Sql_user_condition_identity()),
+ msg, get_stmt_da()->current_row_for_warning());
+ return raise_condition(&cond);
}
- /**
- Raise a generic or a user defined SQL condition.
- @param ucid - the user condition identity
- (or an empty identity if not a user condition)
- @param sql_errno - the condition error number
- @param sqlstate - the condition SQLSTATE
- @param level - the condition level
- @param msg - the condition message text
- @return The condition raised, or NULL
- */
- Sql_condition*
- raise_condition(uint sql_errno,
- const char* sqlstate,
- Sql_condition::enum_warning_level level,
- const Sql_user_condition_identity &ucid,
- const char* msg);
-
- Sql_condition*
- raise_condition(const Sql_condition *cond)
- {
- Sql_condition *raised= raise_condition(cond->get_sql_errno(),
- cond->get_sqlstate(),
- cond->get_level(),
- *cond/*Sql_user_condition_identity*/,
- cond->get_message_text());
- if (raised)
- raised->copy_opt_attributes(cond);
- return raised;
- }
+ Sql_condition* raise_condition(const Sql_condition *cond);
private:
void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
@@ -5534,7 +5514,8 @@ public:
bool restore_from_local_lex_to_old_lex(LEX *oldlex);
Item *sp_fix_func_item(Item **it_addr);
- Item *sp_prepare_func_item(Item **it_addr, uint cols= 1);
+ Item *sp_fix_func_item_for_assignment(const Field *to, Item **it_addr);
+ Item *sp_prepare_func_item(Item **it_addr, uint cols);
bool sp_eval_expr(Field *result_field, Item **expr_item_ptr);
bool sql_parser(LEX *old_lex, LEX *lex,
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index ce34852117f..430afadb491 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -75,7 +75,6 @@ enum enum_sql_command {
SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE,
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE,
- SQLCOM_ALTER_TABLESPACE,
SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
SQLCOM_SHOW_AUTHORS, SQLCOM_BINLOG_BASE64_EVENT,
SQLCOM_SHOW_PLUGINS, SQLCOM_SHOW_CONTRIBUTORS,
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 37e136927f2..c5defc1959c 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1363,9 +1363,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
*tables= tot_list;
/* and at last delete all non-table files */
- for (uint idx=0 ;
- idx < (uint) dirp->number_of_files && !thd->killed ;
- idx++)
+ for (size_t idx=0; idx < dirp->number_of_files && !thd->killed; idx++)
{
FILEINFO *file=dirp->dir_entry+idx;
char *extension;
@@ -1488,9 +1486,7 @@ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
DBUG_ENTER("mysql_rm_arc_files");
DBUG_PRINT("enter", ("path: %s", org_path));
- for (uint idx=0 ;
- idx < (uint) dirp->number_of_files && !thd->killed ;
- idx++)
+ for (size_t idx=0; idx < dirp->number_of_files && !thd->killed; idx++)
{
FILEINFO *file=dirp->dir_entry+idx;
char *extension, *revision;
@@ -1970,8 +1966,8 @@ bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db)
/* Step2: Move tables to the new database */
if ((dirp = my_dir(path,MYF(MY_DONT_SORT))))
{
- uint nfiles= (uint) dirp->number_of_files;
- for (uint idx=0 ; idx < nfiles && !thd->killed ; idx++)
+ size_t nfiles= dirp->number_of_files;
+ for (size_t idx=0 ; idx < nfiles && !thd->killed ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
char *extension, tname[FN_REFLEN + 1];
@@ -2060,8 +2056,8 @@ bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db)
if ((dirp = my_dir(path,MYF(MY_DONT_SORT))))
{
- uint nfiles= (uint) dirp->number_of_files;
- for (uint idx=0 ; idx < nfiles ; idx++)
+ size_t nfiles= dirp->number_of_files;
+ for (size_t idx=0 ; idx < nfiles ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
char oldname[FN_REFLEN + 1], newname[FN_REFLEN + 1];
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 4c679267456..d74b9e8916f 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -733,6 +733,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
explain= (Explain_delete*)thd->lex->explain->get_upd_del_plan();
explain->tracker.on_scan_init();
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
+
if (!delete_while_scanning)
{
/*
@@ -798,9 +800,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
THD_STAGE_INFO(thd, stage_updating);
fix_rownum_pointers(thd, thd->lex->current_select, &deleted);
+ thd->get_stmt_da()->reset_current_row_for_warning(0);
while (likely(!(error=info.read_record())) && likely(!thd->killed) &&
likely(!thd->is_error()))
{
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (delete_while_scanning)
delete_record= record_should_be_deleted(thd, table, select, explain,
delete_history);
@@ -876,6 +880,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
else
break;
}
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
terminate_delete:
killed_status= thd->killed;
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index cef9e6cec00..85be61c34ef 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -204,6 +204,7 @@ Sql_condition::copy_opt_attributes(const Sql_condition *cond)
copy_string(m_mem_root, & m_table_name, & cond->m_table_name);
copy_string(m_mem_root, & m_column_name, & cond->m_column_name);
copy_string(m_mem_root, & m_cursor_name, & cond->m_cursor_name);
+ m_row_number= cond->m_row_number;
}
@@ -216,7 +217,7 @@ Sql_condition::set_builtin_message_text(const char* str)
*/
const char* copy;
- copy= strdup_root(m_mem_root, str);
+ copy= m_mem_root ? strdup_root(m_mem_root, str) : str;
m_message_text.set(copy, strlen(copy), error_message_charset_info);
DBUG_ASSERT(! m_message_text.is_alloced());
}
@@ -500,7 +501,7 @@ Diagnostics_area::disable_status()
Warning_info::Warning_info(ulonglong warn_id_arg,
bool allow_unlimited_warnings, bool initialize)
:m_current_statement_warn_count(0),
- m_current_row_for_warning(1),
+ m_current_row_for_warning(0),
m_warn_id(warn_id_arg),
m_error_condition(NULL),
m_allow_unlimited_warnings(allow_unlimited_warnings),
@@ -557,7 +558,7 @@ void Warning_info::clear(ulonglong new_id)
free_memory();
memset(m_warn_count, 0, sizeof(m_warn_count));
m_current_statement_warn_count= 0;
- m_current_row_for_warning= 1; /* Start counting from the first row */
+ m_current_row_for_warning= 0;
clear_error_condition();
}
@@ -663,7 +664,8 @@ void Warning_info::reserve_space(THD *thd, uint count)
Sql_condition *Warning_info::push_warning(THD *thd,
const Sql_condition_identity *value,
- const char *msg)
+ const char *msg,
+ ulong current_row_number)
{
Sql_condition *cond= NULL;
@@ -672,7 +674,8 @@ Sql_condition *Warning_info::push_warning(THD *thd,
if (m_allow_unlimited_warnings ||
m_warn_list.elements() < thd->variables.max_error_count)
{
- cond= new (& m_warn_root) Sql_condition(& m_warn_root, *value, msg);
+ cond= new (& m_warn_root) Sql_condition(& m_warn_root, *value, msg,
+ current_row_number);
if (cond)
m_warn_list.push_back(cond);
}
@@ -688,7 +691,8 @@ Sql_condition *Warning_info::push_warning(THD *thd,
const Sql_condition *sql_condition)
{
Sql_condition *new_condition= push_warning(thd, sql_condition,
- sql_condition->get_message_text());
+ sql_condition->get_message_text(),
+ sql_condition->m_row_number);
if (new_condition)
new_condition->copy_opt_attributes(sql_condition);
@@ -723,7 +727,7 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level,
if (level == Sql_condition::WARN_LEVEL_ERROR)
level= Sql_condition::WARN_LEVEL_WARN;
- (void) thd->raise_condition(code, NULL, level, msg);
+ (void) thd->raise_condition(code, "\0\0\0\0\0", level, msg);
/* Make sure we also count warnings pushed after calling set_ok_status(). */
thd->get_stmt_da()->increment_warning();
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 8c0deb5e172..d7c29c5f9a4 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -306,6 +306,9 @@ protected:
/** SQL CURSOR_NAME condition item. */
String m_cursor_name;
+ /** SQL ROW_NUMBER condition item. */
+ ulong m_row_number;
+
Sql_condition_items()
:m_class_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin),
m_subclass_origin((const char*) NULL, 0, & my_charset_utf8mb3_bin),
@@ -316,7 +319,8 @@ protected:
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)
+ m_cursor_name((const char*) NULL, 0, & my_charset_utf8mb3_bin),
+ m_row_number(0)
{ }
void clear()
@@ -331,6 +335,7 @@ protected:
m_table_name.length(0);
m_column_name.length(0);
m_cursor_name.length(0);
+ m_row_number= 0;
}
};
@@ -434,16 +439,14 @@ private:
@param level - the error level for this condition
@param msg - the message text for this condition
*/
- Sql_condition(MEM_ROOT *mem_root,
- const Sql_condition_identity &value,
- const char *msg)
- :Sql_condition_identity(value),
- m_mem_root(mem_root)
+ Sql_condition(MEM_ROOT *mem_root, const Sql_condition_identity &value,
+ const char *msg, ulong current_row_for_warning)
+ : Sql_condition_identity(value), m_mem_root(mem_root)
{
- DBUG_ASSERT(mem_root != NULL);
DBUG_ASSERT(value.get_sql_errno() != 0);
DBUG_ASSERT(msg != NULL);
set_builtin_message_text(msg);
+ m_row_number= current_row_for_warning;
}
/** Destructor. */
@@ -720,7 +723,7 @@ private:
void inc_current_row_for_warning() { m_current_row_for_warning++; }
/** Reset the current row counter. Start counting from the first row. */
- void reset_current_row_for_warning() { m_current_row_for_warning= 1; }
+ void reset_current_row_for_warning(int n) { m_current_row_for_warning= n; }
ulong set_current_row_for_warning(ulong row)
{
@@ -749,9 +752,8 @@ private:
@return a pointer to the added SQL-condition.
*/
- Sql_condition *push_warning(THD *thd,
- const Sql_condition_identity *identity,
- const char* msg);
+ Sql_condition *push_warning(THD *thd, const Sql_condition_identity *identity,
+ const char* msg, ulong current_row_number);
/**
Add a new SQL-condition to the current list and increment the respective
@@ -1153,8 +1155,8 @@ public:
void inc_current_row_for_warning()
{ get_warning_info()->inc_current_row_for_warning(); }
- void reset_current_row_for_warning()
- { get_warning_info()->reset_current_row_for_warning(); }
+ void reset_current_row_for_warning(int n)
+ { get_warning_info()->reset_current_row_for_warning(n); }
bool is_warning_info_read_only() const
{ return get_warning_info()->is_read_only(); }
@@ -1185,10 +1187,12 @@ public:
const char* sqlstate,
Sql_condition::enum_warning_level level,
const Sql_user_condition_identity &ucid,
- const char* msg)
+ const char* msg,
+ ulong current_row_number)
{
Sql_condition_identity tmp(sql_errno_arg, sqlstate, level, ucid);
- return get_warning_info()->push_warning(thd, &tmp, msg);
+ return get_warning_info()->push_warning(thd, &tmp, msg,
+ current_row_number);
}
Sql_condition *push_warning(THD *thd,
@@ -1198,7 +1202,7 @@ public:
const char* msg)
{
return push_warning(thd, sqlerrno, sqlstate, level,
- Sql_user_condition_identity(), msg);
+ Sql_user_condition_identity(), msg, 0);
}
void mark_sql_conditions_for_removal()
{ get_warning_info()->mark_sql_conditions_for_removal(); }
diff --git a/sql/sql_get_diagnostics.cc b/sql/sql_get_diagnostics.cc
index 197bf5e7a00..240975d2974 100644
--- a/sql/sql_get_diagnostics.cc
+++ b/sql/sql_get_diagnostics.cc
@@ -338,6 +338,8 @@ Condition_information_item::get_value(THD *thd, const Sql_condition *cond)
str.set_ascii(cond->get_sqlstate(), strlen(cond->get_sqlstate()));
value= make_utf8_string_item(thd, &str);
break;
+ case ROW_NUMBER:
+ value= new (thd->mem_root) Item_uint(thd, cond->m_row_number);
}
DBUG_RETURN(value);
diff --git a/sql/sql_get_diagnostics.h b/sql/sql_get_diagnostics.h
index f283aa5b2c6..efe526d7c61 100644
--- a/sql/sql_get_diagnostics.h
+++ b/sql/sql_get_diagnostics.h
@@ -254,7 +254,8 @@ public:
CURSOR_NAME,
MESSAGE_TEXT,
MYSQL_ERRNO,
- RETURNED_SQLSTATE
+ RETURNED_SQLSTATE,
+ ROW_NUMBER
};
/**
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 5ad968f19a0..c7bef0f7027 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -229,6 +229,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
}
if (values.elements != table->s->visible_fields)
{
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
DBUG_RETURN(-1);
}
@@ -253,6 +254,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
if (fields.elements != values.elements)
{
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
DBUG_RETURN(-1);
}
@@ -699,7 +701,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
const bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
bool using_bulk_insert= 0;
uint value_count;
- ulong counter = 1;
/* counter of iteration in bulk PS operation*/
ulonglong iteration= 0;
ulonglong id;
@@ -767,7 +768,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
value_count= values->elements;
if ((res= mysql_prepare_insert(thd, table_list, fields, values,
- update_fields, update_values, duplic,
+ update_fields, update_values, duplic, ignore,
&unused_conds, FALSE)))
{
retval= thd->is_error();
@@ -828,12 +829,27 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
context->resolve_in_table_list_only(table_list);
switch_to_nullable_trigger_fields(*values, table);
+ /*
+ Check assignability for the leftmost () in VALUES:
+ INSERT INTO t1 (a,b) VALUES (1,2), (3,4);
+ This checks if the values (1,2) can be assigned to fields (a,b).
+ The further values, e.g. (3,4) are not checked - they will be
+ checked during the execution time (when processing actual rows).
+ This is to preserve the "insert until the very first error"-style
+ behaviour for non-transactional tables.
+ */
+ if (values->elements &&
+ table_list->table->check_assignability_opt_fields(fields, *values,
+ ignore))
+ goto abort;
+
while ((values= its++))
{
- counter++;
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (values->elements != value_count)
{
- my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0),
+ thd->get_stmt_da()->current_row_for_warning());
goto abort;
}
if (setup_fields(thd, Ref_ptr_array(),
@@ -842,6 +858,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
switch_to_nullable_trigger_fields(*values, table);
}
its.rewind ();
+ thd->get_stmt_da()->reset_current_row_for_warning(0);
/* Restore the current context. */
ctx_state.restore_state(context, table_list);
@@ -1013,6 +1030,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
while ((values= its++))
{
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (fields.elements || !value_count)
{
/*
@@ -1129,7 +1147,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
if (unlikely(error))
break;
info.accepted_rows++;
- thd->get_stmt_da()->inc_current_row_for_warning();
}
its.rewind();
iteration++;
@@ -1162,8 +1179,13 @@ values_loop_end:
table->file->ha_release_auto_increment();
if (using_bulk_insert)
{
- if (unlikely(table->file->ha_end_bulk_insert()) &&
- !error)
+ /*
+ if my_error() wasn't called yet on some specific row, end_bulk_insert()
+ can still do it, but the error shouldn't be for any specific row number
+ */
+ if (!error)
+ thd->get_stmt_da()->reset_current_row_for_warning(0);
+ if (unlikely(table->file->ha_end_bulk_insert()) && !error)
{
table->file->print_error(my_errno,MYF(0));
error=1;
@@ -1424,7 +1446,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
- (void) my_bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
+ (void) my_bitmap_init(&used_fields, used_fields_buff, table->s->fields);
bitmap_clear_all(&used_fields);
view->contain_auto_increment= 0;
@@ -1617,7 +1639,8 @@ static void prepare_for_positional_update(TABLE *table, TABLE_LIST *tables)
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
List<Item> &fields, List_item *values,
List<Item> &update_fields, List<Item> &update_values,
- enum_duplicates duplic, COND **where,
+ enum_duplicates duplic, bool ignore,
+ COND **where,
bool select_insert)
{
SELECT_LEX *select_lex= thd->lex->first_select_lex();
@@ -1685,7 +1708,16 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
{
select_lex->no_wrap_view_item= TRUE;
res= check_update_fields(thd, context->table_list, update_fields,
- update_values, false, &map);
+ update_values, false, &map) ||
+ /*
+ Check that all col=expr pairs are compatible for assignment in
+ INSERT INTO t1 VALUES (...)
+ ON DUPLICATE KEY UPDATE col=expr [, col=expr];
+ */
+ TABLE::check_assignability_explicit_fields(update_fields,
+ update_values,
+ ignore);
+
select_lex->no_wrap_view_item= FALSE;
}
@@ -1693,6 +1725,8 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
ctx_state.restore_state(context, table_list);
}
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
+
if (res)
DBUG_RETURN(res);
@@ -2800,7 +2834,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
my_bitmap_init(&copy->has_value_set,
(my_bitmap_map*) (bitmap +
bitmaps_used*share->column_bitmap_size),
- share->fields, FALSE);
+ share->fields);
}
copy->tmp_set.bitmap= 0; // To catch errors
bzero((char*) bitmap, share->column_bitmap_size * bitmaps_used);
@@ -3783,7 +3817,7 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res)
if ((res= mysql_prepare_insert(thd, lex->query_tables, lex->field_list, 0,
lex->update_list, lex->value_list,
- lex->duplicates,
+ lex->duplicates, lex->ignore,
&select_lex->where, TRUE)))
DBUG_RETURN(res);
@@ -3877,6 +3911,17 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
check_insert_fields(thd, table_list, *fields, values,
!insert_into_view, 1, &map));
+ if (!res)
+ {
+ /*
+ Check that all colN=exprN pairs are compatible for assignment, e.g.:
+ INSERT INTO t1 (col1, col2) VALUES (expr1, expr2);
+ INSERT INTO t1 SET col1=expr1, col2=expr2;
+ */
+ res= table_list->table->check_assignability_opt_fields(*fields, values,
+ lex->ignore);
+ }
+
if (!res && fields->elements)
{
Abort_on_warning_instant_set aws(thd,
@@ -3930,7 +3975,15 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
res= res || setup_fields(thd, Ref_ptr_array(), *info.update_values,
- MARK_COLUMNS_READ, 0, NULL, 0);
+ MARK_COLUMNS_READ, 0, NULL, 0) ||
+ /*
+ Check that all col=expr pairs are compatible for assignment in
+ INSERT INTO t1 SELECT ... FROM t2
+ ON DUPLICATE KEY UPDATE col=expr [, col=expr]
+ */
+ TABLE::check_assignability_explicit_fields(*info.update_fields,
+ *info.update_values,
+ lex->ignore);
if (!res)
{
/*
@@ -5096,7 +5149,8 @@ bool select_create::send_eof()
{
WSREP_DEBUG("select_create commit failed, thd: %llu err: %s %s",
thd->thread_id,
- wsrep_thd_transaction_state_str(thd), wsrep_thd_query(thd));
+ wsrep_thd_transaction_state_str(thd),
+ wsrep_thd_query(thd));
mysql_mutex_unlock(&thd->LOCK_thd_data);
abort_result_set();
DBUG_RETURN(true);
diff --git a/sql/sql_insert.h b/sql/sql_insert.h
index 80666a81c50..8b034c25877 100644
--- a/sql/sql_insert.h
+++ b/sql/sql_insert.h
@@ -27,6 +27,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
List<Item> &fields, List_item *values,
List<Item> &update_fields,
List<Item> &update_values, enum_duplicates duplic,
+ bool ignore,
COND **where, bool select_insert);
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields,
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b743141598f..9cf10bd5b82 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1352,7 +1352,7 @@ void lex_unlock_plugins(LEX *lex)
/* release used plugins */
if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
{
- plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
+ plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
lex->plugins.elements);
}
reset_dynamic(&lex->plugins);
@@ -6062,8 +6062,10 @@ int st_select_lex_unit::save_union_explain_part2(Explain_query *output)
bool LEX::is_partition_management() const
{
return (sql_command == SQLCOM_ALTER_TABLE &&
- (alter_info.partition_flags == ALTER_PARTITION_ADD ||
- alter_info.partition_flags == ALTER_PARTITION_REORGANIZE));
+ (alter_info.partition_flags & (ALTER_PARTITION_ADD |
+ ALTER_PARTITION_CONVERT_IN |
+ ALTER_PARTITION_CONVERT_OUT |
+ ALTER_PARTITION_REORGANIZE)));
}
@@ -9733,6 +9735,7 @@ bool Lex_ident_sys_st::to_size_number(ulonglong *to) const
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool LEX::part_values_current(THD *thd)
{
partition_element *elem= part_info->curr_part_elem;
@@ -9740,7 +9743,7 @@ bool LEX::part_values_current(THD *thd)
{
if (unlikely(part_info->part_type != VERSIONING_PARTITION))
{
- my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
+ part_type_error(thd, NULL, "SYSTEM_TIME", part_info);
return true;
}
}
@@ -9767,7 +9770,7 @@ bool LEX::part_values_history(THD *thd)
{
if (unlikely(part_info->part_type != VERSIONING_PARTITION))
{
- my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
+ part_type_error(thd, NULL, "SYSTEM_TIME", part_info);
return true;
}
}
@@ -9788,6 +9791,7 @@ bool LEX::part_values_history(THD *thd)
elem->type= partition_element::HISTORY;
return false;
}
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
bool LEX::last_field_generated_always_as_row_start_or_end(Lex_ident *p,
@@ -11362,6 +11366,25 @@ bool LEX::stmt_alter_table_exchange_partition(Table_ident *table)
}
+bool LEX::stmt_alter_table(Table_ident *table)
+{
+ DBUG_ASSERT(sql_command == SQLCOM_ALTER_TABLE);
+ first_select_lex()->db= table->db;
+ if (first_select_lex()->db.str == NULL &&
+ copy_db_to(&first_select_lex()->db))
+ return true;
+ if (unlikely(check_table_name(table->table.str, table->table.length,
+ false)) ||
+ (table->db.str && unlikely(check_db_name((LEX_STRING*) &table->db))))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
+ return true;
+ }
+ name= table->table;
+ return false;
+}
+
+
void LEX::stmt_purge_to(const LEX_CSTRING &to)
{
type= 0;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 82453ad8259..85f7da7d09f 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -291,7 +291,6 @@ class sp_pcontext;
class sp_variable;
class sp_expr_lex;
class sp_assignment_lex;
-class st_alter_tablespace;
class partition_info;
class Event_parse_data;
class set_var_base;
@@ -3524,12 +3523,6 @@ public:
/*
- Reference to a struct that contains information in various commands
- to add/create/drop/change table spaces.
- */
- st_alter_tablespace *alter_tablespace_info;
-
- /*
The set of those tables whose fields are referenced in all subqueries
of the query.
TODO: possibly this it is incorrect to have used tables in LEX because
@@ -3786,8 +3779,10 @@ public:
bool table_or_sp_used();
bool is_partition_management() const;
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool part_values_current(THD *thd);
bool part_values_history(THD *thd);
+#endif
/**
@brief check if the statement is a single-level join
@@ -4719,6 +4714,7 @@ public:
void stmt_deallocate_prepare(const Lex_ident_sys_st &ident);
bool stmt_alter_table_exchange_partition(Table_ident *table);
+ bool stmt_alter_table(Table_ident *table);
void stmt_purge_to(const LEX_CSTRING &to);
bool stmt_purge_before(Item *item);
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 2f1ee0b11bd..fe574db528f 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -659,6 +659,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
table->copy_blobs=1;
thd->abort_on_warning= !ignore && thd->is_strict_mode();
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
bool create_lookup_handler= handle_duplicates != DUP_ERROR;
if ((table_list->table->file->ha_table_flags() & HA_DUPLICATE_POS))
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 39b364e475d..2b8ea9265de 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -54,7 +54,6 @@
// check_mqh,
// reset_mqh
#include "sql_rename.h" // mysql_rename_tables
-#include "sql_tablespace.h" // mysql_alter_tablespace
#include "hostname.h" // hostname_cache_refresh
#include "sql_test.h" // mysql_print_status
#include "sql_select.h" // handle_select, mysql_select,
@@ -878,7 +877,6 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_ALTER_PROCEDURE]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_ALTER_FUNCTION]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_TRUNCATE]|= CF_DISALLOW_IN_RO_TRANS;
- sql_command_flags[SQLCOM_ALTER_TABLESPACE]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_REPAIR]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_OPTIMIZE]|= CF_DISALLOW_IN_RO_TRANS;
sql_command_flags[SQLCOM_GRANT]|= CF_DISALLOW_IN_RO_TRANS;
@@ -4139,7 +4137,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
If new master was not added, we still need to free mi.
*/
if (master_info_added)
- master_info_index->remove_master_info(mi);
+ master_info_index->remove_master_info(mi, 1);
else
delete mi;
}
@@ -5891,12 +5889,6 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
case SQLCOM_XA_RECOVER:
res= mysql_xa_recover(thd);
break;
- case SQLCOM_ALTER_TABLESPACE:
- if (check_global_access(thd, CREATE_TABLESPACE_ACL))
- break;
- if (!(res= mysql_alter_tablespace(thd, lex->alter_tablespace_info)))
- my_ok(thd);
- break;
case SQLCOM_INSTALL_PLUGIN:
if (! (res= mysql_install_plugin(thd, &thd->lex->comment,
&thd->lex->ident)))
@@ -6128,7 +6120,12 @@ finish:
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
if (wsrep_thd_is_toi(thd) || wsrep_thd_is_in_rsu(thd))
+ {
+ WSREP_DEBUG("mysql_execute_command for %s", wsrep_thd_query(thd));
+ THD_STAGE_INFO(thd, stage_waiting_isolation);
wsrep_to_isolation_end(thd);
+ }
+
/*
Force release of transactional locks if not in active MST and wsrep is on.
*/
@@ -7878,7 +7875,8 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
});
#endif
WSREP_DEBUG("wsrep retrying AC query: %lu %s",
- thd->wsrep_retry_counter, wsrep_thd_query(thd));
+ thd->wsrep_retry_counter,
+ wsrep_thd_query(thd));
wsrep_prepare_for_autocommit_retry(thd, rawbuf, length, parser_state);
if (thd->lex->explain)
delete_explain_query(thd->lex);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index adb1ad391cf..d7078278557 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -67,7 +67,6 @@
#include "opt_range.h" // store_key_image_to_rec
#include "sql_alter.h" // Alter_table_ctx
#include "sql_select.h"
-#include "sql_tablespace.h" // check_tablespace_name
#include "ddl_log.h"
#include "tztime.h" // my_tz_OFFSET0
@@ -78,11 +77,6 @@ using std::min;
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
-#define ERROR_INJECT_CRASH(code) \
- DBUG_EVALUATE_IF(code, (DBUG_SUICIDE(), 0), 0)
-#define ERROR_INJECT_ERROR(code) \
- DBUG_EVALUATE_IF(code, (my_error(ER_UNKNOWN_ERROR, MYF(0)), TRUE), 0)
-
/*
Partition related functions declarations and some static constants;
*/
@@ -525,7 +519,7 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
goto end;
}
if (unlikely(my_bitmap_init(&part_info->full_part_field_set, bitmap_buf,
- table->s->fields, FALSE)))
+ table->s->fields)))
{
result= TRUE;
goto end;
@@ -1100,10 +1094,10 @@ static bool set_up_partition_bitmaps(THD *thd, partition_info *part_info)
bitmap_bytes * 2))))
DBUG_RETURN(TRUE);
- my_bitmap_init(&part_info->read_partitions, bitmap_buf, bitmap_bits, FALSE);
+ my_bitmap_init(&part_info->read_partitions, bitmap_buf, bitmap_bits);
/* Use the second half of the allocated buffer for lock_partitions */
my_bitmap_init(&part_info->lock_partitions, bitmap_buf + (bitmap_bytes / 4),
- bitmap_bits, FALSE);
+ bitmap_bits);
part_info->bitmaps_are_initialized= TRUE;
part_info->set_partition_bitmaps(NULL);
DBUG_RETURN(FALSE);
@@ -2215,8 +2209,6 @@ static int add_partition_options(String *str, partition_element *p_elem)
{
int err= 0;
- if (p_elem->tablespace_name)
- err+= add_keyword_string(str,"TABLESPACE", false, p_elem->tablespace_name);
if (p_elem->nodegroup_id != UNDEF_NODEGROUP)
err+= add_keyword_int(str,"NODEGROUP",(longlong)p_elem->nodegroup_id);
if (p_elem->part_max_rows)
@@ -2463,7 +2455,7 @@ end:
@retval != 0 Failure
*/
-static int add_key_with_algorithm(String *str, partition_info *part_info)
+static int add_key_with_algorithm(String *str, const partition_info *part_info)
{
int err= 0;
err+= str->append(STRING_WITH_LEN("KEY "));
@@ -2492,6 +2484,78 @@ char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info,
return res;
}
+
+/*
+ Generate the partition type syntax from the partition data structure.
+
+ @return Operation status.
+ @retval 0 Success
+ @retval > 0 Failure
+ @retval -1 Fatal error
+*/
+
+int partition_info::gen_part_type(THD *thd, String *str) const
+{
+ int err= 0;
+ switch (part_type)
+ {
+ case RANGE_PARTITION:
+ err+= str->append(STRING_WITH_LEN("RANGE "));
+ break;
+ case LIST_PARTITION:
+ err+= str->append(STRING_WITH_LEN("LIST "));
+ break;
+ case HASH_PARTITION:
+ if (linear_hash_ind)
+ err+= str->append(STRING_WITH_LEN("LINEAR "));
+ if (list_of_part_fields)
+ {
+ err+= add_key_with_algorithm(str, this);
+ err+= add_part_field_list(thd, str, part_field_list);
+ }
+ else
+ err+= str->append(STRING_WITH_LEN("HASH "));
+ break;
+ case VERSIONING_PARTITION:
+ err+= str->append(STRING_WITH_LEN("SYSTEM_TIME "));
+ break;
+ default:
+ DBUG_ASSERT(0);
+ /* We really shouldn't get here, no use in continuing from here */
+ my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATAL));
+ return -1;
+ }
+ return err;
+}
+
+
+void part_type_error(THD *thd, partition_info *work_part_info,
+ const char *part_type,
+ partition_info *tab_part_info)
+{
+ StringBuffer<256> tab_part_type;
+ if (tab_part_info->gen_part_type(thd, &tab_part_type) < 0)
+ return;
+ tab_part_type.length(tab_part_type.length() - 1);
+ if (work_part_info)
+ {
+ DBUG_ASSERT(!part_type);
+ StringBuffer<256> work_part_type;
+ if (work_part_info->gen_part_type(thd, &work_part_type) < 0)
+ return;
+ work_part_type.length(work_part_type.length() - 1);
+ my_error(ER_PARTITION_WRONG_TYPE, MYF(0), work_part_type.c_ptr(),
+ tab_part_type.c_ptr());
+ }
+ else
+ {
+ DBUG_ASSERT(part_type);
+ my_error(ER_PARTITION_WRONG_TYPE, MYF(0), part_type,
+ tab_part_type.c_ptr());
+ }
+}
+
+
/*
Generate the partition syntax from the partition data structure.
Useful for support of generating defaults, SHOW CREATE TABLES
@@ -2535,34 +2599,10 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info,
DBUG_ENTER("generate_partition_syntax");
err+= str.append(STRING_WITH_LEN(" PARTITION BY "));
- switch (part_info->part_type)
- {
- case RANGE_PARTITION:
- err+= str.append(STRING_WITH_LEN("RANGE "));
- break;
- case LIST_PARTITION:
- err+= str.append(STRING_WITH_LEN("LIST "));
- break;
- case HASH_PARTITION:
- if (part_info->linear_hash_ind)
- err+= str.append(STRING_WITH_LEN("LINEAR "));
- if (part_info->list_of_part_fields)
- {
- err+= add_key_with_algorithm(&str, part_info);
- err+= add_part_field_list(thd, &str, part_info->part_field_list);
- }
- else
- err+= str.append(STRING_WITH_LEN("HASH "));
- break;
- case VERSIONING_PARTITION:
- err+= str.append(STRING_WITH_LEN("SYSTEM_TIME "));
- break;
- default:
- DBUG_ASSERT(0);
- /* We really shouldn't get here, no use in continuing from here */
- my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATAL));
- DBUG_RETURN(NULL);
- }
+ int err2= part_info->gen_part_type(thd, &str);
+ if (err2 < 0)
+ DBUG_RETURN(NULL);
+ err+= err2;
if (part_info->part_type == VERSIONING_PARTITION)
{
Vers_part_info *vers_info= part_info->vers_info;
@@ -4714,8 +4754,6 @@ bool compare_partition_options(HA_CREATE_INFO *table_create_info,
Note that there are not yet any engine supporting tablespace together
with partitioning. TODO: when there are, add compare.
*/
- if (part_elem->tablespace_name || table_create_info->tablespace)
- option_diffs[errors++]= "TABLESPACE";
if (part_elem->part_max_rows != table_create_info->max_rows)
option_diffs[errors++]= "MAX_ROWS";
if (part_elem->part_min_rows != table_create_info->min_rows)
@@ -4877,10 +4915,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
if (alter_info->partition_flags &
(ALTER_PARTITION_ADD |
ALTER_PARTITION_DROP |
+ ALTER_PARTITION_CONVERT_OUT |
ALTER_PARTITION_COALESCE |
ALTER_PARTITION_REORGANIZE |
ALTER_PARTITION_TABLE_REORG |
- ALTER_PARTITION_REBUILD))
+ ALTER_PARTITION_REBUILD |
+ ALTER_PARTITION_CONVERT_IN))
{
/*
You can't add column when we are doing alter related to partition
@@ -5017,6 +5057,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
if ((alter_info->partition_flags & ALTER_PARTITION_ADD) ||
(alter_info->partition_flags & ALTER_PARTITION_REORGANIZE))
{
+ if ((alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN) &&
+ !(tab_part_info->part_type == RANGE_PARTITION ||
+ tab_part_info->part_type == LIST_PARTITION))
+ {
+ my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "CONVERT TABLE TO");
+ goto err;
+ }
if (thd->work_part_info->part_type != tab_part_info->part_type)
{
if (thd->work_part_info->part_type == NOT_A_PARTITION)
@@ -5052,7 +5099,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
else if (thd->work_part_info->part_type == VERSIONING_PARTITION ||
tab_part_info->part_type == VERSIONING_PARTITION)
{
- my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
+ part_type_error(thd, thd->work_part_info, NULL, tab_part_info);
}
else
{
@@ -5372,8 +5419,12 @@ that are reorganised.
tab_part_info->is_auto_partitioned= FALSE;
}
}
- else if (alter_info->partition_flags & ALTER_PARTITION_DROP)
+ else if ((alter_info->partition_flags & ALTER_PARTITION_DROP) |
+ (alter_info->partition_flags & ALTER_PARTITION_CONVERT_OUT))
{
+ const char * const cmd=
+ (alter_info->partition_flags & ALTER_PARTITION_CONVERT_OUT) ?
+ "CONVERT" : "DROP";
/*
Drop a partition from a range partition and list partitioning is
always safe and can be made more or less immediate. It is necessary
@@ -5402,7 +5453,7 @@ that are reorganised.
if (!(tab_part_info->part_type == RANGE_PARTITION ||
tab_part_info->part_type == LIST_PARTITION))
{
- my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "DROP");
+ my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), cmd);
goto err;
}
if (num_parts_dropped >= tab_part_info->num_parts)
@@ -5444,7 +5495,7 @@ that are reorganised.
} while (++part_count < tab_part_info->num_parts);
if (num_parts_found != num_parts_dropped)
{
- my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "DROP");
+ my_error(ER_PARTITION_DOES_NOT_EXIST, MYF(0));
goto err;
}
if (table->file->is_fk_defined_on_table_or_index(MAX_KEY))
@@ -5452,6 +5503,17 @@ that are reorganised.
my_error(ER_ROW_IS_REFERENCED, MYF(0));
goto err;
}
+ DBUG_ASSERT(!(alter_info->partition_flags & ALTER_PARTITION_CONVERT_OUT) ||
+ num_parts_dropped == 1);
+ /* NOTE: num_parts is used in generate_partition_syntax() */
+ tab_part_info->num_parts-= num_parts_dropped;
+ if ((alter_info->partition_flags & ALTER_PARTITION_CONVERT_OUT) &&
+ tab_part_info->is_sub_partitioned())
+ {
+ // TODO technically this can be converted to a *partitioned* table
+ my_error(ER_PARTITION_CONVERT_SUBPARTITIONED, MYF(0));
+ goto err;
+ }
}
else if (alter_info->partition_flags & ALTER_PARTITION_REBUILD)
{
@@ -5459,7 +5521,7 @@ that are reorganised.
tab_part_info->default_engine_type);
if (set_part_state(alter_info, tab_part_info, PART_CHANGED))
{
- my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD");
+ my_error(ER_PARTITION_DOES_NOT_EXIST, MYF(0));
goto err;
}
if (!(*fast_alter_table))
@@ -5735,7 +5797,7 @@ the generated partition syntax in a correct manner.
} while (++part_count < tab_part_info->num_parts);
if (drop_count != num_parts_reorged)
{
- my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REORGANIZE");
+ my_error(ER_PARTITION_DOES_NOT_EXIST, MYF(0));
goto err;
}
tab_part_info->num_parts= check_total_partitions;
@@ -5795,7 +5857,7 @@ the generated partition syntax in a correct manner.
goto err;
}
}
- } // ADD, DROP, COALESCE, REORGANIZE, TABLE_REORG, REBUILD
+ } // ADD, DROP, COALESCE, REORGANIZE, TABLE_REORG, REBUILD, CONVERT
else
{
/*
@@ -6136,19 +6198,64 @@ static bool mysql_drop_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
/*
- Insert log entry into list
+ Convert partition to a table in an ALTER TABLE of partitions
+
SYNOPSIS
- insert_part_info_log_entry_list()
- log_entry
+ alter_partition_convert_out()
+ lpt Struct containing parameters
+
RETURN VALUES
- NONE
+ TRUE Failure
+ FALSE Success
+
+ DESCRIPTION
+ Rename partition table marked with PART_TO_BE_DROPPED into a separate table
+ under the name lpt->alter_ctx->(new_db, new_name).
+
+ This is ddl-logged by write_log_convert_out_partition().
*/
-static void insert_part_info_log_entry_list(partition_info *part_info,
- DDL_LOG_MEMORY_ENTRY *log_entry)
+static bool alter_partition_convert_out(ALTER_PARTITION_PARAM_TYPE *lpt)
{
- log_entry->next_active_log_entry= part_info->first_log_entry;
- part_info->first_log_entry= log_entry;
+ partition_info *part_info= lpt->table->part_info;
+ THD *thd= lpt->thd;
+ int error;
+ handler *file= get_new_handler(NULL, thd->mem_root, part_info->default_engine_type);
+
+ DBUG_ASSERT(lpt->thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ lpt->table->s->db.str,
+ lpt->table->s->table_name.str,
+ MDL_EXCLUSIVE));
+
+ char from_name[FN_REFLEN + 1], to_name[FN_REFLEN + 1];
+ const char *path= lpt->table->s->path.str;
+
+ build_table_filename(to_name, sizeof(to_name) - 1, lpt->alter_ctx->new_db.str,
+ lpt->alter_ctx->new_name.str, "", 0);
+
+ for (const partition_element &e: part_info->partitions)
+ {
+ if (e.part_state != PART_TO_BE_DROPPED)
+ continue;
+
+ if (unlikely((error= create_partition_name(from_name, sizeof(from_name),
+ path, e.partition_name,
+ NORMAL_PART_NAME, FALSE))))
+ {
+ DBUG_ASSERT(thd->is_error());
+ return true;
+ }
+ if (DBUG_IF("error_convert_partition_00") ||
+ unlikely(error= file->ha_rename_table(from_name, to_name)))
+ {
+ my_error(ER_ERROR_ON_RENAME, MYF(0), from_name, to_name, my_errno);
+ lpt->table->file->print_error(error, MYF(0));
+ return true;
+ }
+ break;
+ }
+
+ return false;
}
@@ -6176,50 +6283,44 @@ static void release_part_info_log_entries(DDL_LOG_MEMORY_ENTRY *log_entry)
/*
- Log an delete/rename frm file
+ Log an rename frm file
SYNOPSIS
- write_log_replace_delete_frm()
+ write_log_replace_frm()
lpt Struct for parameters
next_entry Next reference to use in log record
from_path Name to rename from
to_path Name to rename to
- replace_flag TRUE if replace, else delete
RETURN VALUES
TRUE Error
FALSE Success
DESCRIPTION
- Support routine that writes a replace or delete of an frm file into the
+ Support routine that writes a replace of an frm file into the
ddl log. It also inserts an entry that keeps track of used space into
the partition info object
*/
-static bool write_log_replace_delete_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
- uint next_entry,
- const char *from_path,
- const char *to_path,
- bool replace_flag)
+bool write_log_replace_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
+ uint next_entry,
+ const char *from_path,
+ const char *to_path)
{
DDL_LOG_ENTRY ddl_log_entry;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DBUG_ENTER("write_log_replace_delete_frm");
+ DBUG_ENTER("write_log_replace_frm");
bzero(&ddl_log_entry, sizeof(ddl_log_entry));
- if (replace_flag)
- ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
- else
- ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
+ ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
ddl_log_entry.next_entry= next_entry;
lex_string_set(&ddl_log_entry.handler_name, reg_ext);
lex_string_set(&ddl_log_entry.name, to_path);
+ lex_string_set(&ddl_log_entry.from_name, from_path);
- if (replace_flag)
- lex_string_set(&ddl_log_entry.from_name, from_path);
if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
- insert_part_info_log_entry_list(lpt->part_info, log_entry);
- DBUG_RETURN(FALSE);
+ ddl_log_add_entry(lpt->part_info, log_entry);
+ DBUG_RETURN(false);
}
@@ -6298,7 +6399,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
*next_entry= log_entry->entry_pos;
sub_elem->log_entry= log_entry;
- insert_part_info_log_entry_list(part_info, log_entry);
+ ddl_log_add_entry(part_info, log_entry);
} while (++j < num_subparts);
}
else
@@ -6325,7 +6426,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
}
*next_entry= log_entry->entry_pos;
part_elem->log_entry= log_entry;
- insert_part_info_log_entry_list(part_info, log_entry);
+ ddl_log_add_entry(part_info, log_entry);
}
}
} while (++i < num_elements);
@@ -6334,21 +6435,29 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
/*
- Log dropped partitions
+ Log dropped or converted partitions
SYNOPSIS
- write_log_dropped_partitions()
+ log_drop_or_convert_action()
lpt Struct containing parameters
RETURN VALUES
TRUE Error
FALSE Success
*/
-static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
- uint *next_entry,
- const char *path,
- bool temp_list)
+enum log_action_enum
+{
+ ACT_DROP = 0,
+ ACT_CONVERT_IN,
+ ACT_CONVERT_OUT
+};
+
+static bool log_drop_or_convert_action(ALTER_PARTITION_PARAM_TYPE *lpt,
+ uint *next_entry, const char *path,
+ const char *from_name, bool temp_list,
+ const log_action_enum convert_action)
{
DDL_LOG_ENTRY ddl_log_entry;
+ DBUG_ASSERT(convert_action == ACT_DROP || (from_name != NULL));
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
char tmp_path[FN_REFLEN + 1];
@@ -6356,10 +6465,13 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
List_iterator<partition_element> temp_it(part_info->temp_partitions);
uint num_temp_partitions= part_info->temp_partitions.elements;
uint num_elements= part_info->partitions.elements;
- DBUG_ENTER("write_log_dropped_partitions");
+ DBUG_ENTER("log_drop_or_convert_action");
bzero(&ddl_log_entry, sizeof(ddl_log_entry));
- ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
+
+ ddl_log_entry.action_type= convert_action ?
+ DDL_LOG_RENAME_ACTION :
+ DDL_LOG_DELETE_ACTION;
if (temp_list)
num_elements= num_temp_partitions;
while (num_elements--)
@@ -6380,8 +6492,13 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
name_variant= TEMP_PART_NAME;
else
name_variant= NORMAL_PART_NAME;
+ DBUG_ASSERT(convert_action != ACT_CONVERT_IN ||
+ part_elem->part_state == PART_TO_BE_ADDED);
+ DBUG_ASSERT(convert_action != ACT_CONVERT_OUT ||
+ part_elem->part_state == PART_TO_BE_DROPPED);
if (part_info->is_sub_partitioned())
{
+ DBUG_ASSERT(!convert_action);
List_iterator<partition_element> sub_it(part_elem->subpartitions);
uint num_subparts= part_info->num_subparts;
uint j= 0;
@@ -6403,7 +6520,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
}
*next_entry= log_entry->entry_pos;
sub_elem->log_entry= log_entry;
- insert_part_info_log_entry_list(part_info, log_entry);
+ ddl_log_add_entry(part_info, log_entry);
} while (++j < num_subparts);
}
else
@@ -6415,14 +6532,25 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
part_elem->partition_name, name_variant,
TRUE))
DBUG_RETURN(TRUE);
- lex_string_set(&ddl_log_entry.name, tmp_path);
+ switch (convert_action)
+ {
+ case ACT_CONVERT_OUT:
+ ddl_log_entry.from_name= { from_name, strlen(from_name) };
+ /* fall through */
+ case ACT_DROP:
+ ddl_log_entry.name= { tmp_path, strlen(tmp_path) };
+ break;
+ case ACT_CONVERT_IN:
+ ddl_log_entry.name= { from_name, strlen(from_name) };
+ ddl_log_entry.from_name= { tmp_path, strlen(tmp_path) };
+ }
if (ddl_log_write_entry(&ddl_log_entry, &log_entry))
{
DBUG_RETURN(TRUE);
}
*next_entry= log_entry->entry_pos;
part_elem->log_entry= log_entry;
- insert_part_info_log_entry_list(part_info, log_entry);
+ ddl_log_add_entry(part_info, log_entry);
}
}
}
@@ -6430,21 +6558,37 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
}
-/*
- Set execute log entry in ddl log for this partitioned table
- SYNOPSIS
- set_part_info_exec_log_entry()
- part_info Partition info object
- exec_log_entry Log entry
- RETURN VALUES
- NONE
-*/
-
-static void set_part_info_exec_log_entry(partition_info *part_info,
- DDL_LOG_MEMORY_ENTRY *exec_log_entry)
+inline
+static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
+ uint *next_entry, const char *path,
+ bool temp_list)
{
- part_info->exec_log_entry= exec_log_entry;
- exec_log_entry->next_active_log_entry= NULL;
+ return log_drop_or_convert_action(lpt, next_entry, path, NULL, temp_list,
+ ACT_DROP);
+}
+
+inline
+static bool write_log_convert_partition(ALTER_PARTITION_PARAM_TYPE *lpt,
+ uint *next_entry, const char *path)
+{
+ char other_table[FN_REFLEN + 1];
+ const ulong f= lpt->alter_info->partition_flags;
+ DBUG_ASSERT((f & ALTER_PARTITION_CONVERT_IN) || (f & ALTER_PARTITION_CONVERT_OUT));
+ const log_action_enum convert_action= (f & ALTER_PARTITION_CONVERT_IN)
+ ? ACT_CONVERT_IN : ACT_CONVERT_OUT;
+ build_table_filename(other_table, sizeof(other_table) - 1, lpt->alter_ctx->new_db.str,
+ lpt->alter_ctx->new_name.str, "", 0);
+ DDL_LOG_MEMORY_ENTRY *main_entry= lpt->part_info->main_entry;
+ bool res= log_drop_or_convert_action(lpt, next_entry, path, other_table,
+ false, convert_action);
+ /*
+ NOTE: main_entry is "drop shadow frm", we have to keep it like this
+ because partitioning crash-safety disables it at install shadow FRM phase.
+ This is needed to avoid spurious drop action when the shadow frm is replaced
+ by the backup frm and there is nothing to drop.
+ */
+ lpt->part_info->main_entry= main_entry;
+ return res;
}
@@ -6452,10 +6596,9 @@ static void set_part_info_exec_log_entry(partition_info *part_info,
Write the log entry to ensure that the shadow frm file is removed at
crash.
SYNOPSIS
- write_log_drop_shadow_frm()
+ write_log_drop_frm()
lpt Struct containing parameters
- install_frm Should we log action to install shadow frm or should
- the action be to remove the shadow frm file.
+
RETURN VALUES
TRUE Error
FALSE Success
@@ -6464,36 +6607,53 @@ static void set_part_info_exec_log_entry(partition_info *part_info,
file and its corresponding handler file.
*/
-static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
+static bool write_log_drop_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
+ DDL_LOG_STATE *drop_chain)
{
- partition_info *part_info= lpt->part_info;
- DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
- char shadow_path[FN_REFLEN + 1];
- DBUG_ENTER("write_log_drop_shadow_frm");
+ char path[FN_REFLEN + 1];
+ DBUG_ENTER("write_log_drop_frm");
+ const DDL_LOG_STATE *main_chain= lpt->part_info;
+ const bool drop_backup= (drop_chain != main_chain);
- build_table_shadow_filename(shadow_path, sizeof(shadow_path) - 1, lpt);
+ build_table_shadow_filename(path, sizeof(path) - 1, lpt, drop_backup);
mysql_mutex_lock(&LOCK_gdl);
- if (write_log_replace_delete_frm(lpt, 0UL, NULL,
- (const char*)shadow_path, FALSE))
+ if (ddl_log_delete_frm(drop_chain, (const char*)path))
goto error;
- log_entry= part_info->first_log_entry;
- if (ddl_log_write_execute_entry(log_entry->entry_pos,
- &exec_log_entry))
+
+ if (drop_backup && (lpt->alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN))
+ {
+ TABLE_LIST *table_from= lpt->table_list->next_local;
+ build_table_filename(path, sizeof(path) - 1, table_from->db.str,
+ table_from->table_name.str, "", 0);
+
+ if (ddl_log_delete_frm(drop_chain, (const char*) path))
+ goto error;
+ }
+
+ if (ddl_log_write_execute_entry(drop_chain->list->entry_pos,
+ drop_backup ?
+ main_chain->execute_entry->entry_pos : 0,
+ &drop_chain->execute_entry))
goto error;
mysql_mutex_unlock(&LOCK_gdl);
- set_part_info_exec_log_entry(part_info, exec_log_entry);
DBUG_RETURN(FALSE);
error:
- release_part_info_log_entries(part_info->first_log_entry);
+ release_part_info_log_entries(drop_chain->list);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= NULL;
+ drop_chain->list= NULL;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
+static inline
+bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
+{
+ return write_log_drop_frm(lpt, lpt->part_info);
+}
+
+
/*
Log renaming of shadow frm to real frm name and dropping of old frm
SYNOPSIS
@@ -6511,20 +6671,20 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
{
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
+ DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->execute_entry;
char path[FN_REFLEN + 1];
char shadow_path[FN_REFLEN + 1];
- DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+ DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->list;
DBUG_ENTER("write_log_rename_frm");
- part_info->first_log_entry= NULL;
+ part_info->list= NULL;
build_table_filename(path, sizeof(path) - 1, lpt->db.str, lpt->table_name.str, "", 0);
build_table_shadow_filename(shadow_path, sizeof(shadow_path) - 1, lpt);
mysql_mutex_lock(&LOCK_gdl);
- if (write_log_replace_delete_frm(lpt, 0UL, shadow_path, path, TRUE))
+ if (write_log_replace_frm(lpt, 0UL, shadow_path, path))
goto error;
- log_entry= part_info->first_log_entry;
- part_info->frm_log_entry= log_entry;
+ log_entry= part_info->list;
+ part_info->main_entry= log_entry;
if (ddl_log_write_execute_entry(log_entry->entry_pos,
&exec_log_entry))
goto error;
@@ -6533,10 +6693,10 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_RETURN(FALSE);
error:
- release_part_info_log_entries(part_info->first_log_entry);
+ release_part_info_log_entries(part_info->list);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= old_first_log_entry;
- part_info->frm_log_entry= NULL;
+ part_info->list= old_first_log_entry;
+ part_info->main_entry= NULL;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
@@ -6561,25 +6721,25 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
+ DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->execute_entry;
char tmp_path[FN_REFLEN + 1];
char path[FN_REFLEN + 1];
uint next_entry= 0;
- DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+ DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->list;
DBUG_ENTER("write_log_drop_partition");
- part_info->first_log_entry= NULL;
+ part_info->list= NULL;
build_table_filename(path, sizeof(path) - 1, lpt->db.str, lpt->table_name.str, "", 0);
build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
mysql_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
goto error;
- if (write_log_replace_delete_frm(lpt, next_entry, (const char*)tmp_path,
- (const char*)path, TRUE))
+ if (write_log_replace_frm(lpt, next_entry, (const char*)tmp_path,
+ (const char*)path))
goto error;
- log_entry= part_info->first_log_entry;
- part_info->frm_log_entry= log_entry;
+ log_entry= part_info->list;
+ part_info->main_entry= log_entry;
if (ddl_log_write_execute_entry(log_entry->entry_pos,
&exec_log_entry))
goto error;
@@ -6588,15 +6748,44 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_RETURN(FALSE);
error:
- release_part_info_log_entries(part_info->first_log_entry);
+ release_part_info_log_entries(part_info->list);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= old_first_log_entry;
- part_info->frm_log_entry= NULL;
+ part_info->list= old_first_log_entry;
+ part_info->main_entry= NULL;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
+static bool write_log_convert_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
+{
+ partition_info *part_info= lpt->part_info;
+ char tmp_path[FN_REFLEN + 1];
+ char path[FN_REFLEN + 1];
+ uint next_entry= part_info->list ? part_info->list->entry_pos : 0;
+
+ build_table_filename(path, sizeof(path) - 1, lpt->db.str, lpt->table_name.str, "", 0);
+ build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
+
+ mysql_mutex_lock(&LOCK_gdl);
+
+ if (write_log_convert_partition(lpt, &next_entry, (const char*)path))
+ goto error;
+ DBUG_ASSERT(next_entry == part_info->list->entry_pos);
+ if (ddl_log_write_execute_entry(part_info->list->entry_pos,
+ &part_info->execute_entry))
+ goto error;
+ mysql_mutex_unlock(&LOCK_gdl);
+ return false;
+
+error:
+ mysql_mutex_unlock(&LOCK_gdl);
+ part_info->main_entry= NULL;
+ my_error(ER_DDL_LOG_ERROR, MYF(0));
+ return true;
+}
+
+
/*
Write the log entries to ensure that the add partition command is not
executed at all if a crash before it has completed
@@ -6618,11 +6807,10 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char tmp_path[FN_REFLEN + 1];
char path[FN_REFLEN + 1];
uint next_entry= 0;
- DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+ DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->list;
/* write_log_drop_shadow_frm(lpt) must have been run first */
DBUG_ASSERT(old_first_log_entry);
DBUG_ENTER("write_log_add_change_partition");
@@ -6637,20 +6825,18 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
goto error;
- log_entry= part_info->first_log_entry;
+ log_entry= part_info->list;
if (ddl_log_write_execute_entry(log_entry->entry_pos,
- /* Reuse the old execute ddl_log_entry */
- &exec_log_entry))
+ &part_info->execute_entry))
goto error;
mysql_mutex_unlock(&LOCK_gdl);
- set_part_info_exec_log_entry(part_info, exec_log_entry);
DBUG_RETURN(FALSE);
error:
- release_part_info_log_entries(part_info->first_log_entry);
+ release_part_info_log_entries(part_info->list);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= old_first_log_entry;
+ part_info->list= old_first_log_entry;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
@@ -6682,10 +6868,10 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
- DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
+ DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->execute_entry;
char path[FN_REFLEN + 1];
char shadow_path[FN_REFLEN + 1];
- DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+ DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->list;
uint next_entry= 0;
DBUG_ENTER("write_log_final_change_partition");
@@ -6693,7 +6879,7 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
Do not link any previous log entry.
Replace the revert operations with forced retry operations.
*/
- part_info->first_log_entry= NULL;
+ part_info->list= NULL;
build_table_filename(path, sizeof(path) - 1, lpt->db.str, lpt->table_name.str, "", 0);
build_table_shadow_filename(shadow_path, sizeof(shadow_path) - 1, lpt);
mysql_mutex_lock(&LOCK_gdl);
@@ -6703,10 +6889,10 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
lpt->alter_info->partition_flags &
ALTER_PARTITION_REORGANIZE))
goto error;
- if (write_log_replace_delete_frm(lpt, next_entry, shadow_path, path, TRUE))
+ if (write_log_replace_frm(lpt, next_entry, shadow_path, path))
goto error;
- log_entry= part_info->first_log_entry;
- part_info->frm_log_entry= log_entry;
+ log_entry= part_info->list;
+ part_info->main_entry= log_entry;
/* Overwrite the revert execute log entry with this retry execute entry */
if (ddl_log_write_execute_entry(log_entry->entry_pos,
&exec_log_entry))
@@ -6716,10 +6902,10 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_RETURN(FALSE);
error:
- release_part_info_log_entries(part_info->first_log_entry);
+ release_part_info_log_entries(part_info->list);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= old_first_log_entry;
- part_info->frm_log_entry= NULL;
+ part_info->list= old_first_log_entry;
+ part_info->main_entry= NULL;
my_error(ER_DDL_LOG_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
@@ -6736,11 +6922,15 @@ error:
FALSE Success
*/
+/*
+ TODO: Partitioning atomic DDL refactoring: this should be replaced with
+ ddl_log_complete().
+*/
static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt,
bool dont_crash)
{
partition_info *part_info= lpt->part_info;
- DDL_LOG_MEMORY_ENTRY *log_entry= part_info->exec_log_entry;
+ DDL_LOG_MEMORY_ENTRY *log_entry= part_info->execute_entry;
DBUG_ENTER("write_log_completed");
DBUG_ASSERT(log_entry);
@@ -6756,11 +6946,11 @@ static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt,
*/
;
}
- release_part_info_log_entries(part_info->first_log_entry);
- release_part_info_log_entries(part_info->exec_log_entry);
+ release_part_info_log_entries(part_info->list);
+ release_part_info_log_entries(part_info->execute_entry);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->exec_log_entry= NULL;
- part_info->first_log_entry= NULL;
+ part_info->execute_entry= NULL;
+ part_info->list= NULL;
DBUG_VOID_RETURN;
}
@@ -6774,14 +6964,18 @@ static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt,
NONE
*/
+/*
+ TODO: Partitioning atomic DDL refactoring: this should be replaced with
+ ddl_log_release_entries().
+*/
static void release_log_entries(partition_info *part_info)
{
mysql_mutex_lock(&LOCK_gdl);
- release_part_info_log_entries(part_info->first_log_entry);
- release_part_info_log_entries(part_info->exec_log_entry);
+ release_part_info_log_entries(part_info->list);
+ release_part_info_log_entries(part_info->execute_entry);
mysql_mutex_unlock(&LOCK_gdl);
- part_info->first_log_entry= NULL;
- part_info->exec_log_entry= NULL;
+ part_info->list= NULL;
+ part_info->execute_entry= NULL;
}
@@ -6864,10 +7058,15 @@ static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
@param close_table Table is still open, close it before reverting
*/
+/*
+ TODO: Partitioning atomic DDL refactoring: this should be replaced with
+ correct combination of ddl_log_revert() / ddl_log_complete()
+*/
static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
bool action_completed,
bool drop_partition,
- bool frm_install)
+ bool frm_install,
+ bool reopen)
{
THD *thd= lpt->thd;
partition_info *part_info= lpt->part_info->get_clone(thd);
@@ -6911,8 +7110,11 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
}
- if (part_info->first_log_entry &&
- ddl_log_execute_entry(thd, part_info->first_log_entry->entry_pos))
+ if (!reopen)
+ DBUG_VOID_RETURN;
+
+ if (part_info->list &&
+ ddl_log_execute_entry(thd, part_info->list->entry_pos))
{
/*
We couldn't recover from error, most likely manual interaction
@@ -7074,6 +7276,64 @@ bool log_partition_alter_to_ddl_log(ALTER_PARTITION_PARAM_TYPE *lpt)
}
+extern bool alter_partition_convert_in(ALTER_PARTITION_PARAM_TYPE *lpt);
+
+/**
+ Check that definition of source table fits definition of partition being
+ added and every row stored in the table conforms partition's expression.
+
+ @param lpt Structure containing parameters required for checking
+ @param[in,out] part_file_name_buf Buffer for storing a partition name
+ @param part_file_name_buf_sz Size of buffer for storing a partition name
+ @param part_file_name_len Length of partition prefix stored in the buffer
+ on invocation of function
+
+ @return false on success, true on error
+*/
+
+static bool check_table_data(ALTER_PARTITION_PARAM_TYPE *lpt)
+{
+ /*
+ TODO: if destination is partitioned by range(X) and source is indexed by X
+ then just get min(X) and max(X) from index.
+ */
+ THD *thd= lpt->thd;
+ TABLE *table_to= lpt->table_list->table;
+ TABLE *table_from= lpt->table_list->next_local->table;
+
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ table_to->s->db.str,
+ table_to->s->table_name.str,
+ MDL_EXCLUSIVE));
+
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ table_from->s->db.str,
+ table_from->s->table_name.str,
+ MDL_EXCLUSIVE));
+
+ uint32 new_part_id;
+ partition_element *part_elem;
+ const char* partition_name= thd->lex->part_info->curr_part_elem->partition_name;
+ part_elem= table_to->part_info->get_part_elem(partition_name,
+ nullptr, 0, &new_part_id);
+ if (unlikely(!part_elem))
+ return true;
+
+ if (unlikely(new_part_id == NOT_A_PARTITION_ID))
+ {
+ DBUG_ASSERT(table_to->part_info->is_sub_partitioned());
+ my_error(ER_PARTITION_INSTEAD_OF_SUBPARTITION, MYF(0));
+ return true;
+ }
+
+ if (verify_data_with_partition(table_from, table_to, new_part_id))
+ {
+ return true;
+ }
+
+ return false;
+}
+
/**
Actually perform the change requested by ALTER TABLE of partitions
@@ -7098,11 +7358,23 @@ bool log_partition_alter_to_ddl_log(ALTER_PARTITION_PARAM_TYPE *lpt)
uint fast_alter_partition_table(THD *thd, TABLE *table,
Alter_info *alter_info,
+ Alter_table_ctx *alter_ctx,
HA_CREATE_INFO *create_info,
- TABLE_LIST *table_list,
- const LEX_CSTRING *db,
- const LEX_CSTRING *table_name)
+ TABLE_LIST *table_list)
{
+ /*
+ TODO: Partitioning atomic DDL refactoring.
+
+ DDL log chain state is stored in partition_info:
+
+ struct st_ddl_log_memory_entry *first_log_entry;
+ struct st_ddl_log_memory_entry *exec_log_entry;
+ struct st_ddl_log_memory_entry *frm_log_entry;
+
+ Make it stored and used in DDL_LOG_STATE like it was done in MDEV-17567.
+ This requires mysql_write_frm() refactoring (see comment there).
+ */
+
/* Set-up struct used to write frm files */
partition_info *part_info;
ALTER_PARTITION_PARAM_TYPE lpt_obj;
@@ -7120,13 +7392,14 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->table_list= table_list;
lpt->part_info= part_info;
lpt->alter_info= alter_info;
+ lpt->alter_ctx= alter_ctx;
lpt->create_info= create_info;
lpt->db_options= create_info->table_options_with_row_type();
lpt->table= table;
lpt->key_info_buffer= 0;
lpt->key_count= 0;
- lpt->db= *db;
- lpt->table_name= *table_name;
+ lpt->db= alter_ctx->db;
+ lpt->table_name= alter_ctx->table_name;
lpt->org_tabledef_version= table->s->tabledef_version;
lpt->copied= 0;
lpt->deleted= 0;
@@ -7246,49 +7519,138 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
to test if recovery is properly done.
*/
if (write_log_drop_shadow_frm(lpt) ||
- ERROR_INJECT_CRASH("crash_drop_partition_1") ||
- ERROR_INJECT_ERROR("fail_drop_partition_1") ||
+ ERROR_INJECT("drop_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
- ERROR_INJECT_CRASH("crash_drop_partition_2") ||
- ERROR_INJECT_ERROR("fail_drop_partition_2") ||
+ ERROR_INJECT("drop_partition_2") ||
wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
- ERROR_INJECT_CRASH("crash_drop_partition_3") ||
- ERROR_INJECT_ERROR("fail_drop_partition_3") ||
+ ERROR_INJECT("drop_partition_3") ||
write_log_drop_partition(lpt) ||
(action_completed= TRUE, FALSE) ||
- ERROR_INJECT_CRASH("crash_drop_partition_4") ||
- ERROR_INJECT_ERROR("fail_drop_partition_4") ||
+ ERROR_INJECT("drop_partition_4") ||
alter_close_table(lpt) ||
- ERROR_INJECT_CRASH("crash_drop_partition_5") ||
- ERROR_INJECT_ERROR("fail_drop_partition_5") ||
- ERROR_INJECT_CRASH("crash_drop_partition_6") ||
- ERROR_INJECT_ERROR("fail_drop_partition_6") ||
+ ERROR_INJECT("drop_partition_5") ||
+ ERROR_INJECT("drop_partition_6") ||
(frm_install= TRUE, FALSE) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
log_partition_alter_to_ddl_log(lpt) ||
(frm_install= FALSE, FALSE) ||
- ERROR_INJECT_CRASH("crash_drop_partition_7") ||
- ERROR_INJECT_ERROR("fail_drop_partition_7") ||
+ ERROR_INJECT("drop_partition_7") ||
mysql_drop_partitions(lpt) ||
- ERROR_INJECT_CRASH("crash_drop_partition_8") ||
- ERROR_INJECT_ERROR("fail_drop_partition_8") ||
+ ERROR_INJECT("drop_partition_8") ||
(write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
- ERROR_INJECT_CRASH("crash_drop_partition_9") ||
- ERROR_INJECT_ERROR("fail_drop_partition_9"))
+ ERROR_INJECT("drop_partition_9"))
{
- handle_alter_part_error(lpt, action_completed, TRUE, frm_install);
+ handle_alter_part_error(lpt, action_completed, TRUE, frm_install, true);
goto err;
}
if (alter_partition_lock_handling(lpt))
goto err;
}
+ else if (alter_info->partition_flags & ALTER_PARTITION_CONVERT_OUT)
+ {
+ DDL_LOG_STATE chain_drop_backup;
+ bzero(&chain_drop_backup, sizeof(chain_drop_backup));
+
+ if (mysql_write_frm(lpt, WFRM_WRITE_CONVERTED_TO) ||
+ ERROR_INJECT("convert_partition_1") ||
+ write_log_drop_shadow_frm(lpt) ||
+ ERROR_INJECT("convert_partition_2") ||
+ mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
+ ERROR_INJECT("convert_partition_3") ||
+ wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
+ ERROR_INJECT("convert_partition_4") ||
+ write_log_convert_partition(lpt) ||
+ ERROR_INJECT("convert_partition_5") ||
+ alter_close_table(lpt) ||
+ ERROR_INJECT("convert_partition_6") ||
+ alter_partition_convert_out(lpt) ||
+ ERROR_INJECT("convert_partition_7") ||
+ write_log_drop_frm(lpt, &chain_drop_backup) ||
+ mysql_write_frm(lpt, WFRM_INSTALL_SHADOW|WFRM_BACKUP_ORIGINAL) ||
+ log_partition_alter_to_ddl_log(lpt) ||
+ ERROR_INJECT("convert_partition_8") ||
+ ((!thd->lex->no_write_to_binlog) &&
+ ((thd->binlog_xid= thd->query_id),
+ ddl_log_update_xid(lpt->part_info, thd->binlog_xid),
+ write_bin_log(thd, false, thd->query(), thd->query_length()),
+ (thd->binlog_xid= 0))) ||
+ ERROR_INJECT("convert_partition_9"))
+ {
+ DDL_LOG_STATE main_state= *lpt->part_info;
+ handle_alter_part_error(lpt, true, true, false, false);
+ ddl_log_complete(&chain_drop_backup);
+ (void) ddl_log_revert(thd, &main_state);
+ if (thd->locked_tables_mode)
+ thd->locked_tables_list.reopen_tables(thd, false);
+ goto err;
+ }
+ ddl_log_complete(lpt->part_info);
+ ERROR_INJECT("convert_partition_10");
+ (void) ddl_log_revert(thd, &chain_drop_backup);
+ if (alter_partition_lock_handling(lpt) ||
+ ERROR_INJECT("convert_partition_11"))
+ goto err;
+ }
+ else if ((alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN))
+ {
+ DDL_LOG_STATE chain_drop_backup;
+ bzero(&chain_drop_backup, sizeof(chain_drop_backup));
+ TABLE *table_from= table_list->next_local->table;
+
+ if (wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
+ wait_while_table_is_used(thd, table_from, HA_EXTRA_PREPARE_FOR_RENAME) ||
+ ERROR_INJECT("convert_partition_1") ||
+ compare_table_with_partition(thd, table_from, table, NULL, 0) ||
+ ERROR_INJECT("convert_partition_2") ||
+ check_table_data(lpt))
+ goto err;
+
+ if (write_log_drop_shadow_frm(lpt) ||
+ ERROR_INJECT("convert_partition_3") ||
+ mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
+ ERROR_INJECT("convert_partition_4") ||
+ alter_close_table(lpt) ||
+ ERROR_INJECT("convert_partition_5") ||
+ write_log_convert_partition(lpt) ||
+ ERROR_INJECT("convert_partition_6") ||
+ alter_partition_convert_in(lpt) ||
+ ERROR_INJECT("convert_partition_7") ||
+ (frm_install= true, false) ||
+ write_log_drop_frm(lpt, &chain_drop_backup) ||
+ mysql_write_frm(lpt, WFRM_INSTALL_SHADOW|WFRM_BACKUP_ORIGINAL) ||
+ log_partition_alter_to_ddl_log(lpt) ||
+ (frm_install= false, false) ||
+ ERROR_INJECT("convert_partition_8") ||
+ ((!thd->lex->no_write_to_binlog) &&
+ ((thd->binlog_xid= thd->query_id),
+ ddl_log_update_xid(lpt->part_info, thd->binlog_xid),
+ write_bin_log(thd, false, thd->query(), thd->query_length()),
+ (thd->binlog_xid= 0))) ||
+ ERROR_INJECT("convert_partition_9"))
+ {
+ DDL_LOG_STATE main_state= *lpt->part_info;
+ handle_alter_part_error(lpt, true, true, false, false);
+ ddl_log_complete(&chain_drop_backup);
+ (void) ddl_log_revert(thd, &main_state);
+ if (thd->locked_tables_mode)
+ thd->locked_tables_list.reopen_tables(thd, false);
+ goto err;
+ }
+ ddl_log_complete(lpt->part_info);
+ ERROR_INJECT("convert_partition_10");
+ (void) ddl_log_revert(thd, &chain_drop_backup);
+ if (alter_partition_lock_handling(lpt) ||
+ ERROR_INJECT("convert_partition_11"))
+ goto err;
+ }
else if ((alter_info->partition_flags & ALTER_PARTITION_ADD) &&
(part_info->part_type == RANGE_PARTITION ||
part_info->part_type == LIST_PARTITION))
{
+ DBUG_ASSERT(!(alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN));
/*
ADD RANGE/LIST PARTITIONS
In this case there are no tuples removed and no tuples are added.
@@ -7320,43 +7682,33 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
12)Complete query
*/
if (write_log_drop_shadow_frm(lpt) ||
- ERROR_INJECT_CRASH("crash_add_partition_1") ||
- ERROR_INJECT_ERROR("fail_add_partition_1") ||
+ ERROR_INJECT("add_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
- ERROR_INJECT_CRASH("crash_add_partition_2") ||
- ERROR_INJECT_ERROR("fail_add_partition_2") ||
+ ERROR_INJECT("add_partition_2") ||
wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
- ERROR_INJECT_CRASH("crash_add_partition_3") ||
- ERROR_INJECT_ERROR("fail_add_partition_3") ||
+ ERROR_INJECT("add_partition_3") ||
write_log_add_change_partition(lpt) ||
- ERROR_INJECT_CRASH("crash_add_partition_4") ||
- ERROR_INJECT_ERROR("fail_add_partition_4") ||
+ ERROR_INJECT("add_partition_4") ||
mysql_change_partitions(lpt) ||
- ERROR_INJECT_CRASH("crash_add_partition_5") ||
- ERROR_INJECT_ERROR("fail_add_partition_5") ||
+ ERROR_INJECT("add_partition_5") ||
alter_close_table(lpt) ||
- ERROR_INJECT_CRASH("crash_add_partition_6") ||
- ERROR_INJECT_ERROR("fail_add_partition_6") ||
- ERROR_INJECT_CRASH("crash_add_partition_7") ||
- ERROR_INJECT_ERROR("fail_add_partition_7") ||
+ ERROR_INJECT("add_partition_6") ||
+ ERROR_INJECT("add_partition_7") ||
write_log_rename_frm(lpt) ||
(action_completed= TRUE, FALSE) ||
- ERROR_INJECT_CRASH("crash_add_partition_8") ||
- ERROR_INJECT_ERROR("fail_add_partition_8") ||
+ ERROR_INJECT("add_partition_8") ||
(frm_install= TRUE, FALSE) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
log_partition_alter_to_ddl_log(lpt) ||
(frm_install= FALSE, FALSE) ||
- ERROR_INJECT_CRASH("crash_add_partition_9") ||
- ERROR_INJECT_ERROR("fail_add_partition_9") ||
+ ERROR_INJECT("add_partition_9") ||
(write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
- ERROR_INJECT_CRASH("crash_add_partition_10") ||
- ERROR_INJECT_ERROR("fail_add_partition_10"))
+ ERROR_INJECT("add_partition_10"))
{
- handle_alter_part_error(lpt, action_completed, FALSE, frm_install);
+ handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true);
goto err;
}
if (alter_partition_lock_handling(lpt))
@@ -7419,49 +7771,37 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
13) Complete query.
*/
if (write_log_drop_shadow_frm(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_1") ||
- ERROR_INJECT_ERROR("fail_change_partition_1") ||
+ ERROR_INJECT("change_partition_1") ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
- ERROR_INJECT_CRASH("crash_change_partition_2") ||
- ERROR_INJECT_ERROR("fail_change_partition_2") ||
+ ERROR_INJECT("change_partition_2") ||
write_log_add_change_partition(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_3") ||
- ERROR_INJECT_ERROR("fail_change_partition_3") ||
+ ERROR_INJECT("change_partition_3") ||
mysql_change_partitions(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_4") ||
- ERROR_INJECT_ERROR("fail_change_partition_4") ||
+ ERROR_INJECT("change_partition_4") ||
wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
- ERROR_INJECT_CRASH("crash_change_partition_5") ||
- ERROR_INJECT_ERROR("fail_change_partition_5") ||
+ ERROR_INJECT("change_partition_5") ||
alter_close_table(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_6") ||
- ERROR_INJECT_ERROR("fail_change_partition_6") ||
+ ERROR_INJECT("change_partition_6") ||
write_log_final_change_partition(lpt) ||
(action_completed= TRUE, FALSE) ||
- ERROR_INJECT_CRASH("crash_change_partition_7") ||
- ERROR_INJECT_ERROR("fail_change_partition_7") ||
- ERROR_INJECT_CRASH("crash_change_partition_8") ||
- ERROR_INJECT_ERROR("fail_change_partition_8") ||
+ ERROR_INJECT("change_partition_7") ||
+ ERROR_INJECT("change_partition_8") ||
((frm_install= TRUE), FALSE) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
log_partition_alter_to_ddl_log(lpt) ||
(frm_install= FALSE, FALSE) ||
- ERROR_INJECT_CRASH("crash_change_partition_9") ||
- ERROR_INJECT_ERROR("fail_change_partition_9") ||
+ ERROR_INJECT("change_partition_9") ||
mysql_drop_partitions(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_10") ||
- ERROR_INJECT_ERROR("fail_change_partition_10") ||
+ ERROR_INJECT("change_partition_10") ||
mysql_rename_partitions(lpt) ||
- ERROR_INJECT_CRASH("crash_change_partition_11") ||
- ERROR_INJECT_ERROR("fail_change_partition_11") ||
+ ERROR_INJECT("change_partition_11") ||
(write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
- ERROR_INJECT_CRASH("crash_change_partition_12") ||
- ERROR_INJECT_ERROR("fail_change_partition_12"))
+ ERROR_INJECT("change_partition_12"))
{
- handle_alter_part_error(lpt, action_completed, FALSE, frm_install);
+ handle_alter_part_error(lpt, action_completed, FALSE, frm_install, true);
goto err;
}
if (alter_partition_lock_handling(lpt))
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index 57e6d0600ed..a90eaae0bae 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -55,6 +55,7 @@ typedef struct st_lock_param_type
THD *thd;
HA_CREATE_INFO *create_info;
Alter_info *alter_info;
+ Alter_table_ctx *alter_ctx;
TABLE *table;
KEY *key_info_buffer;
LEX_CSTRING db;
@@ -64,6 +65,7 @@ typedef struct st_lock_param_type
uint key_count;
uint db_options;
size_t pack_frm_len;
+ // TODO: remove duplicate data: part_info can be accessed via table->part_info
partition_info *part_info;
} ALTER_PARTITION_PARAM_TYPE;
@@ -255,10 +257,9 @@ typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
#ifdef WITH_PARTITION_STORAGE_ENGINE
uint fast_alter_partition_table(THD *thd, TABLE *table,
Alter_info *alter_info,
+ Alter_table_ctx *alter_ctx,
HA_CREATE_INFO *create_info,
- TABLE_LIST *table_list,
- const LEX_CSTRING *db,
- const LEX_CSTRING *table_name);
+ TABLE_LIST *table_list);
bool set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
enum partition_state part_state);
uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
@@ -278,7 +279,16 @@ bool verify_data_with_partition(TABLE *table, TABLE *part_table,
uint32 part_id);
bool compare_partition_options(HA_CREATE_INFO *table_create_info,
partition_element *part_elem);
+bool compare_table_with_partition(THD *thd, TABLE *table,
+ TABLE *part_table,
+ partition_element *part_elem,
+ uint part_id);
bool partition_key_modified(TABLE *table, const MY_BITMAP *fields);
+bool write_log_replace_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
+ uint next_entry,
+ const char *from_path,
+ const char *to_path);
+
#else
#define partition_key_modified(X,Y) 0
#endif
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 6ca96300b7a..fcc08b69af4 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -193,10 +193,8 @@ static bool check_exchange_partition(TABLE *table, TABLE *part_table)
@param part_table Partitioned table.
@param part_elem Partition element to use for partition specific compare.
*/
-static bool compare_table_with_partition(THD *thd, TABLE *table,
- TABLE *part_table,
- partition_element *part_elem,
- uint part_id)
+bool compare_table_with_partition(THD *thd, TABLE *table, TABLE *part_table,
+ partition_element *part_elem, uint part_id)
{
HA_CREATE_INFO table_create_info, part_create_info;
Alter_info part_alter_info;
@@ -298,7 +296,7 @@ static bool compare_table_with_partition(THD *thd, TABLE *table,
The workaround is to use REORGANIZE PARTITION to rewrite
the frm file and then use EXCHANGE PARTITION when they are the same.
*/
- if (compare_partition_options(&table_create_info, part_elem))
+ if (part_elem && compare_partition_options(&table_create_info, part_elem))
DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE);
@@ -1002,4 +1000,53 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
DBUG_RETURN(error);
}
+
+/**
+ Move a table specified in the CONVERT TABLE <table_name> TO PARTITION ...
+ to the new partition.
+
+ @param lpt A structure containing parameters regarding to the statement
+ ALTER TABLE ... TO PARTITION ...
+ @param part_file_name a file name of the partition being added
+
+ @return false on success, true on error
+*/
+
+bool alter_partition_convert_in(ALTER_PARTITION_PARAM_TYPE *lpt)
+{
+ char part_file_name[2*FN_REFLEN+1];
+ THD *thd= lpt->thd;
+ const char *path= lpt->table_list->table->s->path.str;
+ TABLE_LIST *table_from= lpt->table_list->next_local;
+
+ const char *partition_name=
+ thd->lex->part_info->curr_part_elem->partition_name;
+
+ if (create_partition_name(part_file_name, sizeof(part_file_name), path,
+ partition_name, NORMAL_PART_NAME, false))
+ return true;
+
+ char from_file_name[FN_REFLEN+1];
+
+ build_table_filename(from_file_name, sizeof(from_file_name),
+ table_from->db.str, table_from->table_name.str, "", 0);
+
+ handler *file= get_new_handler(nullptr, thd->mem_root,
+ table_from->table->file->ht);
+ if (unlikely(!file))
+ return true;
+
+ close_all_tables_for_name(thd, table_from->table->s,
+ HA_EXTRA_PREPARE_FOR_RENAME, nullptr);
+
+ bool res= file->ha_rename_table(from_file_name, part_file_name);
+
+ if (res)
+ my_error(ER_ERROR_ON_RENAME, MYF(0), from_file_name,
+ part_file_name, my_errno);
+
+ delete file;
+ return res;
+}
+
#endif /* WITH_PARTITION_STORAGE_ENGINE */
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index a429732a1c1..a47fefc13f6 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -459,7 +459,7 @@ static int item_val_real(struct st_mysql_value *value, double *buf)
static struct st_plugin_dl *plugin_dl_find(const LEX_CSTRING *dl)
{
- uint i;
+ size_t i;
struct st_plugin_dl *tmp;
DBUG_ENTER("plugin_dl_find");
for (i= 0; i < plugin_dl_array.elements; i++)
@@ -476,7 +476,7 @@ static struct st_plugin_dl *plugin_dl_find(const LEX_CSTRING *dl)
static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl)
{
- uint i;
+ size_t i;
struct st_plugin_dl *tmp;
DBUG_ENTER("plugin_dl_insert_or_reuse");
for (i= 0; i < plugin_dl_array.elements; i++)
@@ -1071,6 +1071,8 @@ plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name, int type)
plugin_ref rc= NULL;
st_plugin_int *plugin;
DBUG_ENTER("plugin_lock_by_name");
+ if (!name->length)
+ DBUG_RETURN(NULL);
mysql_mutex_lock(&LOCK_plugin);
if ((plugin= plugin_find_internal(name, type)))
rc= intern_plugin_lock(lex, plugin_int_to_ref(plugin));
@@ -1081,7 +1083,7 @@ plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name, int type)
static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
{
- uint i;
+ size_t i;
struct st_plugin_int *tmp;
DBUG_ENTER("plugin_insert_or_reuse");
for (i= 0; i < plugin_array.elements; i++)
@@ -1264,24 +1266,18 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
remove_status_vars(show_vars);
}
- if (plugin_type_deinitialize[plugin->plugin->type])
- {
- if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
- {
- sql_print_error("Plugin '%s' of type %s failed deinitialization",
- plugin->name.str, plugin_type_names[plugin->plugin->type].str);
- }
- }
- else if (plugin->plugin->deinit)
+ plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type];
+ if (!deinit)
+ deinit= (plugin_type_init)(plugin->plugin->deinit);
+
+ if (deinit && deinit(plugin))
{
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(plugin))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
+ if (THD *thd= current_thd)
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
}
- plugin->state= PLUGIN_IS_UNINITIALIZED;
+ else
+ plugin->state= PLUGIN_IS_UNINITIALIZED; // free to unload
if (ref_check && plugin->ref_count)
sql_print_error("Plugin '%s' has ref_count=%d after deinitialization.",
@@ -1289,10 +1285,13 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
plugin_variables_deinit(plugin);
}
-static void plugin_del(struct st_plugin_int *plugin)
+static void plugin_del(struct st_plugin_int *plugin, uint del_mask)
{
DBUG_ENTER("plugin_del");
mysql_mutex_assert_owner(&LOCK_plugin);
+ del_mask|= PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DISABLED; // always use these
+ if (!(plugin->state & del_mask))
+ DBUG_VOID_RETURN;
/* Free allocated strings before deleting the plugin. */
plugin_vars_free_values(plugin->system_vars);
restore_ptr_backup(plugin->nbackups, plugin->ptr_backup);
@@ -1310,7 +1309,7 @@ static void plugin_del(struct st_plugin_int *plugin)
static void reap_plugins(void)
{
- uint count;
+ size_t count;
struct st_plugin_int *plugin, **reap, **list;
mysql_mutex_assert_owner(&LOCK_plugin);
@@ -1342,19 +1341,19 @@ static void reap_plugins(void)
list= reap;
while ((plugin= *(--list)))
- plugin_deinitialize(plugin, true);
+ plugin_deinitialize(plugin, true);
mysql_mutex_lock(&LOCK_plugin);
while ((plugin= *(--reap)))
- plugin_del(plugin);
+ plugin_del(plugin, 0);
my_afree(reap);
}
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
{
- int i;
+ ssize_t i;
st_plugin_int *pi;
DBUG_ENTER("intern_plugin_unlock");
@@ -1420,7 +1419,7 @@ void plugin_unlock(THD *thd, plugin_ref plugin)
}
-void plugin_unlock_list(THD *thd, plugin_ref *list, uint count)
+void plugin_unlock_list(THD *thd, plugin_ref *list, size_t count)
{
LEX *lex= thd ? thd->lex : 0;
DBUG_ENTER("plugin_unlock_list");
@@ -1593,7 +1592,7 @@ static void init_plugin_psi_keys(void) {}
*/
int plugin_init(int *argc, char **argv, int flags)
{
- uint i;
+ size_t i;
struct st_maria_plugin **builtins;
struct st_maria_plugin *plugin;
struct st_plugin_int tmp, *plugin_ptr, **reap;
@@ -1785,7 +1784,7 @@ int plugin_init(int *argc, char **argv, int flags)
reaped_mandatory_plugin= TRUE;
plugin_deinitialize(plugin_ptr, true);
mysql_mutex_lock(&LOCK_plugin);
- plugin_del(plugin_ptr);
+ plugin_del(plugin_ptr, 0);
}
mysql_mutex_unlock(&LOCK_plugin);
@@ -2024,7 +2023,7 @@ error:
void plugin_shutdown(void)
{
- uint i, count= plugin_array.elements;
+ size_t i, count= plugin_array.elements;
struct st_plugin_int **plugins, *plugin;
struct st_plugin_dl **dl;
DBUG_ENTER("plugin_shutdown");
@@ -2073,12 +2072,14 @@ void plugin_shutdown(void)
plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1));
/*
- If we have any plugins which did not die cleanly, we force shutdown
+ If we have any plugins which did not die cleanly, we force shutdown.
+ Don't re-deinit() plugins that failed deinit() earlier (already dying)
*/
for (i= 0; i < count; i++)
{
plugins[i]= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
- /* change the state to ensure no reaping races */
+ if (plugins[i]->state == PLUGIN_IS_DYING)
+ plugins[i]->state= PLUGIN_IS_UNINITIALIZED;
if (plugins[i]->state == PLUGIN_IS_DELETED)
plugins[i]->state= PLUGIN_IS_DYING;
}
@@ -2114,9 +2115,7 @@ void plugin_shutdown(void)
if (plugins[i]->ref_count)
sql_print_error("Plugin '%s' has ref_count=%d after shutdown.",
plugins[i]->name.str, plugins[i]->ref_count);
- if (plugins[i]->state & PLUGIN_IS_UNINITIALIZED ||
- plugins[i]->state & PLUGIN_IS_DISABLED)
- plugin_del(plugins[i]);
+ plugin_del(plugins[i], PLUGIN_IS_DYING);
}
/*
@@ -2355,7 +2354,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
of the delete from the plugin table, so that it is not replicated in
row based mode.
*/
- table->file->row_logging= 0; // No logging
+ table->file->row_logging= 0; // No logging
error= table->file->ha_delete_row(table->record[0]);
if (unlikely(error))
{
@@ -2468,7 +2467,7 @@ wsrep_error_label:
bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
int type, uint state_mask, void *arg)
{
- uint idx, total= 0;
+ size_t idx, total= 0;
struct st_plugin_int *plugin;
plugin_ref *plugins;
my_bool res= FALSE;
@@ -3319,7 +3318,7 @@ static void cleanup_variables(struct system_variables *vars)
void plugin_thdvar_cleanup(THD *thd)
{
- uint idx;
+ size_t idx;
plugin_ref *list;
DBUG_ENTER("plugin_thdvar_cleanup");
@@ -4304,7 +4303,7 @@ void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root)
if (!initialized)
return;
- for (uint idx= 0; idx < plugin_array.elements; idx++)
+ for (size_t idx= 0; idx < plugin_array.elements; idx++)
{
p= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
@@ -4411,7 +4410,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value)
DBUG_ASSERT(key != INVALID_THD_KEY);
if (key == INVALID_THD_KEY || (!thd && !(thd= current_thd)))
return EINVAL;
-
+
memcpy(intern_sys_var_ptr(thd, key, true), &value, sizeof(void*));
return 0;
}
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index eaf0b40f34a..d4df8c6468f 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -172,7 +172,7 @@ extern plugin_ref plugin_lock(THD *thd, plugin_ref ptr);
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name,
int type);
extern void plugin_unlock(THD *thd, plugin_ref plugin);
-extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count);
+extern void plugin_unlock_list(THD *thd, plugin_ref *list, size_t count);
extern bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
const LEX_CSTRING *dl);
extern bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
diff --git a/sql/sql_plugin_services.inl b/sql/sql_plugin_services.inl
index c6f07158003..e883081e9f7 100644
--- a/sql/sql_plugin_services.inl
+++ b/sql/sql_plugin_services.inl
@@ -216,7 +216,7 @@ static struct my_print_error_service_st my_print_error_handler=
my_printv_error
};
-struct json_service_st json_handler=
+static struct json_service_st json_handler=
{
json_type,
json_get_array_item,
@@ -231,6 +231,97 @@ static struct thd_mdl_service_st thd_mdl_handler=
thd_mdl_context
};
+struct sql_service_st sql_service_handler=
+{
+ mysql_init,
+ mysql_real_connect_local,
+ mysql_real_connect,
+ mysql_errno,
+ mysql_error,
+ mysql_real_query,
+ mysql_affected_rows,
+ mysql_num_rows,
+ mysql_store_result,
+ mysql_free_result,
+ mysql_fetch_row,
+ mysql_close,
+ mysql_options,
+ mysql_fetch_lengths,
+ mysql_set_character_set,
+ mysql_num_fields,
+ mysql_select_db
+};
+
+#define DEFINE_warning_function(name, ret) { \
+ static query_id_t last_query_id= -1; \
+ THD *thd= current_thd; \
+ if((thd ? thd->query_id : 0) != last_query_id) \
+ { \
+ my_error(ER_PROVIDER_NOT_LOADED, MYF(ME_ERROR_LOG|ME_WARNING), name); \
+ last_query_id= thd ? thd->query_id : 0; \
+ } \
+ return ret; \
+}
+
+#include <providers/lzma.h>
+static struct provider_service_lzma_st provider_handler_lzma=
+{
+ DEFINE_lzma_stream_buffer_decode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR),
+ DEFINE_lzma_easy_buffer_encode([]) DEFINE_warning_function("LZMA compression", LZMA_PROG_ERROR),
+
+ false // .is_loaded
+};
+struct provider_service_lzma_st *provider_service_lzma= &provider_handler_lzma;
+
+#include <providers/lzo/lzo1x.h>
+static struct provider_service_lzo_st provider_handler_lzo=
+{
+ DEFINE_lzo1x_1_15_compress([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR),
+ DEFINE_lzo1x_decompress_safe([]) DEFINE_warning_function("LZO compression", LZO_E_INTERNAL_ERROR),
+
+ false // .is_loaded
+};
+struct provider_service_lzo_st *provider_service_lzo= &provider_handler_lzo;
+
+#include <providers/bzlib.h>
+static struct provider_service_bzip2_st provider_handler_bzip2=
+{
+ DEFINE_BZ2_bzBuffToBuffCompress([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzBuffToBuffDecompress([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzCompress([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzCompressEnd([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzCompressInit([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzDecompress([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzDecompressEnd([]) DEFINE_warning_function("BZip2 compression", -1),
+ DEFINE_BZ2_bzDecompressInit([]) DEFINE_warning_function("BZip2 compression", -1),
+
+ false // .is_loaded
+};
+struct provider_service_bzip2_st *provider_service_bzip2= &provider_handler_bzip2;
+
+#include <providers/snappy-c.h>
+static struct provider_service_snappy_st provider_handler_snappy=
+{
+ DEFINE_snappy_max_compressed_length([]) -> size_t DEFINE_warning_function("Snappy compression", 0),
+ DEFINE_snappy_compress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT),
+ DEFINE_snappy_uncompressed_length([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT),
+ DEFINE_snappy_uncompress([]) DEFINE_warning_function("Snappy compression", SNAPPY_INVALID_INPUT),
+
+ false // .is_loaded
+};
+struct provider_service_snappy_st *provider_service_snappy= &provider_handler_snappy;
+
+#include <providers/lz4.h>
+static struct provider_service_lz4_st provider_handler_lz4=
+{
+ DEFINE_LZ4_compressBound([]) DEFINE_warning_function("LZ4 compression", 0),
+ DEFINE_LZ4_compress_default([]) DEFINE_warning_function("LZ4 compression", 0),
+ DEFINE_LZ4_decompress_safe([]) DEFINE_warning_function("LZ4 compression", -1),
+
+ false // .is_loaded
+};
+struct provider_service_lz4_st *provider_service_lz4= &provider_handler_lz4;
+
static struct st_service_ref list_of_services[]=
{
{ "base64_service", VERSION_base64, &base64_handler },
@@ -255,5 +346,11 @@ static struct st_service_ref list_of_services[]=
{ "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
{ "wsrep_service", VERSION_wsrep, &wsrep_handler },
{ "json_service", VERSION_json, &json_handler },
- { "thd_mdl_service", VERSION_thd_mdl, &thd_mdl_handler }
+ { "thd_mdl_service", VERSION_thd_mdl, &thd_mdl_handler },
+ { "sql_service", VERSION_sql_service, &sql_service_handler },
+ { "provider_service_bzip2", VERSION_provider_bzip2, &provider_handler_bzip2 },
+ { "provider_service_lz4", VERSION_provider_lz4, &provider_handler_lz4 },
+ { "provider_service_lzma", VERSION_provider_lzma, &provider_handler_lzma },
+ { "provider_service_lzo", VERSION_provider_lzo, &provider_handler_lzo },
+ { "provider_service_snappy", VERSION_provider_snappy, &provider_handler_snappy }
};
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ab6734dffb5..65d515d312f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -133,6 +133,7 @@ static const uint PARAMETER_FLAG_UNSIGNED= 128U << 8;
#include "wsrep_trans_observer.h"
#endif /* WITH_WSREP */
#include "xa.h" // xa_recover_get_fields
+#include "sql_audit.h" // mysql_audit_release
/**
A result class used to send cursor rows using the binary protocol.
@@ -1287,7 +1288,8 @@ static bool mysql_test_insert_common(Prepared_statement *stmt,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
- enum_duplicates duplic)
+ enum_duplicates duplic,
+ bool ignore)
{
THD *thd= stmt->thd;
List_iterator_fast<List_item> its(values_list);
@@ -1314,7 +1316,6 @@ static bool mysql_test_insert_common(Prepared_statement *stmt,
if ((values= its++))
{
uint value_count;
- ulong counter= 0;
Item *unused_conds= 0;
if (table_list->table)
@@ -1324,7 +1325,8 @@ static bool mysql_test_insert_common(Prepared_statement *stmt,
}
if (mysql_prepare_insert(thd, table_list, fields, values, update_fields,
- update_values, duplic, &unused_conds, FALSE))
+ update_values, duplic, ignore,
+ &unused_conds, FALSE))
goto error;
value_count= values->elements;
@@ -1340,16 +1342,18 @@ static bool mysql_test_insert_common(Prepared_statement *stmt,
}
while ((values= its++))
{
- counter++;
if (values->elements != value_count)
{
- my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0),
+ thd->get_stmt_da()->current_row_for_warning());
goto error;
}
if (setup_fields(thd, Ref_ptr_array(),
*values, COLUMNS_READ, 0, NULL, 0))
goto error;
+ thd->get_stmt_da()->inc_current_row_for_warning();
}
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
}
DBUG_RETURN(FALSE);
@@ -1377,7 +1381,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
- enum_duplicates duplic)
+ enum_duplicates duplic, bool ignore)
{
THD *thd= stmt->thd;
@@ -1393,7 +1397,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
}
return mysql_test_insert_common(stmt, table_list, fields, values_list,
- update_fields, update_values, duplic);
+ update_fields, update_values, duplic, ignore);
}
@@ -2471,14 +2475,14 @@ static bool check_prepared_statement(Prepared_statement *stmt)
res= mysql_test_insert(stmt, tables, lex->field_list,
lex->many_values,
lex->update_list, lex->value_list,
- lex->duplicates);
+ lex->duplicates, lex->ignore);
break;
case SQLCOM_LOAD:
res= mysql_test_insert_common(stmt, tables, lex->field_list,
lex->many_values,
lex->update_list, lex->value_list,
- lex->duplicates);
+ lex->duplicates, lex->ignore);
break;
case SQLCOM_UPDATE:
@@ -4052,19 +4056,22 @@ Execute_sql_statement(LEX_STRING sql_text)
executions without having to cleanup/reset THD in between.
*/
-bool
-Execute_sql_statement::execute_server_code(THD *thd)
+static bool execute_server_code(THD *thd,
+ const char *sql_text, size_t sql_len)
{
PSI_statement_locker *parent_locker;
bool error;
+ query_id_t save_query_id= thd->query_id;
+ query_id_t next_id= next_query_id();
- if (alloc_query(thd, m_sql_text.str, m_sql_text.length))
+ if (alloc_query(thd, sql_text, sql_len))
return TRUE;
Parser_state parser_state;
if (parser_state.init(thd, thd->query(), thd->query_length()))
return TRUE;
+ thd->query_id= next_id;
parser_state.m_lip.multi_statements= FALSE;
lex_start(thd);
@@ -4082,17 +4089,23 @@ Execute_sql_statement::execute_server_code(THD *thd)
/* report error issued during command execution */
if (likely(error == 0) && thd->spcont == NULL)
- general_log_write(thd, COM_STMT_EXECUTE,
+ general_log_write(thd, COM_QUERY,
thd->query(), thd->query_length());
end:
thd->lex->restore_set_statement_var();
+ thd->query_id= save_query_id;
delete_explain_query(thd->lex);
lex_end(thd->lex);
return error;
}
+bool Execute_sql_statement::execute_server_code(THD *thd)
+{
+ return ::execute_server_code(thd, m_sql_text.str, m_sql_text.length);
+}
+
/***************************************************************************
Prepared_statement
****************************************************************************/
@@ -4862,7 +4875,9 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
Statement stmt_backup;
bool error;
Query_arena *save_stmt_arena= thd->stmt_arena;
+ Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Item_change_list save_change_list;
+
thd->Item_change_list::move_elements_to(&save_change_list);
state= STMT_CONVENTIONAL_EXECUTION;
@@ -4872,12 +4887,15 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
thd->set_n_backup_statement(this, &stmt_backup);
thd->set_n_backup_active_arena(this, &stmt_backup);
+
thd->stmt_arena= this;
+ thd->m_reprepare_observer= 0;
error= server_runnable->execute_server_code(thd);
thd->cleanup_after_query();
+ thd->m_reprepare_observer= save_reprepare_observer;
thd->restore_active_arena(this, &stmt_backup);
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= save_stmt_arena;
@@ -5595,14 +5613,6 @@ Ed_connection::store_result_set()
return ed_result_set;
}
-/*
- MENT-56
- Protocol_local and service_sql for plugins to enable 'local' SQL query execution.
-*/
-
-#ifndef EMBEDDED_LIBRARY
-// This part is mostly copied from libmysqld/lib_sql.cc
-// TODO: get rid of code duplications
#include <mysql.h>
#include "../libmysqld/embedded_priv.h"
@@ -5618,12 +5628,30 @@ public:
char **next_field;
MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc;
+ THD *new_thd;
+ Security_context empty_ctx;
+ ulonglong client_capabilities;
+
+ my_bool do_log_bin;
- Protocol_local(THD *thd_arg, ulong prealloc= 0) :
+ Protocol_local(THD *thd_arg, THD *new_thd_arg, ulong prealloc) :
Protocol_text(thd_arg, prealloc),
- cur_data(0), first_data(0), data_tail(&first_data), alloc(0)
- {}
+ cur_data(0), first_data(0), data_tail(&first_data), alloc(0),
+ new_thd(new_thd_arg), do_log_bin(FALSE)
+ {}
+ void set_binlog_vars(my_bool *sav_log_bin)
+ {
+ *sav_log_bin= thd->variables.sql_log_bin;
+ thd->variables.sql_log_bin= do_log_bin;
+ thd->set_binlog_bit();
+ }
+ void restore_binlog_vars(my_bool sav_log_bin)
+ {
+ do_log_bin= thd->variables.sql_log_bin;
+ thd->variables.sql_log_bin= sav_log_bin;
+ thd->set_binlog_bit();
+ }
protected:
bool net_store_data(const uchar *from, size_t length);
bool net_store_data_cs(const uchar *from, size_t length,
@@ -5694,6 +5722,20 @@ MYSQL_DATA *Protocol_local::alloc_new_dataset()
}
+void Protocol_local::clear_data_list()
+{
+ while (first_data)
+ {
+ MYSQL_DATA *data= first_data;
+ first_data= data->embedded_info->next;
+ free_rows(data);
+ }
+ data_tail= &first_data;
+ free_rows(cur_data);
+ cur_data= 0;
+}
+
+
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
@@ -5987,7 +6029,6 @@ bool Protocol_local::send_result_set_metadata(List<Item> *list, uint flags)
{
List_iterator_fast<Item> it(*list);
Item *item;
-// Protocol_local prot(thd);
DBUG_ENTER("send_result_set_metadata");
// if (!thd->mysql) // bootstrap file handling
@@ -5998,7 +6039,7 @@ bool Protocol_local::send_result_set_metadata(List<Item> *list, uint flags)
for (uint pos= 0 ; (item= it++); pos++)
{
- if (/*prot.*/store_item_metadata(thd, item, pos))
+ if (store_item_metadata(thd, item, pos))
goto err;
}
@@ -6012,6 +6053,7 @@ bool Protocol_local::send_result_set_metadata(List<Item> *list, uint flags)
DBUG_RETURN(1); /* purecov: inspected */
}
+
static void
list_fields_send_default(THD *thd, Protocol_local *p, Field *fld, uint pos)
{
@@ -6099,19 +6141,6 @@ bool Protocol_local::store_null()
#include <sql_common.h>
#include <errmsg.h>
-struct local_results
-{
- struct st_mysql_data *cur_data;
- struct st_mysql_data *first_data;
- struct st_mysql_data **data_tail;
- void clear_data_list();
- struct st_mysql_data *alloc_new_dataset();
- char **next_field;
- MYSQL_FIELD *next_mysql_field;
- MEM_ROOT *alloc;
-};
-
-
static void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
{
NET *net= &mysql->net;
@@ -6126,11 +6155,11 @@ static void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
static my_bool loc_read_query_result(MYSQL *mysql)
{
- local_results *thd= (local_results *) mysql->thd;
+ Protocol_local *p= (Protocol_local *) mysql->thd;
- MYSQL_DATA *res= thd->first_data;
- DBUG_ASSERT(!thd->cur_data);
- thd->first_data= res->embedded_info->next;
+ MYSQL_DATA *res= p->first_data;
+ DBUG_ASSERT(!p->cur_data);
+ p->first_data= res->embedded_info->next;
if (res->embedded_info->last_errno &&
!res->embedded_info->fields_list)
{
@@ -6158,7 +6187,7 @@ static my_bool loc_read_query_result(MYSQL *mysql)
if (res->embedded_info->fields_list)
{
mysql->status=MYSQL_STATUS_GET_RESULT;
- thd->cur_data= res;
+ p->cur_data= res;
}
else
my_free(res);
@@ -6167,174 +6196,273 @@ static my_bool loc_read_query_result(MYSQL *mysql)
}
-static MYSQL_METHODS local_methods=
+static my_bool
+loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
+ const uchar *header, ulong header_length,
+ const uchar *arg, ulong arg_length, my_bool skip_check,
+ MYSQL_STMT *stmt)
{
- loc_read_query_result, /* read_query_result */
- NULL/*loc_advanced_command*/, /* advanced_command */
- NULL/*loc_read_rows*/, /* read_rows */
- NULL/*loc_use_result*/, /* use_result */
- NULL/*loc_fetch_lengths*/, /* fetch_lengths */
- NULL/*loc_flush_use_result*/, /* flush_use_result */
- NULL/*loc_read_change_user_result*/ /* read_change_user_result */
-};
+ my_bool result= 1;
+ Protocol_local *p= (Protocol_local *) mysql->thd;
+ NET *net= &mysql->net;
+ if (p->thd && p->thd->killed != NOT_KILLED)
+ {
+ if (p->thd->killed < KILL_CONNECTION)
+ p->thd->killed= NOT_KILLED;
+ else
+ return 1;
+ }
-extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql,
- const char *host, const char *user, const char *passwd, const char *db)
-{
- //char name_buff[USERNAME_LENGTH];
+ p->clear_data_list();
+ /* Check that we are calling the client functions in right order */
+ if (mysql->status != MYSQL_STATUS_READY)
+ {
+ set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
+ goto end;
+ }
- DBUG_ENTER("mysql_real_connect_local");
+ /* Clear result variables */
+ p->thd->clear_error(1);
+ mysql->affected_rows= ~(my_ulonglong) 0;
+ mysql->field_count= 0;
+ net_clear_error(net);
- /* Test whether we're already connected */
- if (mysql->server_version)
+ /*
+ We have to call free_old_query before we start to fill mysql->fields
+ for new query. In the case of embedded server we collect field data
+ during query execution (not during data retrieval as it is in remote
+ client). So we have to call free_old_query here
+ */
+ free_old_query(mysql);
+
+ if (header)
{
- set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate);
- DBUG_RETURN(0);
+ arg= header;
+ arg_length= header_length;
}
- if (!host || !host[0])
- host= mysql->options.host;
+ if (p->new_thd)
+ {
+ THD *thd_orig= current_thd;
+ set_current_thd(p->thd);
+ p->thd->thread_stack= (char*) &result;
+ p->thd->set_time();
+ result= execute_server_code(p->thd, (const char *)arg, arg_length);
+ p->thd->cleanup_after_query();
+ mysql_audit_release(p->thd);
+ p->end_statement();
+ set_current_thd(thd_orig);
+ }
+ else
+ {
+ Ed_connection con(p->thd);
+ Security_context *ctx_orig= p->thd->security_ctx;
+ ulonglong cap_orig= p->thd->client_capabilities;
+ MYSQL_LEX_STRING sql_text;
+ my_bool log_bin_orig;
+ p->set_binlog_vars(&log_bin_orig);
+
+ DBUG_ASSERT(current_thd == p->thd);
+ sql_text.str= (char *) arg;
+ sql_text.length= arg_length;
+ p->thd->security_ctx= &p->empty_ctx;
+ p->thd->client_capabilities= p->client_capabilities;
+ result= con.execute_direct(p, sql_text);
+ p->thd->client_capabilities= cap_orig;
+ p->thd->security_ctx= ctx_orig;
+ p->restore_binlog_vars(log_bin_orig);
+ }
+ if (skip_check)
+ result= 0;
+ p->cur_data= 0;
- mysql->methods= &local_methods;
+end:
+ return result;
+}
- if (!db || !db[0])
- db=mysql->options.db;
- if (!user || !user[0])
- user=mysql->options.user;
+/*
+ reads dataset from the next query result
- mysql->user= my_strdup(PSI_INSTRUMENT_ME, user, MYF(0));
+ SYNOPSIS
+ loc_read_rows()
+ mysql connection handle
+ other parameters are not used
+ NOTES
+ It just gets next MYSQL_DATA from the result's queue
- mysql->info_buffer= (char *) my_malloc(PSI_INSTRUMENT_ME,
- MYSQL_ERRMSG_SIZE, MYF(0));
- //mysql->thd= create_embedded_thd(client_flag);
+ RETURN
+ pointer to MYSQL_DATA with the coming recordset
+*/
- //init_embedded_mysql(mysql, client_flag);
+static MYSQL_DATA *
+loc_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)),
+ unsigned int fields __attribute__((unused)))
+{
+ MYSQL_DATA *result= ((Protocol_local *)mysql->thd)->cur_data;
+ ((Protocol_local *)mysql->thd)->cur_data= 0;
+ if (result->embedded_info->last_errno)
+ {
+ embedded_get_error(mysql, result);
+ return NULL;
+ }
+ *result->embedded_info->prev_ptr= NULL;
+ return result;
+}
- //if (mysql_init_character_set(mysql))
- // goto error;
- //if (check_embedded_connection(mysql, db))
- // goto error;
+/**************************************************************************
+ Get column lengths of the current row
+ If one uses mysql_use_result, res->lengths contains the length information,
+ else the lengths are calculated from the offset between pointers.
+**************************************************************************/
- mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
+static void loc_fetch_lengths(ulong *to, MYSQL_ROW column,
+ unsigned int field_count)
+{
+ MYSQL_ROW end;
- //if (mysql->options.init_commands)
- //{
- // DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
- // char **ptr= (char**)init_commands->buffer;
- // char **end= ptr + init_commands->elements;
-//
- // for (; ptr<end; ptr++)
- // {
- // MYSQL_RES *res;
- // if (mysql_query(mysql,*ptr))
- // goto error;
- // if (mysql->fields)
- // {
- // if (!(res= (*mysql->methods->use_result)(mysql)))
- // goto error;
- // mysql_free_result(res);
- // }
- // }
- //}
+ for (end=column + field_count; column != end ; column++,to++)
+ *to= *column ? *(uint *)((*column) - sizeof(uint)) : 0;
+}
- DBUG_PRINT("exit",("Mysql handler: %p", mysql));
- DBUG_RETURN(mysql);
-//error:
- DBUG_PRINT("error",("message: %u (%s)",
- mysql->net.last_errno,
- mysql->net.last_error));
+static void loc_flush_use_result(MYSQL *mysql, my_bool)
+{
+ Protocol_local *p= (Protocol_local *) mysql->thd;
+ if (p->cur_data)
{
- /* Free alloced memory */
- my_bool free_me=mysql->free_me;
- free_old_query(mysql);
- mysql->free_me=0;
- mysql_close(mysql);
- mysql->free_me=free_me;
+ free_rows(p->cur_data);
+ p->cur_data= 0;
+ }
+ else if (p->first_data)
+ {
+ MYSQL_DATA *data= p->first_data;
+ p->first_data= data->embedded_info->next;
+ free_rows(data);
}
- DBUG_RETURN(0);
}
-extern "C" int execute_sql_command(const char *command,
- char *hosts, char *names, char *filters)
+static void loc_on_close_free(MYSQL *mysql)
{
- MYSQL_LEX_STRING sql_text;
- THD *thd= current_thd;
- THD *new_thd= 0;
- int result;
- my_bool qc_save= 0;
- Reprepare_observer *save_reprepare_observer= nullptr;
+ Protocol_local *p= (Protocol_local *) mysql->thd;
+ THD *thd= p->new_thd;
+ delete p;
+ if (thd)
+ {
+ delete thd;
+ local_connection_thread_count--;
+ }
+ my_free(mysql->info_buffer);
+ mysql->info_buffer= 0;
+}
- if (!thd)
+static MYSQL_RES *loc_use_result(MYSQL *mysql)
+{
+ return mysql_store_result(mysql);
+}
+
+static MYSQL_METHODS local_methods=
+{
+ loc_read_query_result, /* read_query_result */
+ loc_advanced_command, /* advanced_command */
+ loc_read_rows, /* read_rows */
+ loc_use_result, /* use_result */
+ loc_fetch_lengths, /* fetch_lengths */
+ loc_flush_use_result, /* flush_use_result */
+ NULL, /* read_change_user_result */
+ loc_on_close_free /* on_close_free */
+#ifdef EMBEDDED_LIBRARY
+ ,NULL, /* list_fields */
+ NULL, /* read_prepare_result */
+ NULL, /* stmt_execute */
+ NULL, /* read_binary_rows */
+ NULL, /* unbuffered_fetch */
+ NULL, /* read_statistics */
+ NULL, /* next_result */
+ NULL /* read_rows_from_cursor */
+#endif
+};
+
+
+Atomic_counter<uint32_t> local_connection_thread_count;
+
+extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
+{
+ THD *thd_orig= current_thd;
+ THD *new_thd;
+ Protocol_local *p;
+ ulonglong client_flag;
+ DBUG_ENTER("mysql_real_connect_local");
+
+ /* Test whether we're already connected */
+ if (mysql->server_version)
{
+ set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate);
+ DBUG_RETURN(0);
+ }
+
+ mysql->methods= &local_methods;
+ mysql->user= NULL;
+ client_flag= mysql->options.client_flag;
+ client_flag|= CLIENT_MULTI_RESULTS;;
+ client_flag&= ~(CLIENT_COMPRESS | CLIENT_PLUGIN_AUTH);
+
+ mysql->info_buffer= (char *) my_malloc(PSI_INSTRUMENT_ME,
+ MYSQL_ERRMSG_SIZE, MYF(0));
+ if (!thd_orig || thd_orig->lock)
+ {
+ /*
+ When we start with the empty current_thd (that happens when plugins
+ are loaded during the server start) or when some tables are locked
+ with the current_thd already (that happens when INSTALL PLUGIN
+ calls the plugin_init or with queries), we create the new THD for
+ the local connection. So queries with this MYSQL will be run with
+ it rather than the current THD.
+ */
+
new_thd= new THD(0);
- new_thd->thread_stack= (char*) &sql_text;
+ local_connection_thread_count++;
+ new_thd->thread_stack= (char*) &thd_orig;
new_thd->store_globals();
new_thd->security_ctx->skip_grants();
new_thd->query_cache_is_applicable= 0;
new_thd->variables.wsrep_on= 0;
+ new_thd->variables.sql_log_bin= 0;
+ new_thd->set_binlog_bit();
+ new_thd->client_capabilities= client_flag;
+
+ /*
+ TOSO: decide if we should turn the auditing off
+ for such threads.
+ We can do it like this:
+ new_thd->audit_class_mask[0]= ~0;
+ */
bzero((char*) &new_thd->net, sizeof(new_thd->net));
- thd= new_thd;
+ set_current_thd(thd_orig);
+ thd_orig= new_thd;
}
else
- {
- if (thd->lock)
- /* Doesn't work if the thread opened/locked tables already. */
- return 2;
-
- qc_save= thd->query_cache_is_applicable;
- thd->query_cache_is_applicable= 0;
- save_reprepare_observer= thd->m_reprepare_observer;
- thd->m_reprepare_observer= nullptr;
- }
- sql_text.str= (char *) command;
- sql_text.length= strlen(command);
- {
- Protocol_local p(thd);
- Ed_connection con(thd);
- result= con.execute_direct(&p, sql_text);
- if (!result && p.first_data)
- {
- int nr= (int) p.first_data->rows;
- MYSQL_ROWS *rows= p.first_data->data;
-
- while (nr--)
- {
- strcpy(hosts, rows->data[0]);
- hosts+= strlen(hosts) + 1;
- strcpy(names, rows->data[1]);
- names+= strlen(names) + 1;
- if (filters)
- {
- strcpy(filters, rows->data[2]);
- filters+= strlen(filters) + 1;
- }
- rows= rows->next;
- }
- }
- if (p.first_data)
- {
- if (p.alloc)
- free_root(p.alloc, MYF(0));
- my_free(p.first_data);
- }
- }
+ new_thd= NULL;
+ p= new Protocol_local(thd_orig, new_thd, 0);
if (new_thd)
- delete new_thd;
+ new_thd->protocol= p;
else
{
- thd->query_cache_is_applicable= qc_save;
- thd->m_reprepare_observer= save_reprepare_observer;
+ p->empty_ctx.init();
+ p->empty_ctx.skip_grants();
+ p->client_capabilities= client_flag;
}
- *hosts= 0;
- return result;
+ mysql->thd= p;
+ mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
+
+
+ DBUG_PRINT("exit",("Mysql handler: %p", mysql));
+ DBUG_RETURN(mysql);
}
-#endif /*!EMBEDDED_LIBRARY*/
diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h
index 1e81b9f80e6..1a96df85a19 100644
--- a/sql/sql_prepare.h
+++ b/sql/sql_prepare.h
@@ -353,4 +353,6 @@ private:
size_t m_column_count; /* TODO: change to point to metadata */
};
+extern Atomic_counter<uint32_t> local_connection_thread_count;
+
#endif // SQL_PREPARE_H
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index a304cd39df7..b80825dd236 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -417,16 +417,6 @@ inline int hexchar_to_int(char c)
/* This must match the path length limit in the ER_NOT_RW_DIR error msg. */
#define ER_NOT_RW_DIR_PATHSIZE 200
-#define IS_TABLESPACES_TABLESPACE_NAME 0
-#define IS_TABLESPACES_ENGINE 1
-#define IS_TABLESPACES_TABLESPACE_TYPE 2
-#define IS_TABLESPACES_LOGFILE_GROUP_NAME 3
-#define IS_TABLESPACES_EXTENT_SIZE 4
-#define IS_TABLESPACES_AUTOEXTEND_SIZE 5
-#define IS_TABLESPACES_MAXIMUM_SIZE 6
-#define IS_TABLESPACES_NODEGROUP_ID 7
-#define IS_TABLESPACES_TABLESPACE_COMMENT 8
-
bool db_name_is_in_ignore_db_dirs_list(const char *dbase);
#endif /* MYSQL_SERVER */
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 3448e157e10..8f0f15a982a 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -406,7 +406,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
/* If not default connection and 'all' is used */
mi->release();
mysql_mutex_lock(&LOCK_active_mi);
- if (master_info_index->remove_master_info(mi))
+ if (master_info_index->remove_master_info(mi, 0))
result= 1;
mysql_mutex_unlock(&LOCK_active_mi);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 446f6e83b0d..be78cad5f7a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2612,7 +2612,7 @@ int JOIN::optimize_stage2()
if (!conds && outer_join)
{
/* Handle the case where we have an OUTER JOIN without a WHERE */
- conds= (Item*) &Item_true;
+ conds= (Item*) Item_true;
}
if (impossible_where)
@@ -2782,9 +2782,7 @@ int JOIN::optimize_stage2()
if (conds && const_table_map != found_const_table_map &&
(select_options & SELECT_DESCRIBE))
- {
- conds= (Item*) &Item_false;
- }
+ conds= (Item*) Item_false;
/* Cache constant expressions in WHERE, HAVING, ON clauses. */
cache_const_exprs();
@@ -3096,7 +3094,7 @@ int JOIN::optimize_stage2()
having= having->remove_eq_conds(thd, &select_lex->having_value, true);
if (select_lex->having_value == Item::COND_FALSE)
{
- having= (Item*) &Item_false;
+ having= (Item*) Item_false;
zero_result_cause= "Impossible HAVING noticed after reading const tables";
error= 0;
select_lex->mark_const_derived(zero_result_cause);
@@ -5031,6 +5029,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds,
}
}
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
/* Look for a table owned by an engine with the select_handler interface */
select_lex->pushdown_select= find_select_handler(thd, select_lex);
@@ -5693,7 +5692,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (join->cond_value == Item::COND_FALSE)
{
join->impossible_where= true;
- conds= (Item*) &Item_false;
+ conds= (Item*) Item_false;
}
join->cond_equal= NULL;
@@ -7178,7 +7177,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* set a barrier for the array of SARGABLE_PARAM */
(*sargables)[0].field= 0;
- if (my_init_dynamic_array2(thd->mem_root->m_psi_key, keyuse, sizeof(KEYUSE),
+ if (my_init_dynamic_array2(thd->mem_root->psi_key, keyuse, sizeof(KEYUSE),
thd->alloc(sizeof(KEYUSE) * 20), 20, 64,
MYF(MY_THREAD_SPECIFIC)))
DBUG_RETURN(TRUE);
@@ -12176,7 +12175,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
below to check if we should use 'quick' instead.
*/
DBUG_PRINT("info", ("Item_int"));
- tmp= (Item*) &Item_true;
+ tmp= (Item*) Item_true;
}
}
@@ -12724,9 +12723,9 @@ static
bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array)
{
KEYUSE *keyuse= dynamic_element(keyuse_array, 0, KEYUSE*);
- uint elements= keyuse_array->elements;
+ size_t elements= keyuse_array->elements;
TABLE *prev_table= 0;
- for (uint i= 0; i < elements; i++, keyuse++)
+ for (size_t i= 0; i < elements; i++, keyuse++)
{
if (!keyuse->table)
break;
@@ -15796,7 +15795,7 @@ COND *Item_cond_and::build_equal_items(THD *thd,
if (!cond_args->elements &&
!cond_equal.current_level.elements &&
!eq_list.elements)
- return (Item*) &Item_true;
+ return (Item*) Item_true;
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
@@ -15903,7 +15902,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
Item_equal *item_equal;
int n= cond_equal.current_level.elements + eq_list.elements;
if (n == 0)
- return (Item*) &Item_true;
+ return (Item*) Item_true;
else if (n == 1)
{
if ((item_equal= cond_equal.current_level.pop()))
@@ -16307,7 +16306,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
List<Item> eq_list;
Item_func_eq *eq_item= 0;
if (((Item *) item_equal)->const_item() && !item_equal->val_int())
- return (Item*) &Item_false;
+ return (Item*) Item_false;
Item *item_const= item_equal->get_const();
Item_equal_fields_iterator it(*item_equal);
Item *head;
@@ -16452,7 +16451,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
switch (eq_list.elements)
{
case 0:
- res= cond ? cond : (Item*) &Item_true;
+ res= cond ? cond : (Item*) Item_true;
break;
case 1:
if (!cond || cond->is_bool_literal())
@@ -16705,9 +16704,9 @@ static void update_const_equal_items(THD *thd, COND *cond, JOIN_TAB *tab,
Item *item;
while ((item= li++))
update_const_equal_items(thd, item, tab,
- (((Item_cond*) cond)->top_level() &&
- ((Item_cond*) cond)->functype() ==
- Item_func::COND_AND_FUNC));
+ cond->is_top_level_item() &&
+ ((Item_cond*) cond)->functype() ==
+ Item_func::COND_AND_FUNC);
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_func*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
@@ -18290,7 +18289,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
*/
- Item *item0= (Item*) &Item_false;
+ Item *item0= (Item*) Item_false;
Item *eq_cond= new(thd->mem_root) Item_func_eq(thd, args[0], item0);
if (!eq_cond)
return this;
@@ -18860,20 +18859,19 @@ setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count)
DBUG_ASSERT(table->s->virtual_fields == 0);
- my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
- FALSE);
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->tmp_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->eq_join_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->cond_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
bitmaps+= bitmap_size;
my_bitmap_init(&table->has_value_set,
- (my_bitmap_map*) bitmaps, field_count, FALSE);
+ (my_bitmap_map*) bitmaps, field_count);
/* write_set and all_set are copies of read_set */
table->def_write_set= table->def_read_set;
table->s->all_set= table->def_read_set;
@@ -18996,7 +18994,7 @@ TABLE *Create_tmp_table::start(THD *thd,
(ulong) m_rows_limit, MY_TEST(m_group)));
if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
- m_temp_pool_slot = bitmap_lock_set_next(&temp_pool);
+ m_temp_pool_slot = temp_pool_set_next();
if (m_temp_pool_slot != MY_BIT_NONE) // we got a slot
sprintf(path, "%s-%s-%lx-%i", tmp_file_prefix, param->tmp_name,
@@ -19900,7 +19898,7 @@ 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);
+ temp_pool_clear_bit(m_temp_pool_slot);
}
@@ -20665,7 +20663,7 @@ free_tmp_table(THD *thd, TABLE *entry)
(*ptr)->free();
if (entry->temp_pool_slot != MY_BIT_NONE)
- bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot);
+ temp_pool_clear_bit(entry->temp_pool_slot);
plugin_unlock(0, entry->s->db_plugin);
entry->alias.free();
@@ -21349,7 +21347,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
if (join_tab->on_precond && !join_tab->on_precond->val_int())
rc= NESTED_LOOP_NO_MORE_ROWS;
}
- join->thd->get_stmt_da()->reset_current_row_for_warning();
+ join->thd->get_stmt_da()->reset_current_row_for_warning(1);
if (rc != NESTED_LOOP_NO_MORE_ROWS &&
(rc= join_tab_execution_startup(join_tab)) < 0)
@@ -28845,7 +28843,7 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
{
DYNAMIC_ARRAY added_keyuse;
SARGABLE_PARAM *sargables= 0; /* Used only as a dummy parameter. */
- uint org_keyuse_elements;
+ size_t org_keyuse_elements;
/* Re-run the REF optimizer to take into account the new conditions. */
if (update_ref_and_keys(thd, &added_keyuse, join_tab, table_count, added_where,
@@ -28867,7 +28865,7 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
reset_query_plan();
if (!keyuse.buffer &&
- my_init_dynamic_array(thd->mem_root->m_psi_key, &keyuse, sizeof(KEYUSE),
+ my_init_dynamic_array(thd->mem_root->psi_key, &keyuse, sizeof(KEYUSE),
20, 64, MYF(MY_THREAD_SPECIFIC)))
{
delete_dynamic(&added_keyuse);
@@ -29798,7 +29796,7 @@ AGGR_OP::end_send()
Reset the counter before copying rows from internal temporary table to
INSERT table.
*/
- join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning();
+ join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning(1);
while (rc == NESTED_LOOP_OK)
{
int error;
@@ -30016,7 +30014,7 @@ void JOIN::make_notnull_conds_for_range_scans()
Found a IS NULL conjunctive predicate for a null-rejected field
in the WHERE clause
*/
- conds= (Item*) &Item_false;
+ conds= (Item*) Item_false;
cond_equal= 0;
impossible_where= true;
DBUG_VOID_RETURN;
@@ -30039,7 +30037,7 @@ void JOIN::make_notnull_conds_for_range_scans()
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
*/
- tbl->on_expr= (Item*) &Item_false;
+ tbl->on_expr= (Item*) Item_false;
}
}
}
@@ -30192,7 +30190,7 @@ void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
if (used_tables &&
build_notnull_conds_for_range_scans(join, nest_tbl->on_expr, used_tables))
{
- nest_tbl->on_expr= (Item*) &Item_false;
+ nest_tbl->on_expr= (Item*) Item_false;
}
li.rewind();
@@ -30206,7 +30204,7 @@ void build_notnull_conds_for_inner_nest_of_outer_join(JOIN *join,
}
else if (build_notnull_conds_for_range_scans(join, tbl->on_expr,
tbl->table->map))
- tbl->on_expr= (Item*) &Item_false;
+ tbl->on_expr= (Item*) Item_false;
}
}
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 70c364868d4..2978c0fc319 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -231,6 +231,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin,
case PLUGIN_IS_DISABLED:
table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs);
break;
+ case PLUGIN_IS_DYING:
+ table->field[2]->store(STRING_WITH_LEN("INACTIVE"), cs);
+ break;
case PLUGIN_IS_FREED: // filtered in fill_plugins, used in fill_all_plugins
table->field[2]->store(STRING_WITH_LEN("NOT INSTALLED"), cs);
break;
@@ -324,7 +327,7 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
TABLE *table= tables->table;
if (plugin_foreach_with_mask(thd, show_plugins, MYSQL_ANY_PLUGIN,
- ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), table))
+ ~PLUGIN_IS_FREED, table))
DBUG_RETURN(1);
DBUG_RETURN(0);
@@ -354,7 +357,7 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
plugin_dl_foreach(thd, 0, show_plugins, table);
const char *wstr= lookup.db_value.str, *wend= wstr + lookup.db_value.length;
- for (uint i=0; i < (uint) dirp->number_of_files; i++)
+ for (size_t i=0; i < dirp->number_of_files; i++)
{
FILEINFO *file= dirp->dir_entry+i;
LEX_CSTRING dl= { file->name, strlen(file->name) };
@@ -952,7 +955,7 @@ find_files(THD *thd, Dynamic_array<LEX_CSTRING*> *files, LEX_CSTRING *db,
if (!db) /* Return databases */
{
- for (uint i=0; i < (uint) dirp->number_of_files; i++)
+ for (size_t i=0; i < dirp->number_of_files; i++)
{
FILEINFO *file= dirp->dir_entry+i;
#ifdef USE_SYMDIR
@@ -6754,7 +6757,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
{
if ((key_info->flags & HA_INVISIBLE_KEY) &&
- DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
+ !DBUG_IF("test_invisible_index"))
continue;
KEY_PART_INFO *key_part= key_info->key_part;
LEX_CSTRING *str;
@@ -6762,7 +6765,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
for (uint j=0 ; j < key_info->user_defined_key_parts ; j++,key_part++)
{
if (key_part->field->invisible >= INVISIBLE_SYSTEM &&
- DBUG_EVALUATE_IF("test_completely_invisible", 0, 1))
+ !DBUG_IF("test_completely_invisible"))
{
/*
NOTE: we will get SEQ_IN_INDEX gap inside the result if this key_part
@@ -7422,13 +7425,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
table->field[23]->store(STRING_WITH_LEN("default"), cs);
table->field[24]->set_notnull();
- if (part_elem->tablespace_name)
- table->field[24]->store(part_elem->tablespace_name,
- strlen(part_elem->tablespace_name), cs);
- else
- {
- table->field[24]->set_null();
- }
+ table->field[24]->set_null(); // Tablespace
}
return;
}
@@ -8259,8 +8256,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(0);
my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
- my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
- FALSE);
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count);
table->read_set= &table->def_read_set;
bitmap_clear_all(table->read_set);
table_list->schema_table_param= tmp_table_param;
@@ -9853,23 +9849,17 @@ int initialize_schema_table(st_plugin_int *plugin)
int finalize_schema_table(st_plugin_int *plugin)
{
+ int deinit_status= 0;
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data;
DBUG_ENTER("finalize_schema_table");
if (schema_table)
{
if (plugin->plugin->deinit)
- {
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(NULL))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
- }
+ deinit_status= plugin->plugin->deinit(NULL);
my_free(schema_table);
}
- DBUG_RETURN(0);
+ DBUG_RETURN(deinit_status);
}
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index 8e973f9b0b3..4e86cc4d782 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -44,6 +44,7 @@ const LEX_CSTRING Diag_condition_item_names[]=
{ STRING_WITH_LEN("CURSOR_NAME") },
{ STRING_WITH_LEN("MESSAGE_TEXT") },
{ STRING_WITH_LEN("MYSQL_ERRNO") },
+ { STRING_WITH_LEN("ROW_NUMBER") },
{ STRING_WITH_LEN("CONDITION_IDENTIFIER") },
{ STRING_WITH_LEN("CONDITION_NUMBER") },
@@ -309,6 +310,26 @@ int Sql_cmd_common_signal::eval_signal_informations(THD *thd, Sql_condition *con
cond->m_sql_errno= (int) code;
}
+ set= m_set_signal_information.m_item[DIAG_ROW_NUMBER];
+ if (set != NULL)
+ {
+ if (set->is_null())
+ {
+ thd->raise_error_printf(ER_WRONG_VALUE_FOR_VAR,
+ "ROW_NUMBER", "NULL");
+ goto end;
+ }
+ longlong row_number_value= set->val_int();
+ if (row_number_value < 0)
+ {
+ str= set->val_str(& str_value);
+ thd->raise_error_printf(ER_WRONG_VALUE_FOR_VAR,
+ "ROW_NUMBER", str->c_ptr_safe());
+ goto end;
+ }
+ cond->m_row_number= (ulong) row_number_value;
+ }
+
/*
The various item->val_xxx() methods don't return an error code,
but flag thd in case of failure.
@@ -419,7 +440,8 @@ bool Sql_cmd_resignal::execute(THD *thd)
DBUG_RETURN(result);
}
- Sql_condition signaled_err(thd->mem_root, *signaled, signaled->message);
+ Sql_condition signaled_err(thd->mem_root, *signaled, signaled->message,
+ signaled->m_row_number);
if (m_cond)
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index dfba71b72e3..475b8c2e5d2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -669,10 +669,12 @@ void build_lower_case_table_filename(char *buff, size_t bufflen,
*/
uint build_table_shadow_filename(char *buff, size_t bufflen,
- ALTER_PARTITION_PARAM_TYPE *lpt)
+ ALTER_PARTITION_PARAM_TYPE *lpt,
+ bool backup)
{
char tmp_name[FN_REFLEN];
- my_snprintf(tmp_name, sizeof (tmp_name), "%s-shadow-%lx-%s", tmp_file_prefix,
+ my_snprintf(tmp_name, sizeof (tmp_name), "%s-%s-%lx-%s", tmp_file_prefix,
+ backup ? "backup" : "shadow",
(ulong) current_thd->thread_id, lpt->table_name.str);
return build_table_filename(buff, bufflen, lpt->db.str, tmp_name, "",
FN_IS_TMP);
@@ -706,6 +708,11 @@ uint build_table_shadow_filename(char *buff, size_t bufflen,
tables since it only handles partitioned data if it exists.
*/
+
+/*
+ TODO: Partitioning atomic DDL refactoring: WFRM_WRITE_SHADOW
+ should be merged with create_table_impl(frm_only == true).
+*/
bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
{
/*
@@ -719,8 +726,11 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
char shadow_frm_name[FN_REFLEN+1];
char frm_name[FN_REFLEN+1];
#ifdef WITH_PARTITION_STORAGE_ENGINE
+ char bak_path[FN_REFLEN+1];
+ char bak_frm_name[FN_REFLEN+1];
char *part_syntax_buf;
uint syntax_len;
+ partition_info *part_info= lpt->part_info;
#endif
DBUG_ENTER("mysql_write_frm");
@@ -779,6 +789,94 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
goto end;
}
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (flags & WFRM_WRITE_CONVERTED_TO)
+ {
+ THD *thd= lpt->thd;
+ Alter_table_ctx *alter_ctx= lpt->alter_ctx;
+ HA_CREATE_INFO *create_info= lpt->create_info;
+
+ LEX_CSTRING new_path= { alter_ctx->get_new_path(), 0 };
+ partition_info *work_part_info= thd->work_part_info;
+ handlerton *db_type= create_info->db_type;
+ DBUG_ASSERT(lpt->table->part_info);
+ DBUG_ASSERT(lpt->table->part_info == part_info);
+ handler *file= ((ha_partition *)(lpt->table->file))->get_child_handlers()[0];
+ DBUG_ASSERT(file);
+ new_path.length= strlen(new_path.str);
+ strxnmov(frm_name, sizeof(frm_name) - 1, new_path.str, reg_ext, NullS);
+ create_info->alias= alter_ctx->table_name;
+ thd->work_part_info= NULL;
+ create_info->db_type= work_part_info->default_engine_type;
+ /* NOTE: partitioned temporary tables are not supported. */
+ DBUG_ASSERT(!create_info->tmp_table());
+ if (ddl_log_create_table(thd, part_info, create_info->db_type, &new_path,
+ &alter_ctx->new_db, &alter_ctx->new_name, true) ||
+ ERROR_INJECT("create_before_create_frm"))
+ DBUG_RETURN(TRUE);
+
+ if (mysql_prepare_create_table(thd, create_info, lpt->alter_info,
+ &lpt->db_options, file,
+ &lpt->key_info_buffer, &lpt->key_count,
+ C_ALTER_TABLE, alter_ctx->new_db,
+ alter_ctx->new_name))
+ DBUG_RETURN(TRUE);
+
+ lpt->create_info->table_options= lpt->db_options;
+ LEX_CUSTRING frm= build_frm_image(thd, alter_ctx->new_name, create_info,
+ lpt->alter_info->create_list,
+ lpt->key_count, lpt->key_info_buffer,
+ file);
+ if (unlikely(!frm.str))
+ DBUG_RETURN(TRUE);
+
+ thd->work_part_info= work_part_info;
+ create_info->db_type= db_type;
+
+ ERROR_INJECT("alter_partition_after_create_frm");
+
+ error= writefile(frm_name, alter_ctx->new_db.str, alter_ctx->new_name.str,
+ create_info->tmp_table(), frm.str, frm.length);
+ my_free((void *) frm.str);
+ if (unlikely(error) || ERROR_INJECT("alter_partition_after_write_frm"))
+ {
+ mysql_file_delete(key_file_frm, frm_name, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
+ DBUG_RETURN(false);
+ }
+ if (flags & WFRM_BACKUP_ORIGINAL)
+ {
+ build_table_filename(path, sizeof(path) - 1, lpt->db.str,
+ lpt->table_name.str, "", 0);
+ strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
+
+ build_table_shadow_filename(bak_path, sizeof(bak_path) - 1, lpt, true);
+ strxmov(bak_frm_name, bak_path, reg_ext, NullS);
+
+ DDL_LOG_MEMORY_ENTRY *main_entry= part_info->main_entry;
+ mysql_mutex_lock(&LOCK_gdl);
+ if (write_log_replace_frm(lpt, part_info->list->entry_pos,
+ (const char*) bak_path,
+ (const char*) path) ||
+ ddl_log_write_execute_entry(part_info->list->entry_pos,
+ &part_info->execute_entry))
+ {
+ mysql_mutex_unlock(&LOCK_gdl);
+ DBUG_RETURN(TRUE);
+ }
+ mysql_mutex_unlock(&LOCK_gdl);
+ part_info->main_entry= main_entry;
+ if (mysql_file_rename(key_file_frm, frm_name, bak_frm_name, MYF(MY_WME)))
+ DBUG_RETURN(TRUE);
+ if (lpt->table->file->ha_create_partitioning_metadata(bak_path, path,
+ CHF_RENAME_FLAG))
+ DBUG_RETURN(TRUE);
+ }
+#else /* !WITH_PARTITION_STORAGE_ENGINE */
+ DBUG_ASSERT(!(flags & WFRM_BACKUP_ORIGINAL));
+#endif /* !WITH_PARTITION_STORAGE_ENGINE */
if (flags & WFRM_INSTALL_SHADOW)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -800,20 +898,25 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
completing this we write a new phase to the log entry that will
deactivate it.
*/
- if (mysql_file_delete(key_file_frm, frm_name, MYF(MY_WME)) ||
+ if (!(flags & WFRM_BACKUP_ORIGINAL) && (
+ mysql_file_delete(key_file_frm, frm_name, MYF(MY_WME))
#ifdef WITH_PARTITION_STORAGE_ENGINE
- lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
+ || lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
CHF_DELETE_FLAG) ||
- ddl_log_increment_phase(part_info->frm_log_entry->entry_pos) ||
- (ddl_log_sync(), FALSE) ||
- mysql_file_rename(key_file_frm,
- shadow_frm_name, frm_name, MYF(MY_WME)) ||
- lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
- CHF_RENAME_FLAG))
-#else
- mysql_file_rename(key_file_frm,
- shadow_frm_name, frm_name, MYF(MY_WME)))
+ ddl_log_increment_phase(part_info->main_entry->entry_pos) ||
+ (ddl_log_sync(), FALSE)
+#endif
+ ))
+ {
+ error= 1;
+ goto err;
+ }
+ if (mysql_file_rename(key_file_frm, shadow_frm_name, frm_name, MYF(MY_WME))
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ || lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
+ CHF_RENAME_FLAG)
#endif
+ )
{
error= 1;
goto err;
@@ -852,8 +955,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
err:
#ifdef WITH_PARTITION_STORAGE_ENGINE
- ddl_log_increment_phase(part_info->frm_log_entry->entry_pos);
- part_info->frm_log_entry= NULL;
+ ddl_log_increment_phase(part_info->main_entry->entry_pos);
+ part_info->main_entry= NULL;
(void) ddl_log_sync();
#endif
;
@@ -2765,8 +2868,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
*/
if (sql_field->stored_in_db())
record_offset+= sql_field->pack_length;
- if (sql_field->flags & VERS_SYSTEM_FIELD)
- continue;
}
/* Update virtual fields' offset and give error if
All fields are invisible */
@@ -3120,14 +3221,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (!sql_field || (sql_field->invisible > INVISIBLE_USER &&
!column->generated))
{
- my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXIST, MYF(0), column->field_name.str);
DBUG_RETURN(TRUE);
}
if (sql_field->invisible > INVISIBLE_USER &&
!(sql_field->flags & VERS_SYSTEM_FIELD) &&
- !key->invisible && DBUG_EVALUATE_IF("test_invisible_index", 0, 1))
+ !key->invisible && !DBUG_IF("test_invisible_index"))
{
- my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXIST, MYF(0), column->field_name.str);
DBUG_RETURN(TRUE);
}
while ((dup_column= cols2++) != column)
@@ -4201,7 +4302,6 @@ err:
@retval -1 table existed but IF NOT EXISTS was used
*/
-static
int create_table_impl(THD *thd,
DDL_LOG_STATE *ddl_log_state_create,
DDL_LOG_STATE *ddl_log_state_rm,
@@ -6063,9 +6163,8 @@ remove_key:
if (!part_elem)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_DROP_PARTITION_NON_EXISTENT,
- ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT),
- "DROP");
+ ER_PARTITION_DOES_NOT_EXIST,
+ ER_THD(thd, ER_PARTITION_DOES_NOT_EXIST));
names_it.remove();
}
}
@@ -7636,6 +7735,7 @@ void append_drop_column(THD *thd, String *str, Field *field)
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
static inline
void rename_field_in_list(Create_field *field, List<const char> *field_list)
{
@@ -7648,6 +7748,7 @@ void rename_field_in_list(Create_field *field, List<const char> *field_list)
it.replace(field->field_name.str);
}
}
+#endif
/**
@@ -8432,7 +8533,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key_type= Key::UNIQUE;
if (dropped_key_part)
{
- my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), dropped_key_part);
+ my_error(ER_KEY_COLUMN_DOES_NOT_EXIST, MYF(0), dropped_key_part);
if (long_hash_key)
{
key_info->algorithm= HA_KEY_ALG_LONG_HASH;
@@ -9709,7 +9810,8 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
Table maybe does not exist, but we got an exclusive lock
on the name, now we can safely try to find out for sure.
*/
- if (ha_table_exists(thd, &alter_ctx.new_db, &alter_ctx.new_name))
+ if (!(alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN) &&
+ ha_table_exists(thd, &alter_ctx.new_db, &alter_ctx.new_name))
{
/* Table will be closed in do_command() */
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alter_ctx.new_alias.str);
@@ -10045,10 +10147,8 @@ do_continue:;
}
// In-place execution of ALTER TABLE for partitioning.
- DBUG_RETURN(fast_alter_partition_table(thd, table, alter_info,
- create_info, table_list,
- &alter_ctx.db,
- &alter_ctx.table_name));
+ DBUG_RETURN(fast_alter_partition_table(thd, table, alter_info, &alter_ctx,
+ create_info, table_list));
}
#endif
@@ -11061,6 +11161,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (!(*ptr)->vcol_info)
{
bitmap_set_bit(from->read_set, def->field->field_index);
+ if ((*ptr)->check_assignability_from(def->field, ignore))
+ goto err;
(copy_end++)->set(*ptr,def->field,0);
}
}
@@ -11148,7 +11250,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (ignore && !alter_ctx->fk_error_if_delete_row)
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- thd->get_stmt_da()->reset_current_row_for_warning();
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
restore_record(to, s->default_values); // Create empty record
to->reset_default_fields();
@@ -11612,16 +11714,11 @@ bool check_engine(THD *thd, const char *db_name,
if (create_info->tmp_table() &&
ha_check_storage_engine_flag(*new_engine, HTON_TEMPORARY_NOT_SUPPORTED))
{
- if (create_info->used_fields & HA_CREATE_USED_ENGINE)
- {
- my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
- hton_name(*new_engine)->str, "TEMPORARY");
- *new_engine= 0;
- DBUG_RETURN(true);
- }
- *new_engine= myisam_hton;
+ my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
+ hton_name(*new_engine)->str, "TEMPORARY");
+ *new_engine= 0;
+ DBUG_RETURN(true);
}
-
lex_string_set(&create_info->new_storage_engine_name,
ha_resolve_storage_engine_name(*new_engine));
DBUG_RETURN(false);
diff --git a/sql/sql_table.h b/sql/sql_table.h
index aacb6c99f15..eaa03bfaf8c 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -20,6 +20,10 @@
#include <my_sys.h> // pthread_mutex_t
#include "m_string.h" // LEX_CUSTRING
+#define ERROR_INJECT(code) \
+ ((DBUG_IF("crash_" code) && (DBUG_SUICIDE(), 0)) || \
+ (DBUG_IF("fail_" code) && (my_error(ER_UNKNOWN_ERROR, MYF(0)), 1)))
+
class Alter_info;
class Alter_table_ctx;
class Column_definition;
@@ -53,6 +57,8 @@ enum enum_explain_filename_mode
#define WFRM_WRITE_SHADOW 1
#define WFRM_INSTALL_SHADOW 2
#define WFRM_KEEP_SHARE 4
+#define WFRM_WRITE_CONVERTED_TO 8
+#define WFRM_BACKUP_ORIGINAL 16
/* Flags for conversion functions. */
static const uint FN_FROM_IS_TMP= 1 << 0;
@@ -77,7 +83,8 @@ bool check_mysql50_prefix(const char *name);
uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext, uint flags);
uint build_table_shadow_filename(char *buff, size_t bufflen,
- ALTER_PARTITION_PARAM_TYPE *lpt);
+ ALTER_PARTITION_PARAM_TYPE *lpt,
+ bool backup= false);
void build_lower_case_table_filename(char *buff, size_t bufflen,
const LEX_CSTRING *db,
const LEX_CSTRING *table,
diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc
deleted file mode 100644
index bfbaf185243..00000000000
--- a/sql/sql_tablespace.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-
-/* drop and alter of tablespaces */
-
-#include "mariadb.h"
-#include "sql_priv.h"
-#include "unireg.h"
-#include "sql_tablespace.h"
-#include "sql_table.h" // write_bin_log
-#include "sql_class.h" // THD
-
-int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
-{
- int error= HA_ADMIN_NOT_IMPLEMENTED;
- handlerton *hton= ts_info->storage_engine;
-
- DBUG_ENTER("mysql_alter_tablespace");
- /*
- If the user haven't defined an engine, this will fallback to using the
- default storage engine.
- */
- if (hton == NULL)
- {
- hton= ha_default_handlerton(thd);
- if (ts_info->storage_engine != 0)
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_USING_OTHER_HANDLER,
- ER_THD(thd, ER_WARN_USING_OTHER_HANDLER),
- hton_name(hton)->str,
- ts_info->tablespace_name ? ts_info->tablespace_name
- : ts_info->logfile_group_name);
- }
-
- if (hton->alter_tablespace)
- {
- if (unlikely((error= hton->alter_tablespace(hton, thd, ts_info))))
- {
- if (error == 1)
- DBUG_RETURN(1);
-
- if (error == HA_ADMIN_NOT_IMPLEMENTED)
- my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
- else
- my_error(error, MYF(0));
-
- DBUG_RETURN(error);
- }
- }
- else
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- ER_THD(thd, ER_ILLEGAL_HA_CREATE_OPTION),
- hton_name(hton)->str,
- "TABLESPACE or LOGFILE GROUP");
- }
- error= write_bin_log(thd, FALSE, thd->query(), thd->query_length());
- DBUG_RETURN(error);
-}
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index e06600700bb..0d1a8313564 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -264,7 +264,7 @@ static void print_keyuse(KEYUSE *keyuse)
void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array)
{
DBUG_LOCK_FILE;
- fprintf(DBUG_FILE, "KEYUSE array (%d elements)\n", keyuse_array->elements);
+ fprintf(DBUG_FILE, "KEYUSE array (%zu elements)\n", keyuse_array->elements);
for(uint i=0; i < keyuse_array->elements; i++)
print_keyuse((KEYUSE*)dynamic_array_ptr(keyuse_array, i));
DBUG_UNLOCK_FILE;
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
index e7372a13a2d..6e6d446ce16 100644
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@ -422,7 +422,9 @@ bool table_value_constr::exec(SELECT_LEX *sl)
DBUG_ENTER("table_value_constr::exec");
List_iterator_fast<List_item> li(lists_of_values);
List_item *elem;
+ THD *cur_thd= sl->parent_lex->thd;
ha_rows send_records= 0;
+ int rc=0;
if (select_options & SELECT_DESCRIBE)
DBUG_RETURN(false);
@@ -438,12 +440,10 @@ bool table_value_constr::exec(SELECT_LEX *sl)
while ((elem= li++))
{
- THD *cur_thd= sl->parent_lex->thd;
+ cur_thd->get_stmt_da()->inc_current_row_for_warning();
if (send_records >= sl->master_unit()->lim.get_select_limit())
break;
- int rc=
- result->send_data_with_check(*elem, sl->master_unit(), send_records);
- cur_thd->get_stmt_da()->inc_current_row_for_warning();
+ rc= result->send_data_with_check(*elem, sl->master_unit(), send_records);
if (!rc)
send_records++;
else if (rc > 0)
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 5335623eafd..bac93373ccb 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -1746,7 +1746,7 @@ Type_handler_time_common::type_handler_for_native_format() const
const Type_handler *Type_handler_typelib::type_handler_for_item_field() const
{
- return &type_handler_string;
+ return &type_handler_varchar;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d341206732f..eda1eb8ef9e 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -271,7 +271,7 @@ static void prepare_record_for_error_message(int error, TABLE *table)
DBUG_VOID_RETURN;
/* Create unique_map with all fields used by that index. */
- my_bitmap_init(&unique_map, unique_map_buf, table->s->fields, FALSE);
+ my_bitmap_init(&unique_map, unique_map_buf, table->s->fields);
table->mark_index_columns(keynr, &unique_map);
/* Subtract read_set and write_set. */
@@ -523,6 +523,10 @@ int mysql_update(THD *thd,
DBUG_RETURN(1); /* purecov: inspected */
}
+ if (table_list->table->check_assignability_explicit_fields(fields, values,
+ ignore))
+ DBUG_RETURN(true);
+
if (check_unique_table(thd, table_list))
DBUG_RETURN(TRUE);
@@ -1003,6 +1007,7 @@ update_begin:
THD_STAGE_INFO(thd, stage_updating);
fix_rownum_pointers(thd, thd->lex->current_select, &updated_or_same);
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
while (!(error=info.read_record()) && !thd->killed)
{
explain->tracker.on_record_read();
@@ -2081,7 +2086,9 @@ int multi_update::prepare(List<Item> &not_used_values,
*/
int error= setup_fields(thd, Ref_ptr_array(),
- *values, MARK_COLUMNS_READ, 0, NULL, 0);
+ *values, MARK_COLUMNS_READ, 0, NULL, 0) ||
+ TABLE::check_assignability_explicit_fields(*fields, *values,
+ ignore);
ti.rewind();
while ((table_ref= ti++))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index cad4e9efd33..6c3e93540d6 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -770,6 +770,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> CATALOG_NAME_SYM /* SQL-2003-N */
%token <kwd> CHAIN_SYM /* SQL-2003-N */
%token <kwd> CHANGED
+%token <kwd> CHANNEL_SYM
%token <kwd> CHARSET
%token <kwd> CHECKPOINT_SYM
%token <kwd> CHECKSUM_SYM
@@ -1452,7 +1453,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
field_options last_field_options
%type <ulonglong_number>
- ulonglong_num real_ulonglong_num size_number
+ ulonglong_num real_ulonglong_num
%type <longlong_number>
longlong_num
@@ -2070,6 +2071,7 @@ change:
Lex->sql_command = SQLCOM_CHANGE_MASTER;
}
master_defs
+ optional_for_channel
{}
;
@@ -2301,6 +2303,34 @@ connection_name:
}
;
+optional_for_channel:
+ /* empty */
+ {
+ /*do nothing */
+ }
+ | for_channel
+
+ ;
+
+for_channel:
+ FOR_SYM CHANNEL_SYM TEXT_STRING_sys
+ {
+ if (Lex->mi.connection_name.str != NULL)
+ {
+ my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)"));
+ }
+ else
+ {
+ Lex->mi.connection_name= $3;
+#ifdef HAVE_REPLICATION
+ if (unlikely(check_master_connection_name(&$3)))
+ my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME"));
+#endif
+ }
+
+ }
+ ;
+
/* create a table */
create:
@@ -2545,14 +2575,6 @@ create:
$1 | $3)))
MYSQL_YYABORT;
}
- | CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
- {
- Lex->alter_tablespace_info->ts_cmd_type= CREATE_LOGFILE_GROUP;
- }
- | CREATE TABLESPACE tablespace_info
- {
- Lex->alter_tablespace_info->ts_cmd_type= CREATE_TABLESPACE;
- }
| create_or_replace { Lex->set_command(SQLCOM_CREATE_SERVER, $1); }
server_def
{ }
@@ -3469,6 +3491,8 @@ signal_condition_information_item_name:
{ $$= DIAG_MESSAGE_TEXT; }
| MYSQL_ERRNO_SYM
{ $$= DIAG_MYSQL_ERRNO; }
+ | ROW_NUMBER_SYM
+ { $$= DIAG_ROW_NUMBER; }
;
resignal_stmt:
@@ -3549,6 +3573,11 @@ simple_target_specification:
}
| '@' ident_or_text
{
+ if (!$2.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$2);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -3625,6 +3654,8 @@ condition_information_item_name:
{ $$= Condition_information_item::MYSQL_ERRNO; }
| RETURNED_SQLSTATE_SYM
{ $$= Condition_information_item::RETURNED_SQLSTATE; }
+ | ROW_NUMBER_SYM
+ { $$= Condition_information_item::ROW_NUMBER; }
;
sp_decl_ident:
@@ -4324,350 +4355,6 @@ trg_event:
| DELETE_SYM
{ Lex->trg_chistics.event= TRG_EVENT_DELETE; }
;
-/*
- This part of the parser contains common code for all TABLESPACE
- commands.
- CREATE TABLESPACE name ...
- ALTER TABLESPACE name CHANGE DATAFILE ...
- ALTER TABLESPACE name ADD DATAFILE ...
- ALTER TABLESPACE name access_mode
- CREATE LOGFILE GROUP_SYM name ...
- ALTER LOGFILE GROUP_SYM name ADD UNDOFILE ..
- ALTER LOGFILE GROUP_SYM name ADD REDOFILE ..
- DROP TABLESPACE name
- DROP LOGFILE GROUP_SYM name
-*/
-change_tablespace_access:
- tablespace_name
- ts_access_mode
- ;
-
-change_tablespace_info:
- tablespace_name
- CHANGE ts_datafile
- change_ts_option_list
- ;
-
-tablespace_info:
- tablespace_name
- ADD ts_datafile
- opt_logfile_group_name
- tablespace_option_list
- ;
-
-opt_logfile_group_name:
- /* empty */ {}
- | USE_SYM LOGFILE_SYM GROUP_SYM ident
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->logfile_group_name= $4.str;
- }
- ;
-
-alter_tablespace_info:
- tablespace_name
- ADD ts_datafile
- alter_tablespace_option_list
- {
- Lex->alter_tablespace_info->ts_alter_tablespace_type= ALTER_TABLESPACE_ADD_FILE;
- }
- | tablespace_name
- DROP ts_datafile
- alter_tablespace_option_list
- {
- Lex->alter_tablespace_info->ts_alter_tablespace_type= ALTER_TABLESPACE_DROP_FILE;
- }
- ;
-
-logfile_group_info:
- logfile_group_name
- add_log_file
- logfile_group_option_list
- ;
-
-alter_logfile_group_info:
- logfile_group_name
- add_log_file
- alter_logfile_group_option_list
- ;
-
-add_log_file:
- ADD lg_undofile
- | ADD lg_redofile
- ;
-
-change_ts_option_list:
- /* empty */ {}
- change_ts_options
- ;
-
-change_ts_options:
- change_ts_option
- | change_ts_options change_ts_option
- | change_ts_options ',' change_ts_option
- ;
-
-change_ts_option:
- opt_ts_initial_size
- | opt_ts_autoextend_size
- | opt_ts_max_size
- ;
-
-tablespace_option_list:
- tablespace_options
- ;
-
-tablespace_options:
- tablespace_option
- | tablespace_options tablespace_option
- | tablespace_options ',' tablespace_option
- ;
-
-tablespace_option:
- opt_ts_initial_size
- | opt_ts_autoextend_size
- | opt_ts_max_size
- | opt_ts_extent_size
- | opt_ts_nodegroup
- | opt_ts_engine
- | ts_wait
- | opt_ts_comment
- ;
-
-alter_tablespace_option_list:
- alter_tablespace_options
- ;
-
-alter_tablespace_options:
- alter_tablespace_option
- | alter_tablespace_options alter_tablespace_option
- | alter_tablespace_options ',' alter_tablespace_option
- ;
-
-alter_tablespace_option:
- opt_ts_initial_size
- | opt_ts_autoextend_size
- | opt_ts_max_size
- | opt_ts_engine
- | ts_wait
- ;
-
-logfile_group_option_list:
- logfile_group_options
- ;
-
-logfile_group_options:
- logfile_group_option
- | logfile_group_options logfile_group_option
- | logfile_group_options ',' logfile_group_option
- ;
-
-logfile_group_option:
- opt_ts_initial_size
- | opt_ts_undo_buffer_size
- | opt_ts_redo_buffer_size
- | opt_ts_nodegroup
- | opt_ts_engine
- | ts_wait
- | opt_ts_comment
- ;
-
-alter_logfile_group_option_list:
- alter_logfile_group_options
- ;
-
-alter_logfile_group_options:
- alter_logfile_group_option
- | alter_logfile_group_options alter_logfile_group_option
- | alter_logfile_group_options ',' alter_logfile_group_option
- ;
-
-alter_logfile_group_option:
- opt_ts_initial_size
- | opt_ts_engine
- | ts_wait
- ;
-
-
-ts_datafile:
- DATAFILE_SYM TEXT_STRING_sys
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->data_file_name= $2.str;
- }
- ;
-
-lg_undofile:
- UNDOFILE_SYM TEXT_STRING_sys
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->undo_file_name= $2.str;
- }
- ;
-
-lg_redofile:
- REDOFILE_SYM TEXT_STRING_sys
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->redo_file_name= $2.str;
- }
- ;
-
-tablespace_name:
- ident
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info= (new (thd->mem_root)
- st_alter_tablespace());
- if (unlikely(lex->alter_tablespace_info == NULL))
- MYSQL_YYABORT;
- lex->alter_tablespace_info->tablespace_name= $1.str;
- lex->sql_command= SQLCOM_ALTER_TABLESPACE;
- }
- ;
-
-logfile_group_name:
- ident
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info= (new (thd->mem_root)
- st_alter_tablespace());
- if (unlikely(lex->alter_tablespace_info == NULL))
- MYSQL_YYABORT;
- lex->alter_tablespace_info->logfile_group_name= $1.str;
- lex->sql_command= SQLCOM_ALTER_TABLESPACE;
- }
- ;
-
-ts_access_mode:
- READ_ONLY_SYM
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_access_mode= TS_READ_ONLY;
- }
- | READ_WRITE_SYM
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_access_mode= TS_READ_WRITE;
- }
- | NOT_SYM ACCESSIBLE_SYM
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_access_mode= TS_NOT_ACCESSIBLE;
- }
- ;
-
-opt_ts_initial_size:
- INITIAL_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->initial_size= $3;
- }
- ;
-
-opt_ts_autoextend_size:
- AUTOEXTEND_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->autoextend_size= $3;
- }
- ;
-
-opt_ts_max_size:
- MAX_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->max_size= $3;
- }
- ;
-
-opt_ts_extent_size:
- EXTENT_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->extent_size= $3;
- }
- ;
-
-opt_ts_undo_buffer_size:
- UNDO_BUFFER_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->undo_buffer_size= $3;
- }
- ;
-
-opt_ts_redo_buffer_size:
- REDO_BUFFER_SIZE_SYM opt_equal size_number
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->redo_buffer_size= $3;
- }
- ;
-
-opt_ts_nodegroup:
- NODEGROUP_SYM opt_equal real_ulong_num
- {
- LEX *lex= Lex;
- if (unlikely(lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP))
- my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP"));
- lex->alter_tablespace_info->nodegroup_id= $3;
- }
- ;
-
-opt_ts_comment:
- COMMENT_SYM opt_equal TEXT_STRING_sys
- {
- LEX *lex= Lex;
- if (unlikely(lex->alter_tablespace_info->ts_comment != NULL))
- my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT"));
- lex->alter_tablespace_info->ts_comment= $3.str;
- }
- ;
-
-opt_ts_engine:
- opt_storage ENGINE_SYM opt_equal storage_engines
- {
- LEX *lex= Lex;
- if (unlikely(lex->alter_tablespace_info->storage_engine != NULL))
- my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE, MYF(0),
- "STORAGE ENGINE"));
- lex->alter_tablespace_info->storage_engine= $4;
- }
- ;
-
-opt_ts_wait:
- /* empty */
- | ts_wait
- ;
-
-ts_wait:
- WAIT_SYM
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->wait_until_completed= TRUE;
- }
- | NO_WAIT_SYM
- {
- LEX *lex= Lex;
- if (unlikely(!(lex->alter_tablespace_info->wait_until_completed)))
- my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT"));
- lex->alter_tablespace_info->wait_until_completed= FALSE;
- }
- ;
-
-size_number:
- real_ulonglong_num { $$= $1;}
- | IDENT_sys
- {
- if ($1.to_size_number(&$$))
- MYSQL_YYABORT;
- }
- ;
-
-/*
- End tablespace part
-*/
create_body:
create_field_list_parens
@@ -5041,8 +4728,13 @@ part_def_list:
| part_def_list ',' part_definition {}
;
+opt_partition:
+ /* empty */
+ | PARTITION_SYM
+ ;
+
part_definition:
- PARTITION_SYM
+ opt_partition
{
partition_info *part_info= Lex->part_info;
partition_element *p_elem= new (thd->mem_root) partition_element();
@@ -5123,13 +4815,17 @@ opt_part_values:
part_values_in {}
| CURRENT_SYM
{
+#ifdef WITH_PARTITION_STORAGE_ENGINE
if (Lex->part_values_current(thd))
MYSQL_YYABORT;
+#endif
}
| HISTORY_SYM
{
+#ifdef WITH_PARTITION_STORAGE_ENGINE
if (Lex->part_values_history(thd))
MYSQL_YYABORT;
+#endif
}
| DEFAULT
{
@@ -5388,7 +5084,7 @@ opt_part_option_list:
opt_part_option:
TABLESPACE opt_equal ident_or_text
- { Lex->part_info->curr_part_elem->tablespace_name= $3.str; }
+ { /* Compatibility with MySQL */ }
| opt_storage ENGINE_SYM opt_equal storage_engines
{
partition_info *part_info= Lex->part_info;
@@ -5728,7 +5424,7 @@ create_table_option:
Lex->create_info.used_fields|= HA_CREATE_USED_INDEXDIR;
}
| TABLESPACE ident
- {Lex->create_info.tablespace= $2.str;}
+ { /* Compatiblity with MySQL */ }
| STORAGE_SYM DISK_SYM
{Lex->create_info.storage_media= HA_SM_DISK;}
| STORAGE_SYM MEMORY_SYM
@@ -5797,7 +5493,7 @@ versioning_option:
{
if (unlikely(Lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
{
- if (DBUG_EVALUATE_IF("sysvers_force", 0, 1))
+ if (!DBUG_IF("sysvers_force"))
{
my_error(ER_VERS_NOT_SUPPORTED, MYF(0), "CREATE TEMPORARY TABLE");
MYSQL_YYABORT;
@@ -7383,26 +7079,6 @@ alter:
Lex->pop_select(); //main select
}
- | ALTER TABLESPACE alter_tablespace_info
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= ALTER_TABLESPACE;
- }
- | ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= ALTER_LOGFILE_GROUP;
- }
- | ALTER TABLESPACE change_tablespace_info
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= CHANGE_FILE_TABLESPACE;
- }
- | ALTER TABLESPACE change_tablespace_access
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= ALTER_ACCESS_MODE_TABLESPACE;
- }
| ALTER SERVER_SYM ident_or_text
{
LEX *lex= Lex;
@@ -7636,6 +7312,54 @@ alter_commands:
if (Lex->stmt_alter_table_exchange_partition($6))
MYSQL_YYABORT;
}
+ | CONVERT_SYM PARTITION_SYM alt_part_name_item
+ TO_SYM TABLE_SYM table_ident have_partitioning
+ {
+ LEX *lex= Lex;
+ if (Lex->stmt_alter_table($6))
+ MYSQL_YYABORT;
+ lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_table();
+ if (unlikely(lex->m_sql_cmd == NULL))
+ MYSQL_YYABORT;
+ lex->alter_info.partition_flags|= ALTER_PARTITION_CONVERT_OUT;
+ }
+ | CONVERT_SYM TABLE_SYM table_ident
+ {
+ LEX *lex= Lex;
+ if (!lex->first_select_lex()->add_table_to_list(thd, $3, nullptr, 0,
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE))
+ MYSQL_YYABORT;
+
+ /*
+ This will appear as (new_db, new_name) in alter_ctx.
+ new_db will be IX-locked and new_name X-locked.
+ */
+ lex->first_select_lex()->db= $3->db;
+ lex->name= $3->table;
+ if (lex->first_select_lex()->db.str == NULL &&
+ lex->copy_db_to(&lex->first_select_lex()->db))
+ MYSQL_YYABORT;
+
+ lex->part_info= new (thd->mem_root) partition_info();
+ if (unlikely(!lex->part_info))
+ MYSQL_YYABORT;
+
+ lex->part_info->num_parts= 1;
+ /*
+ OR-ed with ALTER_PARTITION_ADD because too many checks of
+ ALTER_PARTITION_ADD required.
+ */
+ lex->alter_info.partition_flags|= ALTER_PARTITION_ADD |
+ ALTER_PARTITION_CONVERT_IN;
+ }
+ TO_SYM PARTITION_SYM part_definition
+ {
+ LEX *lex= Lex;
+ lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_table();
+ if (unlikely(lex->m_sql_cmd == NULL))
+ MYSQL_YYABORT;
+ }
;
remove_partitioning:
@@ -7884,17 +7608,9 @@ alter_list_item:
}
| RENAME opt_to table_ident
{
- LEX *lex=Lex;
- lex->first_select_lex()->db= $3->db;
- if (lex->first_select_lex()->db.str == NULL &&
- lex->copy_db_to(&lex->first_select_lex()->db))
+ if (Lex->stmt_alter_table($3))
MYSQL_YYABORT;
- if (unlikely(check_table_name($3->table.str,$3->table.length,
- FALSE)) ||
- ($3->db.str && unlikely(check_db_name((LEX_STRING*) &$3->db))))
- my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str));
- lex->name= $3->table;
- lex->alter_info.flags|= ALTER_RENAME;
+ Lex->alter_info.flags|= ALTER_RENAME;
}
| RENAME COLUMN_SYM opt_if_exists_table_element ident TO_SYM ident
{
@@ -8061,7 +7777,7 @@ opt_to:
;
slave:
- START_SYM SLAVE optional_connection_name slave_thread_opts
+ START_SYM SLAVE optional_connection_name slave_thread_opts optional_for_channel
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
@@ -8078,7 +7794,7 @@ slave:
/* If you change this code don't forget to update STOP SLAVE too */
}
{}
- | STOP_SYM SLAVE optional_connection_name slave_thread_opts
+ | STOP_SYM SLAVE optional_connection_name slave_thread_opts optional_for_channel
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
@@ -11307,6 +11023,11 @@ variable_aux:
ident_or_text SET_VAR expr
{
Item_func_set_user_var *item;
+ if (!$1.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
$$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -11316,6 +11037,11 @@ variable_aux:
}
| ident_or_text
{
+ if (!$1.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$1);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -12969,6 +12695,12 @@ select_var_ident: select_outvar
select_outvar:
'@' ident_or_text
{
+ if (!$2.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
+
$$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL;
}
| ident_or_text
@@ -13117,16 +12849,6 @@ drop:
lex->set_command(SQLCOM_DROP_TRIGGER, $3);
lex->spname= $4;
}
- | DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= DROP_TABLESPACE;
- }
- | DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait
- {
- LEX *lex= Lex;
- lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP;
- }
| DROP SERVER_SYM opt_if_exists ident_or_text
{
Lex->set_command(SQLCOM_DROP_SERVER, $3);
@@ -13231,6 +12953,8 @@ insert:
{
Lex->sql_command= SQLCOM_INSERT;
Lex->duplicates= DUP_ERROR;
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
}
insert_start insert_lock_option opt_ignore opt_into insert_table
{
@@ -13240,6 +12964,7 @@ insert:
stmt_end
{
Lex->mark_first_table_as_inserting();
+ thd->get_stmt_da()->reset_current_row_for_warning(0);
}
;
@@ -13248,6 +12973,8 @@ replace:
{
Lex->sql_command = SQLCOM_REPLACE;
Lex->duplicates= DUP_REPLACE;
+ thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
+ thd->get_stmt_da()->reset_current_row_for_warning(1);
}
insert_start replace_lock_option opt_into insert_table
{
@@ -13257,6 +12984,7 @@ replace:
stmt_end
{
Lex->mark_first_table_as_inserting();
+ thd->get_stmt_da()->reset_current_row_for_warning(0);
}
;
@@ -13408,6 +13136,7 @@ no_braces:
opt_values ')'
{
LEX *lex=Lex;
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (unlikely(lex->many_values.push_back(lex->insert_list,
thd->mem_root)))
MYSQL_YYABORT;
@@ -13423,6 +13152,7 @@ no_braces_with_names:
opt_values_with_names ')'
{
LEX *lex=Lex;
+ thd->get_stmt_da()->inc_current_row_for_warning();
if (unlikely(lex->many_values.push_back(lex->insert_list,
thd->mem_root)))
MYSQL_YYABORT;
@@ -13998,7 +13728,8 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
}
- opt_global_limit_clause
+ opt_global_limit_clause optional_for_channel
+ { }
| keys_or_index from_or_in table_ident opt_db opt_where_clause
{
LEX *lex= Lex;
@@ -14143,16 +13874,7 @@ show_param:
MYSQL_YYABORT;
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
}
- | 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;
- }
- | SLAVE connection_name STATUS_SYM
+ | SLAVE optional_connection_name STATUS_SYM optional_for_channel
{
if (!(Lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_show_slave_status()))
@@ -14537,7 +14259,7 @@ flush_option:
{ Lex->type|= REFRESH_SLOW_LOG; }
| BINARY LOGS_SYM opt_delete_gtid_domain
{ Lex->type|= REFRESH_BINARY_LOG; }
- | RELAY LOGS_SYM optional_connection_name
+ | RELAY LOGS_SYM optional_connection_name optional_for_channel
{
LEX *lex= Lex;
if (unlikely(lex->type & REFRESH_RELAY_LOG))
@@ -14688,7 +14410,8 @@ reset_options:
reset_option:
SLAVE { Lex->type|= REFRESH_SLAVE; }
optional_connection_name
- slave_reset_options { }
+ slave_reset_options optional_for_channel
+ { }
| MASTER_SYM
{
Lex->type|= REFRESH_MASTER;
@@ -14978,6 +14701,12 @@ field_or_var:
simple_ident_nospvar {$$= $1;}
| '@' ident_or_text
{
+ if (!$2.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
+
$$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -15986,6 +15715,7 @@ keyword_sp_var_and_label:
| CASCADED
| CATALOG_NAME_SYM
| CHAIN_SYM
+ | CHANNEL_SYM
| CHANGED
| CIPHER_SYM
| CLIENT_SYM
@@ -16793,6 +16523,12 @@ option_value_no_option_type:
}
| '@' ident_or_text equal
{
+ if (!$2.length)
+ {
+ thd->parse_error();
+ MYSQL_YYABORT;
+ }
+
if (sp_create_assignment_lex(thd, $1.str))
MYSQL_YYABORT;
}
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index d077fb317f4..05f7f917723 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -741,6 +741,23 @@ static Sys_var_charptr_fscs Sys_character_sets_dir(
READ_ONLY GLOBAL_VAR(charsets_dir), CMD_LINE(REQUIRED_ARG),
DEFAULT(0));
+static bool check_engine_supports_temporary(sys_var *self, THD *thd, set_var *var)
+{
+ plugin_ref plugin= var->save_result.plugin;
+ if (!plugin)
+ return false;
+ DBUG_ASSERT(plugin);
+ handlerton *hton= plugin_hton(plugin);
+ DBUG_ASSERT(hton);
+ if (ha_check_storage_engine_flag(hton, HTON_TEMPORARY_NOT_SUPPORTED))
+ {
+ my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), hton_name(hton)->str,
+ "TEMPORARY");
+ return true;
+ }
+ return false;
+}
+
static bool check_not_null(sys_var *self, THD *thd, set_var *var)
{
return var->value && var->value->is_null();
@@ -4264,7 +4281,8 @@ static Sys_var_plugin Sys_storage_engine(
static Sys_var_plugin Sys_default_tmp_storage_engine(
"default_tmp_storage_engine", "The default storage engine for user-created temporary tables",
SESSION_VAR(tmp_table_plugin), NO_CMD_LINE,
- MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine));
+ MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_engine_supports_temporary));
static Sys_var_plugin Sys_enforce_storage_engine(
"enforce_storage_engine", "Force the use of a storage engine for new tables",
@@ -4470,10 +4488,7 @@ static bool fix_sql_log_bin_after_update(sys_var *self, THD *thd,
{
DBUG_ASSERT(type == OPT_SESSION);
- if (thd->variables.sql_log_bin)
- thd->variables.option_bits |= OPTION_BIN_LOG;
- else
- thd->variables.option_bits &= ~OPTION_BIN_LOG;
+ thd->set_binlog_bit();
return FALSE;
}
@@ -6039,16 +6054,6 @@ static Sys_var_mybool Sys_wsrep_desync (
ON_CHECK(wsrep_desync_check),
ON_UPDATE(wsrep_desync_update));
-static Sys_var_mybool Sys_wsrep_strict_ddl (
- "wsrep_strict_ddl",
- "If set, reject DDL on affected tables not supporting Galera replication",
- GLOBAL_VAR(wsrep_strict_ddl),
- CMD_LINE(OPT_ARG), DEFAULT(FALSE),
- NO_MUTEX_GUARD, NOT_IN_BINLOG,
- ON_CHECK(0),
- ON_UPDATE(wsrep_strict_ddl_update),
- DEPRECATED("'@@wsrep_mode=STRICT_REPLICATION'")); // since 10.6.0
-
static const char *wsrep_reject_queries_names[]= { "NONE", "ALL", "ALL_KILL", NullS };
static Sys_var_enum Sys_wsrep_reject_queries(
"wsrep_reject_queries", "Variable to set to reject queries",
@@ -6069,13 +6074,6 @@ static Sys_var_mybool Sys_wsrep_recover_datadir(
READ_ONLY GLOBAL_VAR(wsrep_recovery),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
-static Sys_var_mybool Sys_wsrep_replicate_myisam(
- "wsrep_replicate_myisam", "To enable myisam replication",
- GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(wsrep_replicate_myisam_update),
- DEPRECATED("'@@wsrep_mode=REPLICATE_MYISAM'")); // since 10.6.0
-
static Sys_var_mybool Sys_wsrep_log_conflicts(
"wsrep_log_conflicts", "To log multi-master conflicts",
GLOBAL_VAR(wsrep_log_conflicts), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
diff --git a/sql/table.cc b/sql/table.cc
index 40113bf2569..8773eed9a40 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2670,11 +2670,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
{
auto field_type= handler->real_field_type();
- if (DBUG_EVALUATE_IF("error_vers_wrong_type", 1, 0))
- field_type= MYSQL_TYPE_BLOB;
+ DBUG_EXECUTE_IF("error_vers_wrong_type", field_type= MYSQL_TYPE_BLOB;);
- switch (field_type)
- {
+ switch (field_type) {
case MYSQL_TYPE_TIMESTAMP2:
break;
case MYSQL_TYPE_LONGLONG:
@@ -3353,7 +3351,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
share->column_bitmap_size *
bitmap_count)))
goto err;
- my_bitmap_init(&share->all_set, bitmaps, share->fields, FALSE);
+ my_bitmap_init(&share->all_set, bitmaps, share->fields);
bitmap_set_all(&share->all_set);
if (share->check_set)
{
@@ -3364,7 +3362,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
my_bitmap_init(share->check_set,
(my_bitmap_map*) ((uchar*) bitmaps +
share->column_bitmap_size),
- share->fields, FALSE);
+ share->fields);
bitmap_clear_all(share->check_set);
}
@@ -4382,26 +4380,26 @@ partititon_err:
goto err;
my_bitmap_init(&outparam->def_read_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->def_write_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->has_value_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->tmp_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->eq_join_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->cond_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
bitmaps+= bitmap_size;
my_bitmap_init(&outparam->def_rpl_write_set,
- (my_bitmap_map*) bitmaps, share->fields, FALSE);
+ (my_bitmap_map*) bitmaps, share->fields);
outparam->default_column_bitmaps();
outparam->cond_selectivity= 1.0;
@@ -9279,6 +9277,62 @@ bool TABLE::validate_default_values_of_unset_fields(THD *thd) const
}
+/*
+ Check assignment compatibility of a value list against an explicitly
+ specified field list, e.g.
+ INSERT INTO t1 (a,b) VALUES (1,2);
+*/
+bool TABLE::check_assignability_explicit_fields(List<Item> fields,
+ List<Item> values,
+ bool ignore)
+{
+ DBUG_ENTER("TABLE::check_assignability_explicit_fields");
+ DBUG_ASSERT(fields.elements == values.elements);
+
+ List_iterator<Item> fi(fields);
+ List_iterator<Item> vi(values);
+ Item *f, *value;
+ while ((f= fi++) && (value= vi++))
+ {
+ Item_field *item_field= f->field_for_view_update();
+ if (!item_field)
+ {
+ /*
+ A non-updatable field of a view found.
+ This scenario is caught later and an error is raised.
+ We could eventually move error reporting here. For now just continue.
+ */
+ continue;
+ }
+ if (value->check_assignability_to(item_field->field, ignore))
+ DBUG_RETURN(true);
+ }
+ DBUG_RETURN(false);
+}
+
+
+/*
+ Check assignment compatibility for a value list against
+ all visible fields of the table, e.g.
+ INSERT INTO t1 VALUES (1,2);
+*/
+bool TABLE::check_assignability_all_visible_fields(List<Item> &values,
+ bool ignore) const
+{
+ DBUG_ENTER("TABLE::check_assignability_all_visible_fields");
+ DBUG_ASSERT(s->visible_fields == values.elements);
+
+ List_iterator<Item> vi(values);
+ for (uint i= 0; i < s->fields; i++)
+ {
+ if (!field[i]->invisible &&
+ (vi++)->check_assignability_to(field[i], ignore))
+ DBUG_RETURN(true);
+ }
+ DBUG_RETURN(false);
+}
+
+
bool TABLE::insert_all_rows_into_tmp_table(THD *thd,
TABLE *tmp_table,
TMP_TABLE_PARAM *tmp_table_param,
@@ -9945,6 +9999,9 @@ bool TR_table::update(ulonglong start_id, ulonglong end_id)
int error= table->file->ha_write_row(table->record[0]);
if (unlikely(error))
table->file->print_error(error, MYF(0));
+ /* extra() is used to apply the bulk insert operation
+ on mysql/transaction_registry table */
+ table->file->extra(HA_EXTRA_IGNORE_INSERT);
return error;
}
diff --git a/sql/table.h b/sql/table.h
index dcef7769b6b..dbc3d6127ba 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1701,6 +1701,30 @@ public:
Field **field_to_fill();
bool validate_default_values_of_unset_fields(THD *thd) const;
+ // Check if the value list is assignable to the explicit field list
+ static bool check_assignability_explicit_fields(List<Item> fields,
+ List<Item> values,
+ bool ignore);
+ // Check if the value list is assignable to all visible fields
+ bool check_assignability_all_visible_fields(List<Item> &values,
+ bool ignore) const;
+ /*
+ Check if the value list is assignable to:
+ - The explicit field list if fields.elements > 0, e.g.
+ INSERT INTO t1 (a,b) VALUES (1,2);
+ - All visible fields, if fields.elements==0, e.g.
+ INSERT INTO t1 VALUES (1,2);
+ */
+ bool check_assignability_opt_fields(List<Item> fields,
+ List<Item> values,
+ bool ignore) const
+ {
+ DBUG_ASSERT(values.elements);
+ return fields.elements ?
+ check_assignability_explicit_fields(fields, values, ignore) :
+ check_assignability_all_visible_fields(values, ignore);
+ }
+
bool insert_all_rows_into_tmp_table(THD *thd,
TABLE *tmp_table,
TMP_TABLE_PARAM *tmp_table_param,
diff --git a/sql/thread_pool_info.cc b/sql/thread_pool_info.cc
index 90ac6871784..e3ffd160a11 100644
--- a/sql/thread_pool_info.cc
+++ b/sql/thread_pool_info.cc
@@ -14,9 +14,9 @@ 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 <mysql/plugin.h>
#include <sql_class.h>
#include <sql_i_s.h>
#include <mysql/plugin.h>
diff --git a/sql/tztime.cc b/sql/tztime.cc
index dc148d3bf4c..4934531c985 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2517,7 +2517,7 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
{
MY_DIR *cur_dir;
char *name_end_tmp;
- uint i;
+ size_t i;
/* Sort directory data, to pass mtr tests on different platforms. */
if (!(cur_dir= my_dir(fullname, MYF(MY_WANT_STAT|MY_WANT_SORT))))
diff --git a/sql/uniques.cc b/sql/uniques.cc
index a0cebe3e4dd..572d80f0b64 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -709,7 +709,7 @@ bool Unique::merge(TABLE *table, uchar *buff, size_t buff_size,
{
IO_CACHE *outfile= &sort.io_cache;
Merge_chunk *file_ptr= (Merge_chunk*) file_ptrs.buffer;
- uint maxbuffer= file_ptrs.elements - 1;
+ uint maxbuffer= (uint)file_ptrs.elements - 1;
my_off_t save_pos;
bool error= 1;
Sort_param sort_param;
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 7d684cef35d..3dd7a6ef9d4 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -90,7 +90,6 @@ my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after du
my_bool wsrep_certify_nonPK; // Certify, even when no primary key
ulong wsrep_certification_rules = WSREP_CERTIFICATION_RULES_STRICT;
my_bool wsrep_recovery; // Recovery
-my_bool wsrep_replicate_myisam; // Enable MyISAM replication
my_bool wsrep_log_conflicts;
my_bool wsrep_load_data_splitting= 0; // Commit load data every 10K intervals
my_bool wsrep_slave_UK_checks; // Slave thread does UK checks
@@ -100,9 +99,6 @@ my_bool wsrep_restart_slave; // Should mysql slave thread be
my_bool wsrep_desync; // De(re)synchronize the node from the
// cluster
ulonglong wsrep_mode;
-my_bool wsrep_strict_ddl; // Deprecated: Reject DDL to
- // effected tables not
- // supporting Galera replication
bool wsrep_service_started; // If Galera was initialized
long wsrep_slave_threads; // No. of slave appliers threads
ulong wsrep_retry_autocommit; // Retry aborted autocommit trx
@@ -1697,6 +1693,7 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
{
bool fail= false;
TABLE_LIST *table;
+ TABLE_LIST *table_last_in_list;
for (table= tables; table; table= table->next_local)
{
@@ -1712,6 +1709,12 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
uint counter;
MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ for (table_last_in_list= tables;;table_last_in_list= table_last_in_list->next_local) {
+ if (!table_last_in_list->next_local) {
+ break;
+ }
+ }
+
if (open_tables(thd, &tables, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
{
WSREP_DEBUG("Unable to open table for FK checks for %s", wsrep_thd_query(thd));
@@ -1742,11 +1745,19 @@ exit:
/* close the table and release MDL locks */
close_thread_tables(thd);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+ bool invalidate_next_global= false;
for (table= tables; table; table= table->next_local)
{
table->table= NULL;
- table->next_global= NULL;
table->mdl_request.ticket= NULL;
+ // We should invalidate `next_global` only for entries that are added
+ // in this function
+ if (table == table_last_in_list) {
+ invalidate_next_global= true;
+ }
+ if (invalidate_next_global) {
+ table->next_global= NULL;
+ }
}
return fail;
@@ -2655,6 +2666,8 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
}
thd_proc_info(thd, "acquiring total order isolation");
+ WSREP_DEBUG("wsrep_TOI_begin for %s", wsrep_thd_query(thd));
+ THD_STAGE_INFO(thd, stage_waiting_isolation);
wsrep::client_state& cs(thd->wsrep_cs());
@@ -3003,39 +3016,49 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
const MDL_ticket *ticket,
const MDL_key *key)
{
- /* Fallback to the non-wsrep behaviour */
- if (!WSREP_ON) return;
-
THD *request_thd= requestor_ctx->get_thd();
THD *granted_thd= ticket->get_ctx()->get_thd();
+ /* Fallback to the non-wsrep behaviour */
+ if (!WSREP(request_thd)) return;
+
const char* schema= key->db_name();
int schema_len= key->db_name_length();
mysql_mutex_lock(&request_thd->LOCK_thd_data);
- if (wsrep_thd_is_toi(request_thd) ||
- wsrep_thd_is_applying(request_thd)) {
+ if (wsrep_thd_is_toi(request_thd) ||
+ wsrep_thd_is_applying(request_thd))
+ {
+ WSREP_DEBUG("wsrep_handle_mdl_conflict request TOI/APPLY for %s",
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_isolation);
mysql_mutex_unlock(&request_thd->LOCK_thd_data);
WSREP_MDL_LOG(DEBUG, "MDL conflict ", schema, schema_len,
request_thd, granted_thd);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_lock(&granted_thd->LOCK_thd_data);
+
if (wsrep_thd_is_toi(granted_thd) ||
wsrep_thd_is_applying(granted_thd))
{
if (wsrep_thd_is_aborting(granted_thd))
{
- WSREP_DEBUG("BF thread waiting for SR in aborting state");
+ WSREP_DEBUG("BF thread waiting for SR in aborting state for %s",
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_isolation);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
}
else if (wsrep_thd_is_SR(granted_thd) && !wsrep_thd_is_SR(request_thd))
{
- WSREP_MDL_LOG(INFO, "MDL conflict, DDL vs SR",
+ WSREP_MDL_LOG(INFO, "MDL conflict, DDL vs SR",
schema, schema_len, request_thd, granted_thd);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+ WSREP_DEBUG("wsrep_handle_mdl_conflict DDL vs SR for %s",
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_isolation);
wsrep_abort_thd(request_thd, granted_thd, 1);
}
else
@@ -3050,14 +3073,18 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
else if (granted_thd->lex->sql_command == SQLCOM_FLUSH ||
granted_thd->mdl_context.has_explicit_locks())
{
- WSREP_DEBUG("BF thread waiting for FLUSH");
+ WSREP_DEBUG("BF thread waiting for FLUSH for %s",
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_ddl);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
}
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
{
- WSREP_DEBUG("DROP caused BF abort, conf %s",
- wsrep_thd_transaction_state_str(granted_thd));
+ WSREP_DEBUG("DROP caused BF abort, conf %s for %s",
+ wsrep_thd_transaction_state_str(granted_thd),
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_isolation);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
wsrep_abort_thd(request_thd, granted_thd, 1);
@@ -3066,7 +3093,11 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
{
WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", schema, schema_len,
request_thd, granted_thd);
+ WSREP_DEBUG("wsrep_handle_mdl_conflict -> BF abort for %s",
+ wsrep_thd_query(request_thd));
+ THD_STAGE_INFO(request_thd, stage_waiting_isolation);
ticket->wsrep_report(wsrep_debug);
+
if (granted_thd->wsrep_trx().active())
{
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
@@ -3079,14 +3110,16 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
thd is BF, BF abort and wait.
*/
mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+
if (wsrep_thd_is_BF(request_thd, FALSE))
{
ha_abort_transaction(request_thd, granted_thd, TRUE);
}
else
{
- WSREP_MDL_LOG(INFO, "MDL unknown BF-BF conflict", schema, schema_len,
- request_thd, granted_thd);
+ WSREP_MDL_LOG(INFO, "MDL unknown BF-BF conflict",
+ schema, schema_len,
+ request_thd, granted_thd);
ticket->wsrep_report(true);
unireg_abort(1);
}
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 6f9a2d127b4..412b9242d77 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -72,7 +72,6 @@ extern long int wsrep_protocol_version;
extern my_bool wsrep_desync;
extern ulong wsrep_reject_queries;
extern my_bool wsrep_recovery;
-extern my_bool wsrep_replicate_myisam;
extern my_bool wsrep_log_conflicts;
extern ulong wsrep_mysql_replication_bundle;
extern my_bool wsrep_load_data_splitting;
@@ -91,7 +90,6 @@ extern bool wsrep_gtid_mode;
extern uint32 wsrep_gtid_domain_id;
extern std::atomic <bool > wsrep_thread_create_failed;
extern ulonglong wsrep_mode;
-extern my_bool wsrep_strict_ddl;
enum enum_wsrep_reject_types {
WSREP_REJECT_NONE, /* nothing rejected */
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index 3c5cff2b741..360b327d7ea 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -276,12 +276,14 @@ static inline int wsrep_before_commit(THD* thd, bool all)
WSREP_DEBUG("wsrep_before_commit: %d, %lld",
wsrep_is_real(thd, all),
(long long)wsrep_thd_trx_seqno(thd));
+ THD_STAGE_INFO(thd, stage_waiting_certification);
int ret= 0;
DBUG_ASSERT(wsrep_run_commit_hook(thd, all));
+
if ((ret= thd->wsrep_cs().before_commit()) == 0)
{
DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined());
- if (!thd->variables.gtid_seq_no &&
+ if (!thd->variables.gtid_seq_no &&
(thd->wsrep_trx().ws_meta().flags() & wsrep::provider::flag::commit))
{
uint64 seqno= 0;
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 5ec32d63626..0de1b034953 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -854,10 +854,11 @@ bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
return true;
}
} else {
+ THD_STAGE_INFO(thd, stage_waiting_flow);
ret= Wsrep_server_state::instance().provider().resync();
if (ret != WSREP_OK) {
WSREP_WARN ("SET resync failed %d for schema: %s, query: %s", ret,
- thd->get_db(), thd->query());
+ thd->get_db(), wsrep_thd_query(thd));
my_error (ER_CANNOT_USER, MYF(0), "'resync'", thd->query());
return true;
}
@@ -1118,24 +1119,3 @@ bool wsrep_gtid_domain_id_update(sys_var* self, THD *thd, enum_var_type)
return false;
}
-bool wsrep_strict_ddl_update(sys_var *self, THD* thd, enum_var_type var_type)
-{
- // In case user still sets wsrep_strict_ddl we set new
- // option to wsrep_mode
- if (wsrep_strict_ddl)
- wsrep_mode|= WSREP_MODE_STRICT_REPLICATION;
- else
- wsrep_mode&= (~WSREP_MODE_STRICT_REPLICATION);
- return false;
-}
-
-bool wsrep_replicate_myisam_update(sys_var *self, THD* thd, enum_var_type var_type)
-{
- // In case user still sets wsrep_replicate_myisam we set new
- // option to wsrep_mode
- if (wsrep_replicate_myisam)
- wsrep_mode|= WSREP_MODE_REPLICATE_MYISAM;
- else
- wsrep_mode&= (~WSREP_MODE_REPLICATE_MYISAM);
- return false;
-}
diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h
index 7908e873795..0f811d70928 100644
--- a/sql/wsrep_var.h
+++ b/sql/wsrep_var.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2021 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
@@ -109,8 +109,6 @@ extern bool wsrep_gtid_seq_no_check CHECK_ARGS;
extern bool wsrep_gtid_domain_id_update UPDATE_ARGS;
extern bool wsrep_mode_check CHECK_ARGS;
-extern bool wsrep_strict_ddl_update UPDATE_ARGS;
-extern bool wsrep_replicate_myisam_update UPDATE_ARGS;
#else /* WITH_WSREP */
#define wsrep_provider_init(X)
diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt
index 6669862f038..ebb138c70f0 100644
--- a/storage/columnstore/CMakeLists.txt
+++ b/storage/columnstore/CMakeLists.txt
@@ -5,6 +5,10 @@ if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}")
endif()
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
+IF(NOT PLUGIN_PERFSCHEMA STREQUAL NO)
+ add_definitions(-DHAVE_PSI_INTERFACE=)
+ENDIF()
+
# this does everything, gets the var from the correct scope, appends new
# values, sets in the correct scope
@@ -13,6 +17,11 @@ macro(APPEND_FOR_CPACK V)
set(${V} "${var}${ARGN}" PARENT_SCOPE)
endmacro()
+# don't use compression providers, there are standalone executables below
+GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp
index 618c0168470..d2ddfc5f489 100644
--- a/storage/connect/bsonudf.cpp
+++ b/storage/connect/bsonudf.cpp
@@ -9,6 +9,7 @@
/*********************************************************************************/
#include <my_global.h>
#include <mysqld.h>
+#include <mysqld_error.h>
#include <mysql.h>
#include <sql_error.h>
#include <stdio.h>
@@ -22,7 +23,7 @@
#define MEMFIX 4096
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 7be82db2e30..6d180ac5441 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -516,7 +516,7 @@ void SetWorkSize(size_t)
{
// Changing the session variable value seems to be impossible here
// and should be done in a check function
- push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Work size too big, try setting a smaller value");
} // end of SetWorkSize
@@ -715,7 +715,7 @@ void PushWarning(PGLOBAL g, THD *thd, int level)
Sql_condition::enum_warning_level wlvl;
wlvl= (Sql_condition::enum_warning_level)level;
- push_warning(thd, wlvl, 0, g->Message);
+ push_warning(thd, wlvl, ER_UNKNOWN_ERROR, g->Message);
} else
htrc("%s\n", g->Message);
@@ -2295,7 +2295,7 @@ int ha_connect::MakeRecord(char *buf)
fp->field_name.str,
thd->get_stmt_da()->current_row_for_warning());
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, buf);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
DBUG_PRINT("MakeRecord", ("%s", buf));
rc= 0;
} else if (rc < 0)
@@ -3598,7 +3598,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
if ((rc= ((PTDBASE)tdbp)->ResetTableOpt(g, dop, dox))) {
if (rc == RC_INFO) {
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} else
rc= HA_ERR_CRASHED_ON_USAGE; // Table must be repaired
@@ -4823,7 +4823,7 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
if (newmode == MODE_ANY) {
if (CloseTable(g)) {
// Make error a warning to avoid crash
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Close
@@ -4905,18 +4905,18 @@ int ha_connect::external_lock(THD *thd, int lock_type)
&& sqlcom != SQLCOM_BEGIN
&& sqlcom != SQLCOM_DROP_TABLE) {
snprintf(g->Message, sizeof(g->Message), "external_lock: unexpected command %d", sqlcom);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (g->Xchk) {
if (!tdbp) {
if (!(tdbp= GetTDB(g))) {
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (!tdbp->GetDef()->Indexable()) {
snprintf(g->Message, sizeof(g->Message), "external_lock: Table %s is not indexable", tdbp->GetName());
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (tdbp->GetDef()->Indexable() == 1) {
bool oldsep= ((PCHK)g->Xchk)->oldsep;
@@ -4995,7 +4995,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (tdp->MakeIndex(g, adp, true) == RC_FX) {
// Make it a warning to avoid crash
//push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- // 0, g->Message);
+ // ER_UNKNOWN_ERROR, g->Message);
//rc= 0;
my_message(ER_TOO_MANY_KEYS, g->Message, MYF(0));
rc= HA_ERR_INDEX_CORRUPT;
@@ -5005,7 +5005,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (CheckVirtualIndex(NULL)) {
// Make it a warning to avoid crash
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- 0, g->Message);
+ ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Check
@@ -5018,7 +5018,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (CloseTable(g)) {
// This is an error while builing index
// Make it a warning to avoid crash
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Close
@@ -5729,7 +5729,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS";
ttp= GetTypeID(topt->type);
snprintf(g->Message, sizeof(g->Message), "No table_type. Was set to %s", topt->type);
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} else if (ttp == TAB_NIY) {
snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", topt->type);
rc= HA_ERR_INTERNAL_ERROR;
@@ -5739,7 +5739,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if (ttp == TAB_UNDEF) {
ttr= TAB_JSON;
strcpy(g->Message, "No table_type. Was set to JSON");
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} else
ttr= ttp;
@@ -6302,7 +6302,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)",
cnm, typ);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} else {
snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ);
@@ -6317,7 +6317,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TYPE_STRING:
if (w) {
snprintf(g->Message, sizeof(g->Message), "Column %s is wide characters", cnm);
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} // endif w
break;
@@ -6344,7 +6344,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)",
cnm, typ);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} else {
snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ);
@@ -6509,7 +6509,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
snprintf(g->Message, sizeof(g->Message), "No table_type. Will be set to %s", options->type);
if (sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (type == TAB_NIY) {
snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", options->type);
@@ -6558,7 +6558,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
case TAB_OCCUR:
if (options->srcdef) {
strcpy(g->Message, "Cannot check looping reference");
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (options->tabname) {
if (!stricmp(options->tabname, create_info->alias.str) &&
(!options->dbname ||
@@ -6854,7 +6854,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
snprintf(g->Message, sizeof(g->Message), "No file name. Table will use %s", buf);
if (sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
} // endif part_info
@@ -6867,12 +6867,12 @@ int ha_connect::create(const char *name, TABLE *table_arg,
else
snprintf(g->Message, sizeof(g->Message), "Error %d creating file %s", errno, fn);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else
::close(h);
if ((type == TAB_FMT || options->readonly) && sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Congratulation, you just created a read-only void table!");
} // endif sqlcom
@@ -6918,7 +6918,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
sqlcom == SQLCOM_CREATE_INDEX || sqlcom == SQLCOM_DROP_INDEX))
// (sqlcom == SQLCOM_CREATE_INDEX && part_info) ||
// (sqlcom == SQLCOM_DROP_INDEX && part_info)))
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Unexpected command in create, please contact CONNECT team");
if (part_info && !inward)
@@ -6929,7 +6929,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
(!IsFileType(type) || FileExists(options->filename, false))) {
if (part_info) {
snprintf(g->Message, sizeof(g->Message), "Data repartition in %s is unchecked", partname);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (sqlcom == SQLCOM_ALTER_TABLE) {
// This is an ALTER to CONNECT from another engine.
// It cannot be accepted because the table data would be modified
@@ -7042,7 +7042,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
char buf[_MAX_PATH + 20];
snprintf(buf, sizeof(buf), "Error %d for file %s", errno, filename);
- push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, 0, buf);
+ push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
return true;
} else
return false;
@@ -7345,7 +7345,7 @@ fin:
DBUG_RETURN(HA_ALTER_ERROR);
} else if (outward) {
if (IsFileType(type))
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"This is an outward table, table data were not modified.");
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
@@ -7371,7 +7371,7 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *, uint)
{
DBUG_ENTER("ha_connect::check_if_incompatible_data");
// TO DO: really implement and check it.
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Unexpected call to check_if_incompatible_data.");
DBUG_RETURN(COMPATIBLE_DATA_NO);
} // end of check_if_incompatible_data
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index b09838beb97..6f5b0883fe1 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -9,6 +9,7 @@
/*********************************************************************************/
#include <my_global.h>
#include <mysqld.h>
+#include <mysqld_error.h>
#include <mysql.h>
#include <sql_error.h>
#include <m_string.h>
@@ -21,7 +22,7 @@
#define MEMFIX 4096
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index c535c21f9da..b38168622e9 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -12,6 +12,7 @@
/***********************************************************************/
#include <my_global.h> // All MariaDB stuff
#include <mysqld.h>
+#include <mysqld_error.h>
#include <sql_error.h>
#if !defined(_WIN32) && !defined(_WINDOWS)
#include <sys/types.h>
@@ -37,7 +38,7 @@
#include "tabrest.h"
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index 02908927397..b2ec19ebfd5 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -205,7 +205,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
if (v == 'K') {
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type)", colname);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} // endif v
@@ -218,7 +218,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
len = zconv;
snprintf(g->Message, sizeof(g->Message), "Column %s converted to varchar(%d)",
colname, len);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} // endif v
crp = crp->Next; // Data_Type
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index ec569feec9d..e705ff0e7c0 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1559,6 +1559,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
current_position= next_position= 0;
/* Read the file row-by-row. If everything is ok, repair is not needed. */
+ thd_inc_error_row(thd);
while (!(rc= find_current_row(buf)))
{
thd_inc_error_row(thd);
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 8f2015070be..c66c33a7818 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -98,7 +98,7 @@
#pragma implementation // gcc: Class implementation
#endif
-#include <my_config.h>
+#include <my_global.h>
#include <mysql/plugin.h>
#include "ha_example.h"
#include "sql_class.h"
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 5cb8b7efa5b..fc32146b5cd 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -212,7 +212,7 @@ ulong federatedx_io_mysql::last_savepoint() const
ulong federatedx_io_mysql::actual_savepoint() const
{
SAVEPT *savept= NULL;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::last_savepoint");
while (index)
@@ -286,7 +286,7 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp)
ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
{
SAVEPT *savept;
- uint index;
+ size_t index;
DBUG_ENTER("federatedx_io_mysql::savepoint_release");
DBUG_PRINT("info",("savepoint=%lu", sp));
@@ -321,7 +321,7 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
void federatedx_io_mysql::savepoint_restrict(ulong sp)
{
SAVEPT *savept;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::savepoint_restrict");
while (index)
@@ -361,7 +361,7 @@ bool federatedx_io_mysql::test_all_restrict() const
{
bool result= FALSE;
SAVEPT *savept;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::test_all_restrict");
while (index)
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index d655cf81231..276c22234d6 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -20,19 +20,9 @@
INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCSourceRuns)
-INCLUDE(lz4.cmake)
-INCLUDE(lzo.cmake)
-INCLUDE(lzma.cmake)
-INCLUDE(bzip2.cmake)
-INCLUDE(snappy.cmake)
INCLUDE(numa)
INCLUDE(TestBigEndian)
-MYSQL_CHECK_LZ4()
-MYSQL_CHECK_LZO()
-MYSQL_CHECK_LZMA()
-MYSQL_CHECK_BZIP2()
-MYSQL_CHECK_SNAPPY()
MYSQL_CHECK_NUMA()
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 24de98f8590..3c2e97666cb 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -379,8 +379,8 @@ btr_root_adjust_on_import(
} else {
/* Check that the table flags and the tablespace
flags match. */
- ulint tf = dict_tf_to_fsp_flags(table->flags);
- ulint sf = table->space->flags;
+ uint32_t tf = dict_tf_to_fsp_flags(table->flags);
+ uint32_t sf = table->space->flags;
sf &= ~FSP_FLAGS_MEM_MASK;
tf &= ~FSP_FLAGS_MEM_MASK;
if (fil_space_t::is_flags_equal(tf, sf)
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index ac06d9b1568..013ea428e9a 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -6442,7 +6442,6 @@ btr_store_big_rec_extern_fields(
byte* field_ref;
ulint extern_len;
ulint store_len;
- ulint space_id;
ulint i;
mtr_t mtr;
mem_heap_t* heap = NULL;
@@ -6471,7 +6470,6 @@ btr_store_big_rec_extern_fields(
btr_blob_log_check_t redo_log(pcur, btr_mtr, offsets, &rec_block,
&rec, op);
page_zip = buf_block_get_page_zip(rec_block);
- space_id = rec_block->page.id().space();
if (page_zip) {
int err;
@@ -6595,6 +6593,7 @@ alloc_fail:
goto alloc_fail;
}
+ const uint32_t space_id = block->page.id().space();
const uint32_t page_no = block->page.id().page_no();
if (prev_page_no == FIL_NULL) {
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 81db2147fbb..c6b14d2fc67 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -563,15 +563,12 @@ bool buf_is_zeroes(span<const byte> buf)
}
/** Check if a page is corrupt.
-@param[in] check_lsn whether the LSN should be checked
-@param[in] read_buf database page
-@param[in] fsp_flags tablespace flags
+@param check_lsn whether FIL_PAGE_LSN should be checked
+@param read_buf database page
+@param fsp_flags contents of FIL_SPACE_FLAGS
@return whether the page is corrupted */
-bool
-buf_page_is_corrupted(
- bool check_lsn,
- const byte* read_buf,
- ulint fsp_flags)
+bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
+ uint32_t fsp_flags)
{
if (fil_space_t::full_crc32(fsp_flags)) {
bool compressed = false, corrupted = false;
@@ -4142,10 +4139,10 @@ buf_print_io(
/** Verify that post encryption checksum match with the calculated checksum.
This function should be called only if tablespace contains crypt data metadata.
-@param[in] page page frame
-@param[in] fsp_flags tablespace flags
-@return true if true if page is encrypted and OK, false otherwise */
-bool buf_page_verify_crypt_checksum(const byte* page, ulint fsp_flags)
+@param page page frame
+@param fsp_flags contents of FSP_SPACE_FLAGS
+@return whether the page is encrypted and valid */
+bool buf_page_verify_crypt_checksum(const byte *page, uint32_t fsp_flags)
{
if (!fil_space_t::full_crc32(fsp_flags)) {
return fil_space_verify_crypt_checksum(
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index c71fd8df068..88e5823e78b 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -363,7 +363,7 @@ void buf_dblwr_t::recover()
if (recv_sys.parse_start_lsn > lsn)
/* Pages written before the checkpoint are not useful for recovery. */
continue;
- const ulint space_id= page_get_space_id(page);
+ const uint32_t space_id= page_get_space_id(page);
const page_id_t page_id(space_id, page_no);
if (recv_sys.scanned_lsn < lsn)
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 05b18de1d5b..93298bc75b7 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -562,7 +562,7 @@ buf_load()
/* Avoid calling the expensive fil_space_t::get() for each
page within the same tablespace. dump[] is sorted by (space, page),
so all pages from a given tablespace are consecutive. */
- ulint cur_space_id = dump[0].space();
+ uint32_t cur_space_id = dump[0].space();
fil_space_t* space = fil_space_t::get(cur_space_id);
ulint zip_size = space ? space->zip_size() : 0;
@@ -574,10 +574,9 @@ buf_load()
for (i = 0; i < dump_n && !SHUTTING_DOWN(); i++) {
/* space_id for this iteration of the loop */
- const ulint this_space_id = dump[i].space();
+ const uint32_t this_space_id = dump[i].space();
- if (this_space_id == SRV_TMP_SPACE_ID) {
- /* Ignore the innodb_temporary tablespace. */
+ if (this_space_id >= SRV_SPACE_ID_UPPER_BOUND) {
continue;
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index cca921a9275..d6c1be59a86 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -40,11 +40,8 @@ Created 11/11/1995 Heikki Tuuri
#include "log0crypt.h"
#include "srv0mon.h"
#include "fil0pagecompress.h"
-#ifdef HAVE_LZO
-# include "lzo/lzo1x.h"
-#elif defined HAVE_SNAPPY
-# include "snappy-c.h"
-#endif
+#include "lzo/lzo1x.h"
+#include "snappy-c.h"
/** Number of pages flushed via LRU. Protected by buf_pool.mutex.
Also included in buf_flush_page_count. */
@@ -215,7 +212,7 @@ deleting the data file of that tablespace.
The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
@param id tablespace identifier */
-void buf_flush_remove_pages(ulint id)
+void buf_flush_remove_pages(uint32_t id)
{
const page_id_t first(id, 0), end(id + 1, 0);
ut_ad(id);
@@ -575,11 +572,10 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot)
/* Both Snappy and LZO compression methods require that the output
buffer be bigger than input buffer. Adjust the allocated size. */
ulint size= srv_page_size;
-#ifdef HAVE_LZO
- size= size + LZO1X_1_15_MEM_COMPRESS;
-#elif defined HAVE_SNAPPY
- size= snappy_max_compressed_length(size);
-#endif
+ if (provider_service_lzo->is_loaded)
+ size= LZO1X_1_15_MEM_COMPRESS;
+ else if (provider_service_snappy->is_loaded)
+ size= snappy_max_compressed_length(size);
slot->comp_buf= static_cast<byte*>(aligned_malloc(size, srv_page_size));
}
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 2f15fa62796..4a2ac88d97c 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -663,11 +663,9 @@ inline bool fil_space_t::is_freed(uint32_t page)
}
/** Issues read requests for pages which recovery wants to read in.
-@param[in] space_id tablespace id
-@param[in] page_nos array of page numbers to read, with the
-highest page number the last in the array
-@param[in] n number of page numbers in the array */
-void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
+@param space_id tablespace identifier
+@param page_nos page numbers to read, in ascending order */
+void buf_read_recv_pages(uint32_t space_id, st_::span<uint32_t> page_nos)
{
fil_space_t* space = fil_space_t::get(space_id);
@@ -678,7 +676,7 @@ void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
const ulint zip_size = space->zip_size();
- for (ulint i = 0; i < n; i++) {
+ for (ulint i = 0; i < page_nos.size(); i++) {
/* Ignore if the page already present in freed ranges. */
if (space->is_freed(page_nos[i])) {
@@ -720,7 +718,8 @@ void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
}
}
- DBUG_PRINT("ib_buf", ("recovery read (%u pages) for %s", n,
- space->chain.start->name));
+
+ DBUG_PRINT("ib_buf", ("recovery read (%zu pages) for %s",
+ page_nos.size(), space->chain.start->name));
space->release();
}
diff --git a/storage/innobase/bzip2.cmake b/storage/innobase/bzip2.cmake
deleted file mode 100644
index 91dd2bf0fcd..00000000000
--- a/storage/innobase/bzip2.cmake
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_BZIP2 AUTO CACHE STRING
- "Build with bzip2. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_BZIP2)
- IF (WITH_INNODB_BZIP2 STREQUAL "ON" OR WITH_INNODB_BZIP2 STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB2_H)
- CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffCompress "" HAVE_BZLIB2_COMPRESS)
- CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffDecompress "" HAVE_BZLIB2_DECOMPRESS)
-
- IF (HAVE_BZLIB2_COMPRESS AND HAVE_BZLIB2_DECOMPRESS AND HAVE_BZLIB2_H)
- SET(HAVE_INNODB_BZLIB2 TRUE)
- ADD_DEFINITIONS(-DHAVE_BZIP2=1)
- LINK_LIBRARIES(bz2)
- ELSE()
- IF (WITH_INNODB_BZIP2 STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required bzip2 library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_BZIP2 HAVE_INNODB_BZLIB2
- "BZIP2 compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index e57121041d5..5516bce920b 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -54,7 +54,7 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id) /*!< out: space id
+ uint32_t* space_id) /*!< out: space id
(not assigned if NULL) */
{
ib_id_t id;
@@ -257,8 +257,8 @@ dberr_t dict_boot()
header. */
dict_sys.recover_row_id(mach_read_from_8(dict_hdr + DICT_HDR_ROW_ID));
- if (ulint max_space_id = mach_read_from_4(dict_hdr
- + DICT_HDR_MAX_SPACE_ID)) {
+ if (uint32_t max_space_id
+ = mach_read_from_4(dict_hdr + DICT_HDR_MAX_SPACE_ID)) {
max_space_id--;
fil_assign_new_space_id(&max_space_id);
}
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index daf3bc9a664..5cf1f3521b1 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -348,8 +348,8 @@ dict_build_table_def_step(
dict_table_t* table = node->table;
ut_ad(!table->is_temporary());
ut_ad(!table->space);
- ut_ad(table->space_id == ULINT_UNDEFINED);
- dict_hdr_get_new_id(&table->id, NULL, NULL);
+ ut_ad(table->space_id == UINT32_MAX);
+ dict_hdr_get_new_id(&table->id, nullptr, nullptr);
/* Always set this bit for all new created tables */
DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME);
@@ -367,10 +367,10 @@ dict_build_table_def_step(
DBUG_EXECUTE_IF(
"ib_create_table_fail_out_of_space_ids",
- table->space_id = ULINT_UNDEFINED;
+ table->space_id = UINT32_MAX;
);
- if (table->space_id == ULINT_UNDEFINED) {
+ if (table->space_id == UINT32_MAX) {
return DB_ERROR;
}
} else {
@@ -1099,8 +1099,6 @@ dict_create_table_step(
}
if (node->state == TABLE_ADD_TO_CACHE) {
- DBUG_EXECUTE_IF("ib_ddl_crash_during_create", DBUG_SUICIDE(););
-
node->table->can_be_evicted = !node->table->fts;
node->table->add_to_cache();
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 21efb525fa8..e2fb4653852 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1079,8 +1079,18 @@ dict_table_open_on_name(
if (!(ignore_err & ~DICT_ERR_IGNORE_FK_NOKEY) &&
!table->is_readable() && table->corrupted)
{
- ib::error() << "Table " << table->name
- << " is corrupted. Please drop the table and recreate.";
+ ulint algo = table->space->get_compression_algo();
+ if (algo <= PAGE_ALGORITHM_LAST && !fil_comp_algo_loaded(algo)) {
+ my_printf_error(ER_PROVIDER_NOT_LOADED,
+ "Table %s is compressed with %s, which is not currently loaded. "
+ "Please load the %s provider plugin to open the table",
+ MYF(ME_ERROR_LOG), table->name,
+ page_compression_algorithms[algo], page_compression_algorithms[algo]);
+ } else {
+ my_printf_error(ER_TABLE_CORRUPT,
+ "Table %s is corrupted. Please drop the table and recreate.",
+ MYF(ME_ERROR_LOG), table->name);
+ }
dict_sys.unfreeze();
DBUG_RETURN(nullptr);
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 004b00615e8..010242c8872 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -613,11 +613,10 @@ dict_sys_tables_type_valid(ulint type, bool not_redundant)
@param[in] not_redundant whether ROW_FORMAT=REDUNDANT is not used
@return table flags */
static
-ulint
-dict_sys_tables_type_to_tf(ulint type, bool not_redundant)
+uint32_t dict_sys_tables_type_to_tf(uint32_t type, bool not_redundant)
{
ut_ad(dict_sys_tables_type_valid(type, not_redundant));
- ulint flags = not_redundant ? 1 : 0;
+ uint32_t flags = not_redundant ? 1 : 0;
/* ZIP_SSIZE, ATOMIC_BLOBS, DATA_DIR, PAGE_COMPRESSION,
PAGE_COMPRESSION_LEVEL are the same. */
@@ -655,15 +654,14 @@ dict_sys_tables_rec_read(
bool uncommitted,
mtr_t* mtr,
table_id_t* table_id,
- ulint* space_id,
- ulint* n_cols,
- ulint* flags,
- ulint* flags2,
+ uint32_t* space_id,
+ uint32_t* n_cols,
+ uint32_t* flags,
+ uint32_t* flags2,
trx_id_t* trx_id)
{
const byte* field;
ulint len;
- ulint type;
mem_heap_t* heap = nullptr;
field = rec_get_nth_field_old(
@@ -721,7 +719,7 @@ dict_sys_tables_rec_read(
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_TABLES__TYPE, &len);
ut_a(len == 4);
- type = mach_read_from_4(field);
+ uint32_t type = mach_read_from_4(field);
/* Handle MDEV-12873 InnoDB SYS_TABLES.TYPE incompatibility
for PAGE_COMPRESSED=YES in MariaDB 10.2.2 to 10.2.6.
@@ -812,8 +810,8 @@ dict_sys_tables_rec_read(
if (!dict_sys_tables_type_valid(type, not_redundant)) {
sql_print_error("InnoDB: Table %.*s in InnoDB"
" data dictionary contains invalid flags."
- " SYS_TABLES.TYPE=" ULINTPF
- " SYS_TABLES.N_COLS=" ULINTPF,
+ " SYS_TABLES.TYPE=" UINT32PF
+ " SYS_TABLES.N_COLS=" UINT32PF,
int(rec_get_field_start_offs(rec, 1)), rec,
type, *n_cols);
err_exit:
@@ -843,8 +841,8 @@ err_exit:
sql_print_error("InnoDB: Table %.*s in InnoDB"
" data dictionary"
" contains invalid flags."
- " SYS_TABLES.TYPE=" ULINTPF
- " SYS_TABLES.MIX_LEN=" ULINTPF,
+ " SYS_TABLES.TYPE=" UINT32PF
+ " SYS_TABLES.MIX_LEN=" UINT32PF,
int(rec_get_field_start_offs(rec, 1)),
rec,
type, *flags2);
@@ -880,7 +878,7 @@ was needed and force_recovery is not set.
We also scan the biggest space id, and store it to fil_system. */
void dict_check_tablespaces_and_store_max_id()
{
- ulint max_space_id = 0;
+ uint32_t max_space_id = 0;
btr_pcur_t pcur;
mtr_t mtr;
@@ -895,10 +893,10 @@ void dict_check_tablespaces_and_store_max_id()
rec; rec = dict_getnext_system_low(&pcur, &mtr)) {
ulint len;
table_id_t table_id;
- ulint space_id;
- ulint n_cols;
- ulint flags;
- ulint flags2;
+ uint32_t space_id;
+ uint32_t n_cols;
+ uint32_t flags;
+ uint32_t flags2;
/* If a table record is not useable, ignore it and continue
on to the next record. Error messages were logged. */
@@ -2165,13 +2163,9 @@ const char *dict_load_table_low(mtr_t *mtr, bool uncommitted,
const rec_t *rec, dict_table_t **table)
{
table_id_t table_id;
- ulint space_id;
- ulint n_cols;
- ulint t_num;
- ulint flags;
- ulint flags2;
+ uint32_t space_id, t_num, flags, flags2;
+ ulint n_cols, n_v_col;
trx_id_t trx_id;
- ulint n_v_col;
if (const char* error_text = dict_sys_tables_rec_check(rec)) {
*table = NULL;
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 54eaa87a850..0da0c5acf0f 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -162,7 +162,7 @@ dict_table_t *dict_table_t::create(const span<const char> &name,
table->mdl_name.m_name= table->name.m_name;
table->is_system_db= dict_mem_table_is_system(table->name.m_name);
table->space= space;
- table->space_id= space ? space->id : ULINT_UNDEFINED;
+ table->space_id= space ? space->id : UINT32_MAX;
table->n_t_cols= static_cast<unsigned>(n_cols + DATA_N_SYS_COLS) &
dict_index_t::MAX_N_FIELDS;
table->n_v_cols= static_cast<unsigned>(n_v_cols) &
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index afc38654f55..ba277ca67e9 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -3427,6 +3427,11 @@ unlocked_free_and_exit:
}
}
+ ret= trx->bulk_insert_apply();
+ if (ret != DB_SUCCESS) {
+ goto rollback_and_exit;
+ }
+
trx->commit();
goto free_and_exit;
}
@@ -4028,6 +4033,13 @@ dict_stats_update(
return(DB_SUCCESS);
}
+ if (trx_id_t bulk_trx_id = table->bulk_trx_id) {
+ if (trx_sys.find(nullptr, bulk_trx_id, false)) {
+ dict_stats_empty_table(table, false);
+ return DB_SUCCESS_LOCKED_REC;
+ }
+ }
+
switch (stats_upd_option) {
case DICT_STATS_RECALC_PERSISTENT:
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 7410986c441..b1c4c217c3d 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -744,20 +744,20 @@ static dberr_t fil_space_decrypt_for_non_full_checksum(
/** Decrypt a page.
@param[in] space_id tablespace id
+@param[in] fsp_flags Tablespace flags
@param[in] crypt_data crypt_data
@param[in] tmp_frame Temporary buffer
@param[in] physical_size page size
-@param[in] fsp_flags Tablespace flags
@param[in,out] src_frame Page to decrypt
@retval DB_SUCCESS on success
@retval DB_DECRYPTION_FAILED on error */
dberr_t
fil_space_decrypt(
- ulint space_id,
+ uint32_t space_id,
+ uint32_t fsp_flags,
fil_space_crypt_t* crypt_data,
byte* tmp_frame,
ulint physical_size,
- ulint fsp_flags,
byte* src_frame)
{
if (!crypt_data || !crypt_data->is_encrypted()) {
@@ -792,9 +792,10 @@ fil_space_decrypt(
ut_ad(space->referenced());
- if (DB_SUCCESS != fil_space_decrypt(space->id, space->crypt_data,
+ if (DB_SUCCESS != fil_space_decrypt(space->id, space->flags,
+ space->crypt_data,
tmp_frame, physical_size,
- space->flags, src_frame)) {
+ src_frame)) {
return nullptr;
}
@@ -1365,7 +1366,7 @@ inline fil_space_t *fil_system_t::default_encrypt_next(fil_space_t *space,
mysql_mutex_assert_owner(&mutex);
auto it= space && space->is_in_default_encrypt
- ? sized_ilist<fil_space_t, rotation_list_tag_t>::iterator(space)
+ ? sized_ilist<fil_space_t, default_encrypt_tag_t>::iterator(space)
: default_encrypt_tables.begin();
const auto end= default_encrypt_tables.end();
@@ -1854,7 +1855,7 @@ fil_crypt_rotate_pages(
const key_state_t* key_state,
rotate_thread_t* state)
{
- ulint space_id = state->space->id;
+ const uint32_t space_id = state->space->id;
uint32_t end = std::min(state->offset + uint32_t(state->batch),
state->space->free_limit);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 89af4e2420f..66b21f6ecbd 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -54,21 +54,18 @@ Created 10/25/1995 Heikki Tuuri
# include <dirent.h>
#endif
+#include "lz4.h"
+#include "lzo/lzo1x.h"
+#include "lzma.h"
+#include "bzlib.h"
+#include "snappy-c.h"
+
ATTRIBUTE_COLD void fil_space_t::set_corrupted() const
{
if (!is_stopping() && !is_corrupted.test_and_set())
sql_print_error("InnoDB: File '%s' is corrupted", chain.start->name);
}
-/** Determine if the space id is a user tablespace id or not.
-@param space_id tablespace identifier
-@return true if it is a user tablespace ID */
-inline bool fil_is_user_tablespace_id(ulint space_id)
-{
- return space_id != TRX_SYS_SPACE && space_id != SRV_TMP_SPACE_ID &&
- !srv_is_undo_tablespace(space_id);
-}
-
/** Try to close a file to adhere to the innodb_open_files limit.
@param print_info whether to diagnose why a file cannot be closed
@return whether a file was closed */
@@ -83,7 +80,7 @@ bool fil_space_t::try_to_close(bool print_info)
case FIL_TYPE_IMPORT:
break;
case FIL_TYPE_TABLESPACE:
- if (!fil_is_user_tablespace_id(space.id))
+ if (is_predefined_tablespace(space.id))
continue;
}
@@ -214,14 +211,11 @@ fil_validate_skip(void)
}
#endif /* UNIV_DEBUG */
-/*******************************************************************//**
-Returns the table space by a given id, NULL if not found.
-It is unsafe to dereference the returned pointer. It is fine to check
-for NULL. */
-fil_space_t*
-fil_space_get_by_id(
-/*================*/
- ulint id) /*!< in: space id */
+/** Look up a tablespace.
+@param tablespace identifier
+@return tablespace
+@retval nullptr if not found */
+fil_space_t *fil_space_get_by_id(uint32_t id)
{
fil_space_t* space;
@@ -242,48 +236,38 @@ or the caller should be in single-threaded crash recovery mode
Normally, fil_space_t::get() should be used instead.
@param[in] id tablespace ID
@return tablespace, or NULL if not found */
-fil_space_t*
-fil_space_get(
- ulint id)
+fil_space_t *fil_space_get(uint32_t id)
{
- mysql_mutex_lock(&fil_system.mutex);
- fil_space_t* space = fil_space_get_by_id(id);
- mysql_mutex_unlock(&fil_system.mutex);
- return(space);
+ mysql_mutex_lock(&fil_system.mutex);
+ fil_space_t *space= fil_space_get_by_id(id);
+ mysql_mutex_unlock(&fil_system.mutex);
+ return space;
}
-/** Validate the compression algorithm for full crc32 format.
-@param[in] space tablespace object
-@return whether the compression algorithm support */
-static bool fil_comp_algo_validate(const fil_space_t* space)
+/** Check if the compression algorithm is loaded
+@param[in] comp_algo ulint compression algorithm
+@return whether the compression algorithm is loaded */
+bool fil_comp_algo_loaded(ulint comp_algo)
{
- if (!space->full_crc32()) {
- return true;
- }
-
- DBUG_EXECUTE_IF("fil_comp_algo_validate_fail",
- return false;);
-
- ulint comp_algo = space->get_compression_algo();
switch (comp_algo) {
case PAGE_UNCOMPRESSED:
case PAGE_ZLIB_ALGORITHM:
-#ifdef HAVE_LZ4
+ return true;
+
case PAGE_LZ4_ALGORITHM:
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+ return provider_service_lz4->is_loaded;
+
case PAGE_LZO_ALGORITHM:
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+ return provider_service_lzo->is_loaded;
+
case PAGE_LZMA_ALGORITHM:
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
+ return provider_service_lzma->is_loaded;
+
case PAGE_BZIP2_ALGORITHM:
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
+ return provider_service_bzip2->is_loaded;
+
case PAGE_SNAPPY_ALGORITHM:
-#endif /* HAVE_SNAPPY */
- return true;
+ return provider_service_snappy->is_loaded;
}
return false;
@@ -382,9 +366,26 @@ static bool fil_node_open_file_low(fil_node_t *node)
return false;
}
+ ulint comp_algo = node->space->get_compression_algo();
+ bool comp_algo_invalid = false;
+
if (node->size);
- else if (!node->read_page0() || !fil_comp_algo_validate(node->space))
+ else if (!node->read_page0() ||
+ // validate compression algorithm for full crc32 format
+ (node->space->full_crc32() &&
+ (comp_algo_invalid = !fil_comp_algo_loaded(comp_algo))))
{
+ if (comp_algo_invalid)
+ {
+ if (comp_algo <= PAGE_ALGORITHM_LAST)
+ ib::warn() << "'" << node->name << "' is compressed with "
+ << page_compression_algorithms[comp_algo]
+ << ", which is not currently loaded";
+ else
+ ib::warn() << "'" << node->name << "' is compressed with "
+ << "invalid algorithm: " << comp_algo;
+ }
+
os_file_close(node->handle);
node->handle= OS_FILE_CLOSED;
return false;
@@ -411,7 +412,7 @@ static bool fil_node_open_file(fil_node_t *node)
{
mysql_mutex_assert_owner(&fil_system.mutex);
ut_ad(!node->is_open());
- ut_ad(fil_is_user_tablespace_id(node->space->id) ||
+ ut_ad(!is_predefined_tablespace(node->space->id) ||
srv_operation == SRV_OPERATION_BACKUP ||
srv_operation == SRV_OPERATION_RESTORE ||
srv_operation == SRV_OPERATION_RESTORE_DELTA);
@@ -861,13 +862,10 @@ fil_space_free_low(
/** Frees a space object from the tablespace memory cache.
Closes the files in the chain but does not delete them.
There must not be any pending i/o's or flushes on the files.
-@param[in] id tablespace identifier
-@param[in] x_latched whether the caller holds X-mode space->latch
+@param id tablespace identifier
+@param x_latched whether the caller holds exclusive fil_space_t::latch
@return true if success */
-bool
-fil_space_free(
- ulint id,
- bool x_latched)
+bool fil_space_free(uint32_t id, bool x_latched)
{
ut_ad(id != TRX_SYS_SPACE);
@@ -915,7 +913,7 @@ fil_space_free(
@param mode encryption mode
@return pointer to created tablespace, to be filled in with add()
@retval nullptr on failure (such as when the same tablespace exists) */
-fil_space_t *fil_space_t::create(ulint id, ulint flags,
+fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags,
fil_type_t purpose,
fil_space_crypt_t *crypt_data,
fil_encryption_t mode)
@@ -1023,18 +1021,13 @@ Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
@return true if assigned, false if not */
-bool
-fil_assign_new_space_id(
-/*====================*/
- ulint* space_id) /*!< in/out: space id */
+bool fil_assign_new_space_id(uint32_t *space_id)
{
- ulint id;
+ uint32_t id = *space_id;
bool success;
mysql_mutex_lock(&fil_system.mutex);
- id = *space_id;
-
if (id < fil_system.max_assigned_id) {
id = fil_system.max_assigned_id;
}
@@ -1060,7 +1053,7 @@ fil_assign_new_space_id(
<< ". To reset the counter to zero"
" you have to dump all your tables and"
" recreate the whole InnoDB installation.";
- *space_id = ULINT_UNDEFINED;
+ *space_id = UINT32_MAX;
}
mysql_mutex_unlock(&fil_system.mutex);
@@ -1093,7 +1086,7 @@ bool fil_space_t::read_page0()
}
/** Look up a tablespace and ensure that its first page has been validated. */
-static fil_space_t *fil_space_get_space(ulint id)
+static fil_space_t *fil_space_get_space(uint32_t id)
{
if (fil_space_t *space= fil_space_get_by_id(id))
if (space->read_page0())
@@ -1101,7 +1094,8 @@ static fil_space_t *fil_space_get_space(ulint id)
return nullptr;
}
-void fil_space_set_recv_size_and_flags(ulint id, uint32_t size, uint32_t flags)
+void fil_space_set_recv_size_and_flags(uint32_t id, uint32_t size,
+ uint32_t flags)
{
ut_ad(id < SRV_SPACE_ID_UPPER_BOUND);
mysql_mutex_lock(&fil_system.mutex);
@@ -1382,10 +1376,7 @@ void fil_space_t::close_all()
/*******************************************************************//**
Sets the max tablespace id counter if the given number is bigger than the
previous value. */
-void
-fil_set_max_space_id_if_bigger(
-/*===========================*/
- ulint max_id) /*!< in: maximum known id */
+void fil_set_max_space_id_if_bigger(uint32_t max_id)
{
ut_a(max_id < SRV_SPACE_ID_UPPER_BOUND);
@@ -1423,7 +1414,7 @@ fil_write_flushed_lsn(
mach_write_to_8(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
lsn);
- ulint fsp_flags = mach_read_from_4(
+ uint32_t fsp_flags = mach_read_from_4(
buf + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
if (fil_space_t::full_crc32(fsp_flags)) {
@@ -1443,7 +1434,7 @@ fil_write_flushed_lsn(
@param id tablespace identifier
@return tablespace
@retval nullptr if the tablespace is missing or inaccessible */
-fil_space_t *fil_space_t::get(ulint id)
+fil_space_t *fil_space_t::get(uint32_t id)
{
mysql_mutex_lock(&fil_system.mutex);
fil_space_t *space= fil_space_get_by_id(id);
@@ -1463,7 +1454,7 @@ fil_space_t *fil_space_t::get(ulint id)
@param first_page_no first page number in the file
@param path file path
@param new_path new file path for type=FILE_RENAME */
-inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id,
+inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id,
const char *path, const char *new_path)
{
ut_ad((new_path != nullptr) == (type == FILE_RENAME));
@@ -1521,18 +1512,14 @@ inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id,
@param[in] space_id tablespace id
@param[in] name tablespace file name
@param[in,out] mtr mini-transaction */
-static
-void
-fil_name_write(
- ulint space_id,
- const char* name,
- mtr_t* mtr)
+static void fil_name_write(uint32_t space_id, const char *name,
+ mtr_t *mtr)
{
ut_ad(!is_predefined_tablespace(space_id));
mtr->log_file_op(FILE_MODIFY, space_id, name);
}
-fil_space_t *fil_space_t::check_pending_operations(ulint id)
+fil_space_t *fil_space_t::check_pending_operations(uint32_t id)
{
ut_a(!is_system_tablespace(id));
mysql_mutex_lock(&fil_system.mutex);
@@ -1559,7 +1546,7 @@ being_deleted:
return nullptr;
/* Issue a warning every 10.24 seconds, starting after 2.56 seconds */
if ((count & 511) == 128)
- sql_print_warning("InnoDB: Waiting for tablespace " ULINTPF
+ sql_print_warning("InnoDB: Waiting for tablespace " UINT32PF
" to be deleted", id);
std::this_thread::sleep_for(std::chrono::milliseconds(20));
mysql_mutex_lock(&fil_system.mutex);
@@ -1598,7 +1585,7 @@ being_deleted:
/** Close a single-table tablespace on failed IMPORT TABLESPACE.
The tablespace must be cached in the memory cache.
Free all pages used by the tablespace. */
-void fil_close_tablespace(ulint id)
+void fil_close_tablespace(uint32_t id)
{
ut_ad(!is_system_tablespace(id));
fil_space_t* space = fil_space_t::check_pending_operations(id);
@@ -1638,7 +1625,7 @@ void fil_close_tablespace(ulint id)
@param id tablespace identifier
@return detached file handle (to be closed by the caller)
@return OS_FILE_CLOSED if no file existed */
-pfs_os_file_t fil_delete_tablespace(ulint id)
+pfs_os_file_t fil_delete_tablespace(uint32_t id)
{
ut_ad(!is_system_tablespace(id));
pfs_os_file_t handle= OS_FILE_CLOSED;
@@ -1839,10 +1826,10 @@ must be >= FIL_IBD_FILE_INITIAL_SIZE
@retval NULL on error */
fil_space_t*
fil_ibd_create(
- ulint space_id,
+ uint32_t space_id,
const table_name_t name,
const char* path,
- ulint flags,
+ uint32_t flags,
uint32_t size,
fil_encryption_t mode,
uint32_t key_id,
@@ -2015,8 +2002,8 @@ fil_space_t*
fil_ibd_open(
unsigned validate,
fil_type_t purpose,
- ulint id,
- ulint flags,
+ uint32_t id,
+ uint32_t flags,
fil_space_t::name_type name,
const char* path_in,
dberr_t* err)
@@ -2036,7 +2023,7 @@ fil_ibd_open(
/* Table flags can be ULINT_UNDEFINED if
dict_tf_to_fsp_flags_failure is set. */
- if (flags == ULINT_UNDEFINED) {
+ if (flags == UINT32_MAX) {
corrupted:
local_err = DB_CORRUPTION;
func_exit:
@@ -2379,10 +2366,7 @@ of the file in validate_for_recovery().
@param[out] space the tablespace, or NULL on error
@return status of the operation */
enum fil_load_status
-fil_ibd_load(
- ulint space_id,
- const char* filename,
- fil_space_t*& space)
+fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
{
/* If the a space is already in the file system cache with this
space ID, then there is nothing to do. */
@@ -2501,7 +2485,7 @@ tablespace_check:
/* Adjust the memory-based flags that would normally be set by
dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */
- ulint flags = file.flags();
+ uint32_t flags = file.flags();
if (fil_space_t::is_compressed(flags)) {
flags |= page_zip_level
<< FSP_FLAGS_MEM_COMPRESSION_LEVEL;
@@ -2542,7 +2526,7 @@ tablespace_check:
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in,out] space tablespace
@param[in] flags desired tablespace flags */
-void fsp_flags_try_adjust(fil_space_t* space, ulint flags)
+void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags)
{
ut_ad(!srv_read_only_mode);
ut_ad(fil_space_t::is_valid_flags(flags, space->id));
@@ -2592,14 +2576,15 @@ startup, there may be many tablespaces which are not yet in the memory cache.
@param[in] table_flags table flags
@return the tablespace
@retval NULL if no matching tablespace exists in the memory cache */
-fil_space_t *fil_space_for_table_exists_in_mem(ulint id, ulint table_flags)
+fil_space_t *fil_space_for_table_exists_in_mem(uint32_t id,
+ uint32_t table_flags)
{
- const ulint expected_flags = dict_tf_to_fsp_flags(table_flags);
+ const uint32_t expected_flags = dict_tf_to_fsp_flags(table_flags);
mysql_mutex_lock(&fil_system.mutex);
if (fil_space_t* space = fil_space_get_by_id(id)) {
- ulint tf = expected_flags & ~FSP_FLAGS_MEM_MASK;
- ulint sf = space->flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t tf = expected_flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t sf = space->flags & ~FSP_FLAGS_MEM_MASK;
if (!fil_space_t::is_flags_equal(tf, sf)
&& !fil_space_t::is_flags_equal(sf, tf)) {
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 9961bdf056c..b6971558201 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -55,21 +55,11 @@ Updated 14/02/2015
#include <fcntl.h>
#endif
#include "row0mysql.h"
-#ifdef HAVE_LZ4
#include "lz4.h"
-#endif
-#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
-#endif
-#ifdef HAVE_LZMA
#include "lzma.h"
-#endif
-#ifdef HAVE_BZIP2
#include "bzlib.h"
-#endif
-#ifdef HAVE_SNAPPY
#include "snappy-c.h"
-#endif
/** Compress a page for the given compression algorithm.
@param[in] buf page to be compressed
@@ -94,6 +84,7 @@ static ulint fil_page_compress_low(
/* fall through */
case PAGE_UNCOMPRESSED:
return 0;
+
case PAGE_ZLIB_ALGORITHM:
{
ulong len = uLong(write_size);
@@ -104,23 +95,15 @@ static ulint fil_page_compress_low(
}
}
break;
-#ifdef HAVE_LZ4
+
case PAGE_LZ4_ALGORITHM:
-# ifdef HAVE_LZ4_COMPRESS_DEFAULT
write_size = LZ4_compress_default(
reinterpret_cast<const char*>(buf),
reinterpret_cast<char*>(out_buf) + header_len,
int(srv_page_size), int(write_size));
-# else
- write_size = LZ4_compress_limitedOutput(
- reinterpret_cast<const char*>(buf),
- reinterpret_cast<char*>(out_buf) + header_len,
- int(srv_page_size), int(write_size));
-# endif
return write_size;
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+
case PAGE_LZO_ALGORITHM: {
lzo_uint len = write_size;
@@ -133,8 +116,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+
case PAGE_LZMA_ALGORITHM: {
size_t out_pos = 0;
@@ -147,9 +129,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
case PAGE_BZIP2_ALGORITHM: {
unsigned len = unsigned(write_size);
if (BZ_OK == BZ2_bzBuffToBuffCompress(
@@ -163,9 +143,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
case PAGE_SNAPPY_ALGORITHM: {
size_t len = snappy_max_compressed_length(srv_page_size);
@@ -179,7 +157,6 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_SNAPPY */
}
return 0;
@@ -195,7 +172,7 @@ static ulint fil_page_compress_low(
static ulint fil_page_compress_for_full_crc32(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
{
@@ -378,7 +355,7 @@ static ulint fil_page_compress_for_non_full_crc32(
ulint fil_page_compress(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
{
@@ -432,7 +409,7 @@ static bool fil_page_decompress_low(
uLong(actual_size))
&& len == srv_page_size);
}
-#ifdef HAVE_LZ4
+
case PAGE_LZ4_ALGORITHM:
return LZ4_decompress_safe(
reinterpret_cast<const char*>(buf) + header_len,
@@ -440,8 +417,7 @@ static bool fil_page_decompress_low(
static_cast<int>(actual_size),
static_cast<int>(srv_page_size)) ==
static_cast<int>(srv_page_size);
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+
case PAGE_LZO_ALGORITHM:
{
lzo_uint len_lzo = srv_page_size;
@@ -450,8 +426,7 @@ static bool fil_page_decompress_low(
actual_size, tmp_buf, &len_lzo, NULL)
&& len_lzo == srv_page_size);
}
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+
case PAGE_LZMA_ALGORITHM:
{
size_t src_pos = 0;
@@ -464,8 +439,7 @@ static bool fil_page_decompress_low(
srv_page_size)
&& dst_pos == srv_page_size;
}
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
+
case PAGE_BZIP2_ALGORITHM:
{
uint dst_pos = static_cast<uint>(srv_page_size);
@@ -476,8 +450,7 @@ static bool fil_page_decompress_low(
static_cast<uint>(actual_size), 1, 0)
&& dst_pos == srv_page_size;
}
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
+
case PAGE_SNAPPY_ALGORITHM:
{
size_t olen = srv_page_size;
@@ -489,7 +462,6 @@ static bool fil_page_decompress_low(
reinterpret_cast<char*>(tmp_buf), &olen)
&& olen == srv_page_size;
}
-#endif /* HAVE_SNAPPY */
}
return false;
@@ -502,7 +474,8 @@ static bool fil_page_decompress_low(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress_for_full_crc32(byte* tmp_buf, byte* buf, ulint flags)
+static size_t fil_page_decompress_for_full_crc32(byte *tmp_buf, byte *buf,
+ uint32_t flags)
{
ut_ad(fil_space_t::full_crc32(flags));
bool compressed = false;
@@ -547,9 +520,7 @@ ulint fil_page_decompress_for_full_crc32(byte* tmp_buf, byte* buf, ulint flags)
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress_for_non_full_crc32(
- byte* tmp_buf,
- byte* buf)
+static size_t fil_page_decompress_for_non_full_crc32(byte *tmp_buf, byte *buf)
{
ulint header_len;
uint comp_algo;
@@ -600,10 +571,7 @@ ulint fil_page_decompress_for_non_full_crc32(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress(
- byte* tmp_buf,
- byte* buf,
- ulint flags)
+ulint fil_page_decompress(byte *tmp_buf, byte *buf, uint32_t flags)
{
if (fil_space_t::full_crc32(flags)) {
return fil_page_decompress_for_full_crc32(tmp_buf, buf, flags);
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index bc709516b41..9e6b6abcf03 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -303,8 +303,8 @@ Datafile::read_first_page(bool read_only_mode)
+ m_first_page);
m_flags = fsp_header_get_flags(m_first_page);
if (!fil_space_t::is_valid_flags(m_flags, m_space_id)) {
- ulint cflags = fsp_flags_convert_from_101(m_flags);
- if (cflags == ULINT_UNDEFINED) {
+ uint32_t cflags = fsp_flags_convert_from_101(m_flags);
+ if (cflags == UINT32_MAX) {
ib::error()
<< "Invalid flags " << ib::hex(m_flags)
<< " in " << m_filepath;
@@ -341,8 +341,7 @@ in order for this function to validate it.
@param[in] flags The expected tablespace flags.
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
-dberr_t
-Datafile::validate_to_dd(ulint space_id, ulint flags)
+dberr_t Datafile::validate_to_dd(uint32_t space_id, uint32_t flags)
{
dberr_t err;
@@ -432,7 +431,7 @@ Datafile::validate_for_recovery()
}
}
- if (m_space_id == ULINT_UNDEFINED) {
+ if (m_space_id == UINT32_MAX) {
return DB_SUCCESS; /* empty file */
}
@@ -625,15 +624,15 @@ Datafile::find_space_id()
page_size <<= 1) {
/* map[space_id] = count of pages */
typedef std::map<
- ulint,
- ulint,
- std::less<ulint>,
- ut_allocator<std::pair<const ulint, ulint> > >
+ uint32_t,
+ uint32_t,
+ std::less<uint32_t>,
+ ut_allocator<std::pair<const uint32_t, uint32_t> > >
Pages;
Pages verify;
- ulint page_count = 64;
- ulint valid_pages = 0;
+ uint32_t page_count = 64;
+ uint32_t valid_pages = 0;
/* Adjust the number of pages to analyze based on file size */
while ((page_count * page_size) > file_size) {
@@ -647,14 +646,14 @@ Datafile::find_space_id()
byte* page = static_cast<byte*>(
aligned_malloc(page_size, page_size));
- ulint fsp_flags;
+ uint32_t fsp_flags;
/* provide dummy value if the first os_file_read() fails */
switch (srv_checksum_algorithm) {
case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32:
case SRV_CHECKSUM_ALGORITHM_FULL_CRC32:
fsp_flags = 1U << FSP_FLAGS_FCRC32_POS_MARKER
| FSP_FLAGS_FCRC32_PAGE_SSIZE()
- | innodb_compression_algorithm
+ | uint(innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
break;
default:
@@ -694,7 +693,7 @@ Datafile::find_space_id()
if (noncompressed_ok || compressed_ok) {
- ulint space_id = mach_read_from_4(page
+ uint32_t space_id = mach_read_from_4(page
+ FIL_PAGE_SPACE_ID);
if (space_id > 0) {
@@ -772,14 +771,14 @@ Datafile::restore_from_doublewrite()
return(true);
}
- ulint flags = mach_read_from_4(
+ uint32_t flags = mach_read_from_4(
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
if (!fil_space_t::is_valid_flags(flags, m_space_id)) {
flags = fsp_flags_convert_from_101(flags);
/* recv_dblwr_t::validate_page() inside find_page()
checked this already. */
- ut_ad(flags != ULINT_UNDEFINED);
+ ut_ad(flags != UINT32_MAX);
/* The flags on the page should be converted later. */
}
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 12e9a6913ba..74dbf207947 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1516,7 +1516,7 @@ static
fseg_inode_t*
fseg_inode_try_get(
const fseg_header_t* header,
- ulint space,
+ uint32_t space,
ulint zip_size,
mtr_t* mtr,
buf_block_t** block,
@@ -2250,13 +2250,12 @@ fseg_alloc_free_page_general(
dberr_t* err) /*!< out: error code */
{
fseg_inode_t* inode;
- ulint space_id;
fil_space_t* space;
buf_block_t* iblock;
buf_block_t* block;
uint32_t n_reserved;
- space_id = page_get_space_id(page_align(seg_header));
+ const uint32_t space_id = page_get_space_id(page_align(seg_header));
space = mtr->x_lock_space(space_id);
inode = fseg_inode_try_get(seg_header, space_id, space->zip_size(),
mtr, &iblock, err);
diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc
index b069250ff9f..6bdf9fcc4d8 100644
--- a/storage/innobase/fsp/fsp0space.cc
+++ b/storage/innobase/fsp/fsp0space.cc
@@ -59,7 +59,7 @@ Tablespace::shutdown()
m_files.clear();
ut_free(m_path);
m_path = NULL;
- m_space_id = ULINT_UNDEFINED;
+ m_space_id = UINT32_MAX;
}
/** Note that the data file was found.
@@ -118,7 +118,7 @@ Tablespace::open_or_create(bool is_temp)
/* Create the tablespace entry for the multi-file
tablespace in the tablespace manager. */
- ulint fsp_flags = 0;
+ uint32_t fsp_flags;
switch (srv_checksum_algorithm) {
case SRV_CHECKSUM_ALGORITHM_FULL_CRC32:
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9b81aa9307c..853a303e925 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -79,7 +79,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0load.h"
#include "btr0defragment.h"
#include "dict0crea.h"
-#include "dict0dict.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "fil0fil.h"
@@ -94,9 +93,9 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "mtr0mtr.h"
#include "os0file.h"
#include "page0zip.h"
-#include "rem0types.h"
#include "row0import.h"
#include "row0ins.h"
+#include "row0log.h"
#include "row0merge.h"
#include "row0mysql.h"
#include "row0quiesce.h"
@@ -114,6 +113,12 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "ut0mem.h"
#include "row0ext.h"
+#include "lz4.h"
+#include "lzo/lzo1x.h"
+#include "lzma.h"
+#include "bzlib.h"
+#include "snappy-c.h"
+
#include <limits>
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
@@ -852,11 +857,6 @@ innodb_compression_algorithm_validate(
for update function */
struct st_mysql_value* value); /*!< in: incoming string */
-static ibool innodb_have_lzo=IF_LZO(1, 0);
-static ibool innodb_have_lz4=IF_LZ4(1, 0);
-static ibool innodb_have_lzma=IF_LZMA(1, 0);
-static ibool innodb_have_bzip2=IF_BZIP2(1, 0);
-static ibool innodb_have_snappy=IF_SNAPPY(1, 0);
static ibool innodb_have_punch_hole=IF_PUNCH_HOLE(1, 0);
static
@@ -1044,11 +1044,11 @@ static SHOW_VAR innodb_status_variables[]= {
&export_vars.innodb_pages_encrypted, SHOW_LONGLONG},
{"num_pages_decrypted",
&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_lz4", &(provider_service_lz4->is_loaded), SHOW_BOOL},
+ {"have_lzo", &(provider_service_lzo->is_loaded), SHOW_BOOL},
+ {"have_lzma", &(provider_service_lzma->is_loaded), SHOW_BOOL},
+ {"have_bzip2", &(provider_service_bzip2->is_loaded), SHOW_BOOL},
+ {"have_snappy", &(provider_service_snappy->is_loaded), SHOW_BOOL},
{"have_punch_hole", &innodb_have_punch_hole, SHOW_BOOL},
/* Defragmentation */
@@ -1777,16 +1777,11 @@ If correct, set the associated page_size_shift which is the power of 2
for this page size.
@param[in] page_size Page Size to evaluate
@return an associated page_size_shift if valid, 0 if invalid. */
-inline
-ulong
-innodb_page_size_validate(
- ulong page_size)
+inline uint32_t innodb_page_size_validate(ulong page_size)
{
- ulong n;
-
DBUG_ENTER("innodb_page_size_validate");
- for (n = UNIV_PAGE_SIZE_SHIFT_MIN;
+ for (uint32_t n = UNIV_PAGE_SIZE_SHIFT_MIN;
n <= UNIV_PAGE_SIZE_SHIFT_MAX;
n++) {
if (page_size == static_cast<ulong>(1 << n)) {
@@ -3764,23 +3759,34 @@ static const char* ha_innobase_exts[] = {
@retval 0 if no system-versioned data was affected by the transaction */
static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
{
- if (const trx_t* trx = thd_to_trx(thd)) {
- *trx_id = trx->id;
-
- for (const auto& t : trx->mod_tables) {
- if (t.second.is_versioned()) {
- DBUG_ASSERT(t.first->versioned_by_id());
- DBUG_ASSERT(trx->rsegs.m_redo.rseg);
+ if (trx_t *trx= thd_to_trx(thd))
+ {
+ *trx_id= trx->id;
+ bool versioned= false;
- return trx_sys.get_new_trx_id();
- }
- }
+ for (auto &t : trx->mod_tables)
+ {
+ if (t.second.is_versioned())
+ {
+ DBUG_ASSERT(t.first->versioned_by_id());
+ DBUG_ASSERT(trx->rsegs.m_redo.rseg);
+ versioned= true;
+ if (!trx->bulk_insert)
+ break;
+ }
+ if (t.second.is_bulk_insert())
+ {
+ ut_ad(trx->bulk_insert);
+ if (t.second.write_bulk(t.first, trx))
+ return ULONGLONG_MAX;
+ }
+ }
- return 0;
- }
+ return versioned ? trx_sys.get_new_trx_id() : 0;
+ }
- *trx_id = 0;
- return 0;
+ *trx_id= 0;
+ return 0;
}
/** Initialize and normalize innodb_buffer_pool_size. */
@@ -3796,6 +3802,25 @@ static void innodb_buffer_pool_size_init()
innobase_buffer_pool_size = srv_buf_pool_size;
}
+
+static bool
+compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags)
+{
+ bool is_loaded[PAGE_ALGORITHM_LAST+1]= { 1, 1, provider_service_lz4->is_loaded,
+ provider_service_lzo->is_loaded, provider_service_lzma->is_loaded,
+ provider_service_bzip2->is_loaded, provider_service_snappy->is_loaded };
+
+ DBUG_ASSERT(compression_algorithm <= PAGE_ALGORITHM_LAST);
+
+ if (is_loaded[compression_algorithm])
+ return 0;
+
+ my_printf_error(HA_ERR_UNSUPPORTED, "InnoDB: compression algorithm %s (%u)"
+ " is not available. Please, load the corresponding provider plugin.", flags,
+ page_compression_algorithms[compression_algorithm], compression_algorithm);
+ return 1;
+}
+
/** Initialize, validate and normalize the InnoDB startup parameters.
@return failure code
@retval 0 on success
@@ -3831,50 +3856,8 @@ static int innodb_init_params()
DBUG_RETURN(HA_ERR_INITIALIZATION);
}
-#ifndef HAVE_LZ4
- if (innodb_compression_algorithm == PAGE_LZ4_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblz4 is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_LZO
- if (innodb_compression_algorithm == PAGE_LZO_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzo is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_LZMA
- if (innodb_compression_algorithm == PAGE_LZMA_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzma is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_BZIP2
- if (innodb_compression_algorithm == PAGE_BZIP2_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libbz2 is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_SNAPPY
- if (innodb_compression_algorithm == PAGE_SNAPPY_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libsnappy is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
+ if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG))
+ DBUG_RETURN(HA_ERR_INITIALIZATION);
if ((srv_encrypt_tables || srv_encrypt_log
|| innodb_encrypt_temporary_tables)
@@ -4594,9 +4577,6 @@ innobase_commit(
if (commit_trx
|| (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
- DBUG_EXECUTE_IF("crash_innodb_before_commit",
- DBUG_SUICIDE(););
-
/* Run the fast part of commit if we did not already. */
if (!trx->active_commit_ordered) {
innobase_commit_ordered_2(trx, thd);
@@ -4631,6 +4611,10 @@ innobase_commit(
SQL statement */
trx_mark_sql_stat_end(trx);
+ if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) {
+ trx_rollback_for_mysql(trx);
+ DBUG_RETURN(1);
+ }
}
/* Reset the number AUTO-INC rows required */
@@ -10883,9 +10867,6 @@ err_col:
ut_ad(dict_sys.sys_tables_exist());
err = row_create_table_for_mysql(table, m_trx);
-
- DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
- DBUG_SUICIDE(););
}
switch (err) {
@@ -15667,6 +15648,7 @@ ha_innobase::extra(
row_ins_duplicate_error_in_clust() will acquire a
shared lock instead of an exclusive lock. */
stmt_boundary:
+ trx->bulk_insert_apply();
trx->end_bulk_insert(*m_prebuilt->table);
trx->bulk_insert = false;
break;
@@ -15687,6 +15669,9 @@ ha_innobase::extra(
if (trx->is_bulk_insert()) {
/* Allow a subsequent INSERT into an empty table
if !unique_checks && !foreign_key_checks. */
+ if (dberr_t err = trx->bulk_insert_apply()) {
+ return err;
+ }
break;
}
goto stmt_boundary;
@@ -15800,6 +15785,12 @@ ha_innobase::start_stmt(
if (!trx->bulk_insert) {
break;
}
+
+ /* Trigger could've initiated another stmt.
+ So apply all bulk operation and mark as
+ end bulk insert for all tables */
+ trx->bulk_insert_apply();
+ trx->end_bulk_insert();
trx->bulk_insert = false;
trx->last_sql_stat_start.least_undo_no = trx->undo_no;
}
@@ -17001,6 +16992,10 @@ innobase_xa_prepare(
SQL statement */
trx_mark_sql_stat_end(trx);
+ if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) {
+ trx_rollback_for_mysql(trx);
+ return 1;
+ }
}
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
@@ -18865,10 +18860,23 @@ static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
1, /* Minimum value */
5000, 0); /* Maximum value */
+extern void srv_update_purge_thread_count(uint n);
+
+static
+void
+innodb_purge_threads_update(THD*, struct st_mysql_sys_var*, void*, const void*save )
+{
+ srv_update_purge_thread_count(*static_cast<const uint*>(save));
+}
+
static MYSQL_SYSVAR_UINT(purge_threads, srv_n_purge_threads,
- PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
+ PLUGIN_VAR_OPCMDARG,
"Number of tasks for purging transaction history",
- NULL, NULL, 4, 1, innodb_purge_threads_MAX, 0);
+ NULL, innodb_purge_threads_update,
+ 4, /* Default setting */
+ 1, /* Minimum value */
+ innodb_purge_threads_MAX, /* Maximum value */
+ 0);
static MYSQL_SYSVAR_UINT(fast_shutdown, srv_fast_shutdown,
PLUGIN_VAR_OPCMDARG,
@@ -19368,7 +19376,7 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir,
"Directory where undo tablespace files live, this path can be absolute.",
NULL, NULL, NULL);
-static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
+static MYSQL_SYSVAR_UINT(undo_tablespaces, srv_undo_tablespaces,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of undo tablespaces to use.",
NULL, NULL,
@@ -19621,7 +19629,7 @@ static MYSQL_SYSVAR_BOOL(force_primary_key,
"Do not allow creating a table without primary key (off by default)",
NULL, NULL, FALSE);
-static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
+const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
static TYPELIB page_compression_algorithms_typelib=
{
array_elements(page_compression_algorithms) - 1, 0,
@@ -20922,70 +20930,14 @@ innodb_compression_algorithm_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
- ulong compression_algorithm;
DBUG_ENTER("innobase_compression_algorithm_validate");
if (check_sysvar_enum(thd, var, save, value)) {
DBUG_RETURN(1);
}
- compression_algorithm = *reinterpret_cast<ulong*>(save);
- (void)compression_algorithm;
-
-#ifndef HAVE_LZ4
- if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblz4 is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_LZO
- if (compression_algorithm == PAGE_LZO_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzo is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_LZMA
- if (compression_algorithm == PAGE_LZMA_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzma is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_BZIP2
- if (compression_algorithm == PAGE_BZIP2_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libbz2 is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_SNAPPY
- if (compression_algorithm == PAGE_SNAPPY_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libsnappy is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
+ if (compression_algorithm_is_not_loaded(*(ulong*)save, ME_WARNING))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index fbb640e7c62..1e11265b5ce 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -10648,8 +10648,8 @@ commit_cache_norebuild(
space->flags
|= FSP_FLAGS_MASK_PAGE_COMPRESSION;
} else if (!space->is_compressed()) {
- space->flags
- |= innodb_compression_algorithm
+ space->flags |= static_cast<uint32_t>(
+ innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
}
mysql_mutex_unlock(&fil_system.mutex);
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 063462a12b9..0379443e81d 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -6655,8 +6655,8 @@ i_s_dict_fill_tablespaces_encryption(
fields[TABLESPACES_ENCRYPTION_NAME]->set_notnull();
} else if (srv_is_undo_tablespace(space->id)) {
char undo_name[sizeof "innodb_undo000"];
- snprintf(undo_name, sizeof(undo_name),
- "innodb_undo%03zu",space->id);
+ snprintf(undo_name, sizeof undo_name,
+ "innodb_undo%03" PRIu32, space->id);
OK(fields[TABLESPACES_ENCRYPTION_NAME]->store(
undo_name, strlen(undo_name),
system_charset_info));
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 5a97ea4ebe0..f672bc8da2f 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -2338,7 +2338,7 @@ static void ibuf_read_merge_pages(const uint32_t* space_ids,
const uint32_t* page_nos, ulint n_stored)
{
for (ulint i = 0; i < n_stored; i++) {
- const ulint space_id = space_ids[i];
+ const uint32_t space_id = space_ids[i];
fil_space_t* s = fil_space_t::get(space_id);
if (!s) {
tablespace_deleted:
@@ -4418,7 +4418,7 @@ reset_bit:
/** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead.
@param[in] space missing or to-be-discarded tablespace */
-void ibuf_delete_for_discarded_space(ulint space)
+void ibuf_delete_for_discarded_space(uint32_t space)
{
btr_pcur_t pcur;
const rec_t* ibuf_rec;
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 87236415150..5b1c5c98e0b 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -321,16 +321,13 @@ buf_block_get_modify_clock(
bool buf_is_zeroes(st_::span<const byte> buf);
/** Check if a page is corrupt.
-@param[in] check_lsn whether the LSN should be checked
-@param[in] read_buf database page
-@param[in] fsp_flags tablespace flags
+@param check_lsn whether FIL_PAGE_LSN should be checked
+@param read_buf database page
+@param fsp_flags contents of FIL_SPACE_FLAGS
@return whether the page is corrupted */
-bool
-buf_page_is_corrupted(
- bool check_lsn,
- const byte* read_buf,
- ulint fsp_flags)
- MY_ATTRIBUTE((warn_unused_result));
+bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
+ uint32_t fsp_flags)
+ MY_ATTRIBUTE((warn_unused_result));
/** Read the key version from the page. In full crc32 format,
key version is stored at {0-3th} bytes. In other format, it is
@@ -338,7 +335,8 @@ stored in 26th position.
@param[in] read_buf database page
@param[in] fsp_flags tablespace flags
@return key version of the page. */
-inline uint32_t buf_page_get_key_version(const byte* read_buf, ulint fsp_flags)
+inline uint32_t buf_page_get_key_version(const byte* read_buf,
+ uint32_t fsp_flags)
{
static_assert(FIL_PAGE_FCRC32_KEY_VERSION == 0, "compatibility");
return fil_space_t::full_crc32(fsp_flags)
@@ -353,7 +351,7 @@ stored in page type.
@param[in] read_buf database page
@param[in] fsp_flags tablespace flags
@return true if page is compressed. */
-inline bool buf_page_is_compressed(const byte* read_buf, ulint fsp_flags)
+inline bool buf_page_is_compressed(const byte* read_buf, uint32_t fsp_flags)
{
uint16_t page_type= fil_page_get_type(read_buf);
return fil_space_t::full_crc32(fsp_flags)
@@ -456,12 +454,10 @@ buf_pool_size_align(
/** Verify that post encryption checksum match with the calculated checksum.
This function should be called only if tablespace contains crypt data metadata.
-@param[in] page page frame
-@param[in] fsp_flags tablespace flags
-@return true if page is encrypted and OK, false otherwise */
-bool buf_page_verify_crypt_checksum(
- const byte* page,
- ulint fsp_flags);
+@param page page frame
+@param fsp_flags contents of FSP_SPACE_FLAGS
+@return whether the page is encrypted and valid */
+bool buf_page_verify_crypt_checksum(const byte *page, uint32_t fsp_flags);
/** Calculate a ROW_FORMAT=COMPRESSED page checksum and update the page.
@param[in,out] page page to update
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index c07ff679a80..665fd1115e7 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -46,7 +46,7 @@ deleting the data file of that tablespace.
The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
@param id tablespace identifier */
-void buf_flush_remove_pages(ulint id);
+void buf_flush_remove_pages(uint32_t id);
/*******************************************************************//**
Relocates a buffer control block on the flush_list.
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index 8d6b28194dc..986a792b97e 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -101,12 +101,10 @@ 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 recovery wants to read in.
-@param[in] space_id tablespace id
-@param[in] page_nos array of page numbers to read, with the
-highest page number the last in the array
-@param[in] n number of page numbers in the array */
-void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n);
+/** Issue read requests for pages that need to be recovered.
+@param space_id tablespace identifier
+@param page_nos page numbers to read, in ascending order */
+void buf_read_recv_pages(uint32_t space_id, st_::span<uint32_t> page_nos);
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
index c69c07d66e1..6c13f5ee308 100644
--- a/storage/innobase/include/buf0types.h
+++ b/storage/innobase/include/buf0types.h
@@ -90,9 +90,9 @@ class page_id_t
{
public:
/** Constructor from (space, page_no).
- @param[in] space tablespace id
- @param[in] page_no page number */
- constexpr page_id_t(ulint space, uint32_t page_no) :
+ @param space tablespace id
+ @param page_no page number */
+ constexpr page_id_t(uint32_t space, uint32_t page_no) :
m_id(uint64_t{space} << 32 | page_no) {}
constexpr page_id_t(uint64_t id) : m_id(id) {}
diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h
index 3e14e0ace69..a65287476ef 100644
--- a/storage/innobase/include/dict0boot.h
+++ b/storage/innobase/include/dict0boot.h
@@ -42,7 +42,7 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id); /*!< out: space id
+ uint32_t* space_id); /*!< out: space id
(not assigned if NULL) */
/** Update dict_sys.row_id in the dictionary header file page. */
void dict_hdr_flush_row_id(row_id_t id);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index e54a138cc02..f70e50f5d48 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -847,11 +847,8 @@ fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
@return tablespace flags (fil_space_t::flags) */
-UNIV_INLINE
-ulint
-dict_tf_to_fsp_flags(ulint table_flags)
- MY_ATTRIBUTE((const));
-
+inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags)
+ MY_ATTRIBUTE((const));
/** Extract the ROW_FORMAT=COMPRESSED page size from table flags.
@param[in] flags flags
diff --git a/storage/innobase/include/dict0dict.inl b/storage/innobase/include/dict0dict.inl
index a210c839020..4cc3eae96ab 100644
--- a/storage/innobase/include/dict0dict.inl
+++ b/storage/innobase/include/dict0dict.inl
@@ -618,19 +618,16 @@ fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
@return tablespace flags (fil_space_t::flags) */
-UNIV_INLINE
-ulint
-dict_tf_to_fsp_flags(ulint table_flags)
+inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags)
{
- ulint fsp_flags;
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
+ uint32_t fsp_flags;
+ uint32_t page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
table_flags);
ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0)
== (page_compression_level == 0));
- DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
- return(ULINT_UNDEFINED););
+ DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure", return UINT32_MAX;);
/* No ROW_FORMAT=COMPRESSED for innodb_checksum_algorithm=full_crc32 */
if ((srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32
@@ -641,7 +638,8 @@ dict_tf_to_fsp_flags(ulint table_flags)
| FSP_FLAGS_FCRC32_PAGE_SSIZE();
if (page_compression_level) {
- fsp_flags |= innodb_compression_algorithm
+ fsp_flags |= static_cast<uint32_t>(
+ innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
}
} else {
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 111f0efbe0b..83987789bb5 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -112,7 +112,7 @@ are described in fsp0fsp.h. */
/** This bitmask is used in SYS_TABLES.N_COLS to set and test whether
the Compact page format is used, i.e ROW_FORMAT != REDUNDANT */
-#define DICT_N_COLS_COMPACT 0x80000000UL
+constexpr uint32_t DICT_N_COLS_COMPACT= 1U << 31;
/** Width of the COMPACT flag */
#define DICT_TF_WIDTH_COMPACT 1
@@ -2090,7 +2090,7 @@ public:
/** The tablespace of the table */
fil_space_t* space;
/** Tablespace ID */
- ulint space_id;
+ uint32_t space_id;
/** Stores information about:
1 row format (redundant or compact),
@@ -2448,6 +2448,16 @@ public:
static dict_table_t *create(const span<const char> &name, fil_space_t *space,
ulint n_cols, ulint n_v_cols, ulint flags,
ulint flags2);
+
+ /** Check whether the table has any spatial indexes */
+ bool has_spatial_index() const
+ {
+ for (auto i= UT_LIST_GET_FIRST(indexes);
+ (i= UT_LIST_GET_NEXT(indexes, i)) != nullptr; )
+ if (i->is_spatial())
+ return true;
+ return false;
+ }
};
inline void dict_index_t::set_modified(mtr_t& mtr) const
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index 26272761f43..f43965cd165 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -291,20 +291,20 @@ byte* fil_space_encrypt(
/** Decrypt a page.
@param]in] space_id space id
+@param[in] fsp_flags Tablespace flags
@param[in] crypt_data crypt_data
@param[in] tmp_frame Temporary buffer
@param[in] physical_size page size
-@param[in] fsp_flags Tablespace flags
@param[in,out] src_frame Page to decrypt
@retval DB_SUCCESS on success
@retval DB_DECRYPTION_FAILED on error */
dberr_t
fil_space_decrypt(
- ulint space_id,
+ uint32_t space_id,
+ uint32_t fsp_flags,
fil_space_crypt_t* crypt_data,
byte* tmp_frame,
ulint physical_size,
- ulint fsp_flags,
byte* src_frame);
/******************************************************************
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 7837020fec4..65198f78988 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -42,7 +42,7 @@ Created 10/25/1995 Heikki Tuuri
#include <mutex>
struct unflushed_spaces_tag_t;
-struct rotation_list_tag_t;
+struct default_encrypt_tag_t;
struct space_list_tag_t;
struct named_spaces_tag_t;
@@ -81,14 +81,14 @@ enum srv_flush_t
extern ulong srv_file_flush_method;
/** Undo tablespaces starts with space_id. */
-extern ulint srv_undo_space_id_start;
+extern uint32_t srv_undo_space_id_start;
/** The number of UNDO tablespaces that are open and ready to use. */
-extern ulint srv_undo_tablespaces_open;
+extern uint32_t srv_undo_tablespaces_open;
/** Check whether given space id is undo tablespace id
@param[in] space_id space id to check
@return true if it is undo tablespace else false. */
-inline bool srv_is_undo_tablespace(ulint space_id)
+inline bool srv_is_undo_tablespace(uint32_t space_id)
{
return srv_undo_space_id_start > 0 &&
space_id >= srv_undo_space_id_start &&
@@ -335,7 +335,7 @@ enum fil_encryption_t
};
struct fil_space_t final : ilist_node<unflushed_spaces_tag_t>,
- ilist_node<rotation_list_tag_t>,
+ ilist_node<default_encrypt_tag_t>,
ilist_node<space_list_tag_t>,
ilist_node<named_spaces_tag_t>
#else
@@ -351,8 +351,6 @@ struct fil_space_t final
latch.destroy();
}
- ulint id; /*!< space id */
-
/** fil_system.spaces chain node */
fil_space_t *hash;
lsn_t max_lsn;
@@ -362,6 +360,8 @@ struct fil_space_t final
Protected by log_sys.mutex.
If and only if this is nonzero, the
tablespace will be in named_spaces. */
+ /** tablespace identifier */
+ uint32_t id;
/** whether undo tablespace truncation is in progress */
bool is_being_truncated;
fil_type_t purpose;/*!< purpose */
@@ -530,7 +530,7 @@ public:
@param id tablespace identifier
@return tablespace
@retval nullptr if no tablespace was found */
- static fil_space_t *check_pending_operations(ulint id);
+ static fil_space_t *check_pending_operations(uint32_t id);
private:
MY_ATTRIBUTE((warn_unused_result))
@@ -675,92 +675,78 @@ public:
freed_ranges.clear();
}
#endif /* !UNIV_INNOCHECKSUM */
- /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
- check fsp0types.h to more info about flags. */
- ulint flags;
-
- /** Determine if full_crc32 is used for a data file
- @param[in] flags tablespace flags (FSP_SPACE_FLAGS)
- @return whether the full_crc32 algorithm is active */
- static bool full_crc32(ulint flags) {
- return flags & FSP_FLAGS_FCRC32_MASK_MARKER;
- }
- /** Determine if full_crc32 is used along with compression */
- static bool is_full_crc32_compressed(ulint flags)
+ /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
+ check fsp0types.h to more info about flags. */
+ uint32_t flags;
+
+ /** Determine if full_crc32 is used for a data file
+ @param[in] flags tablespace flags (FSP_SPACE_FLAGS)
+ @return whether the full_crc32 algorithm is active */
+ static bool full_crc32(uint32_t flags)
+ { return flags & FSP_FLAGS_FCRC32_MASK_MARKER; }
+ /** @return whether innodb_checksum_algorithm=full_crc32 is active */
+ bool full_crc32() const { return full_crc32(flags); }
+ /** Determine if full_crc32 is used along with PAGE_COMPRESSED */
+ static bool is_full_crc32_compressed(uint32_t flags)
{
- if (full_crc32(flags))
- {
- ulint algo= FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags);
- DBUG_ASSERT(algo <= PAGE_ALGORITHM_LAST);
- return algo > 0;
+ if (!full_crc32(flags))
+ return false;
+ auto algo= FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags);
+ DBUG_ASSERT(algo <= PAGE_ALGORITHM_LAST);
+ return algo != 0;
+ }
+ /** Determine the logical page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the logical page size
+ @retval 0 if the flags are invalid */
+ static unsigned logical_size(uint32_t flags)
+ {
+ switch (full_crc32(flags)
+ ? FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags)
+ : FSP_FLAGS_GET_PAGE_SSIZE(flags)) {
+ case 3: return 4096;
+ case 4: return 8192;
+ case 5: return full_crc32(flags) ? 16384 : 0;
+ case 0: return full_crc32(flags) ? 0 : 16384;
+ case 6: return 32768;
+ case 7: return 65536;
+ default: return 0;
}
-
- return false;
}
- /** @return whether innodb_checksum_algorithm=full_crc32 is active */
- bool full_crc32() const { return full_crc32(flags); }
- /** Determine the logical page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the logical page size
- @retval 0 if the flags are invalid */
- static unsigned logical_size(ulint flags) {
-
- ulint page_ssize = 0;
-
- if (full_crc32(flags)) {
- page_ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
- } else {
- page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- }
-
- switch (page_ssize) {
- case 3: return 4096;
- case 4: return 8192;
- case 5:
- { ut_ad(full_crc32(flags)); return 16384; }
- case 0:
- { ut_ad(!full_crc32(flags)); return 16384; }
- case 6: return 32768;
- case 7: return 65536;
- default: return 0;
- }
- }
- /** Determine the ROW_FORMAT=COMPRESSED page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the ROW_FORMAT=COMPRESSED page size
- @retval 0 if ROW_FORMAT=COMPRESSED is not used */
- static unsigned zip_size(ulint flags) {
-
- if (full_crc32(flags)) {
- return 0;
- }
+ /** Determine the ROW_FORMAT=COMPRESSED page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the ROW_FORMAT=COMPRESSED page size
+ @retval 0 if ROW_FORMAT=COMPRESSED is not used */
+ static unsigned zip_size(uint32_t flags)
+ {
+ if (full_crc32(flags))
+ return 0;
+ const uint32_t zip_ssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ return zip_ssize ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize : 0;
+ }
+ /** Determine the physical page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the physical page size */
+ static unsigned physical_size(uint32_t flags)
+ {
+ if (full_crc32(flags))
+ return logical_size(flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- return zip_ssize
- ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize : 0;
- }
- /** Determine the physical page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the physical page size */
- static unsigned physical_size(ulint flags) {
+ const uint32_t zip_ssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ return zip_ssize
+ ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize
+ : unsigned(srv_page_size);
+ }
- if (full_crc32(flags)) {
- return logical_size(flags);
- }
+ /** @return the ROW_FORMAT=COMPRESSED page size
+ @retval 0 if ROW_FORMAT=COMPRESSED is not used */
+ unsigned zip_size() const { return zip_size(flags); }
+ /** @return the physical page size */
+ unsigned physical_size() const { return physical_size(flags); }
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- return zip_ssize
- ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize
- : unsigned(srv_page_size);
- }
- /** @return the ROW_FORMAT=COMPRESSED page size
- @retval 0 if ROW_FORMAT=COMPRESSED is not used */
- unsigned zip_size() const { return zip_size(flags); }
- /** @return the physical page size */
- unsigned physical_size() const { return physical_size(flags); }
- /** Check whether the compression enabled in tablespace.
+ /** Check whether PAGE_COMPRESSED is enabled.
@param[in] flags tablespace flags */
- static bool is_compressed(ulint flags)
+ static bool is_compressed(uint32_t flags)
{
return is_full_crc32_compressed(flags) ||
FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
@@ -768,187 +754,151 @@ public:
/** @return whether the compression enabled for the tablespace. */
bool is_compressed() const { return is_compressed(flags); }
- /** Get the compression algorithm for full crc32 format.
- @param[in] flags tablespace flags
- @return algorithm type of tablespace */
- static ulint get_compression_algo(ulint flags)
- {
- return full_crc32(flags)
- ? FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags)
- : 0;
- }
- /** @return the page_compressed algorithm
- @retval 0 if not page_compressed */
- ulint get_compression_algo() const {
- return fil_space_t::get_compression_algo(flags);
- }
- /** Determine if the page_compressed page contains an extra byte
- for exact compressed stream length
- @param[in] flags tablespace flags
- @return whether the extra byte is needed */
- static bool full_crc32_page_compressed_len(ulint flags)
- {
- DBUG_ASSERT(full_crc32(flags));
- switch (get_compression_algo(flags)) {
- case PAGE_LZ4_ALGORITHM:
- case PAGE_LZO_ALGORITHM:
- case PAGE_SNAPPY_ALGORITHM:
- return true;
- }
- return false;
- }
-
- /** Whether the full checksum matches with non full checksum flags.
- @param[in] flags flags present
- @param[in] expected expected flags
- @return true if it is equivalent */
- static bool is_flags_full_crc32_equal(ulint flags, ulint expected)
- {
- ut_ad(full_crc32(flags));
- ulint fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
-
- if (full_crc32(expected)) {
- /* The data file may have been created with a
- different innodb_compression_algorithm. But
- we only support one innodb_page_size for all files. */
- return fcrc32_psize
- == FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
- }
-
- ulint non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(expected);
-
- if (!non_fcrc32_psize) {
- if (fcrc32_psize != 5) {
- return false;
- }
- } else if (fcrc32_psize != non_fcrc32_psize) {
- return false;
- }
-
- return true;
- }
- /** Whether old tablespace flags match full_crc32 flags.
- @param[in] flags flags present
- @param[in] expected expected flags
- @return true if it is equivalent */
- static bool is_flags_non_full_crc32_equal(ulint flags, ulint expected)
- {
- ut_ad(!full_crc32(flags));
-
- if (!full_crc32(expected)) {
- return false;
- }
-
- ulint non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- ulint fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(
- expected);
-
- if (!non_fcrc32_psize) {
- if (fcrc32_psize != 5) {
- return false;
- }
- } else if (fcrc32_psize != non_fcrc32_psize) {
- return false;
- }
-
- return true;
- }
- /** Whether both fsp flags are equivalent */
- static bool is_flags_equal(ulint flags, ulint expected)
- {
- if (!((flags ^ expected) & ~(1U << FSP_FLAGS_POS_RESERVED))) {
- return true;
- }
-
- return full_crc32(flags)
- ? is_flags_full_crc32_equal(flags, expected)
- : is_flags_non_full_crc32_equal(flags, expected);
- }
- /** Validate the tablespace flags for full crc32 format.
- @param[in] flags the content of FSP_SPACE_FLAGS
- @return whether the flags are correct in full crc32 format */
- static bool is_fcrc32_valid_flags(ulint flags)
- {
- ut_ad(flags & FSP_FLAGS_FCRC32_MASK_MARKER);
- const ulint page_ssize = physical_size(flags);
- if (page_ssize < 3 || page_ssize & 8) {
- return false;
- }
-
- flags >>= FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
-
- return flags <= PAGE_ALGORITHM_LAST;
- }
- /** Validate the tablespace flags.
- @param[in] flags content of FSP_SPACE_FLAGS
- @param[in] is_ibd whether this is an .ibd file
- (not system tablespace)
- @return whether the flags are correct. */
- static bool is_valid_flags(ulint flags, bool is_ibd)
- {
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
- return false;);
-
- if (full_crc32(flags)) {
- return is_fcrc32_valid_flags(flags);
- }
+ /** Get the compression algorithm for full crc32 format.
+ @param flags contents of FSP_SPACE_FLAGS
+ @return PAGE_COMPRESSED algorithm of full_crc32 tablespace
+ @retval 0 if not PAGE_COMPRESSED or not full_crc32 */
+ static unsigned get_compression_algo(uint32_t flags)
+ {
+ return full_crc32(flags)
+ ? FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags)
+ : 0;
+ }
+ /** @return the page_compressed algorithm
+ @retval 0 if not page_compressed */
+ unsigned get_compression_algo() const { return get_compression_algo(flags); }
+ /** Determine if the page_compressed page contains an extra byte
+ for exact compressed stream length
+ @param flags contents of FSP_SPACE_FLAGS
+ @return whether the extra byte is needed */
+ static bool full_crc32_page_compressed_len(uint32_t flags)
+ {
+ DBUG_ASSERT(full_crc32(flags));
+ switch (get_compression_algo(flags)) {
+ case PAGE_LZ4_ALGORITHM:
+ case PAGE_LZO_ALGORITHM:
+ case PAGE_SNAPPY_ALGORITHM:
+ return true;
+ }
+ return false;
+ }
- if (flags == 0) {
- return true;
- }
+ /** Whether the full checksum matches with non full checksum flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param expected expected flags
+ @return true if it is equivalent */
+ static bool is_flags_full_crc32_equal(uint32_t flags, uint32_t expected)
+ {
+ ut_ad(full_crc32(flags));
+ uint32_t fcrc32_psize= FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
+
+ if (full_crc32(expected))
+ /* The data file may have been created with a
+ different innodb_compression_algorithm. But
+ we only support one innodb_page_size for all files. */
+ return fcrc32_psize == FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
+
+ uint32_t non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(expected);
+ if (!non_fcrc32_psize)
+ return fcrc32_psize == 5;
+ return fcrc32_psize == non_fcrc32_psize;
+ }
- if (flags & ~FSP_FLAGS_MASK) {
- return false;
- }
+ /** Whether old tablespace flags match full_crc32 flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param expected expected flags
+ @return true if it is equivalent */
+ static bool is_flags_non_full_crc32_equal(uint32_t flags, uint32_t expected)
+ {
+ ut_ad(!full_crc32(flags));
+ if (!full_crc32(expected))
+ return false;
- if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE
- | FSP_FLAGS_MASK_ATOMIC_BLOBS))
- == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
- /* If the "atomic blobs" flag (indicating
- ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
- is set, then the "post Antelope"
- (ROW_FORMAT!=REDUNDANT) flag must also be set. */
- return false;
- }
+ uint32_t non_fcrc32_psize= FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ uint32_t fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
- /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
- of MySQL 5.6 and MariaDB 10.0, which we ignore.
- In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
- bits 10..14 would be nonzero 0bsssaa where sss is
- nonzero PAGE_SSIZE (3, 4, 6, or 7)
- and aa is ATOMIC_WRITES (not 0b11). */
- if (FSP_FLAGS_GET_RESERVED(flags) & ~1U) {
- return false;
- }
+ if (!non_fcrc32_psize)
+ return fcrc32_psize == 5;
+ return fcrc32_psize == non_fcrc32_psize;
+ }
- const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
- /* the page_size is not between 4k and 64k;
- 16k should be encoded as 0, not 5 */
- return false;
- }
+ /** Whether both fsp flags are equivalent */
+ static bool is_flags_equal(uint32_t flags, uint32_t expected)
+ {
+ if (!((flags ^ expected) & ~(1U << FSP_FLAGS_POS_RESERVED)))
+ return true;
+ return full_crc32(flags)
+ ? is_flags_full_crc32_equal(flags, expected)
+ : is_flags_non_full_crc32_equal(flags, expected);
+ }
- const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- if (zssize == 0) {
- /* not ROW_FORMAT=COMPRESSED */
- } else if (zssize > (ssize ? ssize : 5)) {
- /* Invalid KEY_BLOCK_SIZE */
- return false;
- } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
- | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
- /* both these flags should be set for
- ROW_FORMAT=COMPRESSED */
- return false;
- }
+ /** Validate the tablespace flags for full crc32 format.
+ @param flags contents of FSP_SPACE_FLAGS
+ @return whether the flags are correct in full crc32 format */
+ static bool is_fcrc32_valid_flags(uint32_t flags)
+ {
+ ut_ad(flags & FSP_FLAGS_FCRC32_MASK_MARKER);
+ const ulint page_ssize= physical_size(flags);
+ if (page_ssize < 3 || page_ssize & 8)
+ return false;
+ flags >>= FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
+ return flags <= PAGE_ALGORITHM_LAST;
+ }
+ /** Validate the tablespace flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param is_ibd whether this is an .ibd file (not system tablespace)
+ @return whether the flags are correct */
+ static bool is_valid_flags(uint32_t flags, bool is_ibd)
+ {
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return false;);
+ if (full_crc32(flags))
+ return is_fcrc32_valid_flags(flags);
- /* The flags do look valid. But, avoid misinterpreting
- buggy MariaDB 10.1 format flags for
- PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL={0,2,3}
- as valid-looking PAGE_SSIZE if this is known to be
- an .ibd file and we are using the default innodb_page_size=16k. */
- return(ssize == 0 || !is_ibd
- || srv_page_size != UNIV_PAGE_SIZE_ORIG);
- }
+ if (flags == 0)
+ return true;
+ if (~FSP_FLAGS_MASK & flags)
+ return false;
+
+ if (FSP_FLAGS_MASK_ATOMIC_BLOBS ==
+ (flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS)))
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag is set, then the
+ ROW_FORMAT!=REDUNDANT flag must also be set. */
+ return false;
+
+ /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
+ of MySQL 5.6 and MariaDB 10.0, which we ignore.
+ In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
+ bits 10..14 would be nonzero 0bsssaa where sss is
+ nonzero PAGE_SSIZE (3, 4, 6, or 7)
+ and aa is ATOMIC_WRITES (not 0b11). */
+ if (FSP_FLAGS_GET_RESERVED(flags) & ~1U)
+ return false;
+
+ const uint32_t ssize= FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8)
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return false;
+
+ const uint32_t zssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0)
+ /* not ROW_FORMAT=COMPRESSED */;
+ else if (zssize > (ssize ? ssize : 5))
+ /* Invalid KEY_BLOCK_SIZE */
+ return false;
+ else if (~flags &
+ (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ /* both these flags must set for ROW_FORMAT=COMPRESSED */
+ return false;
+
+ /* The flags do look valid. But, avoid misinterpreting
+ buggy MariaDB 10.1 format flags for
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL={0,2,3}
+ as valid-looking PAGE_SSIZE if this is known to be
+ an .ibd file and we are using the default innodb_page_size=16k. */
+ return(ssize == 0 || !is_ibd || srv_page_size != UNIV_PAGE_SIZE_ORIG);
+ }
#ifndef UNIV_INNOCHECKSUM
MY_ATTRIBUTE((warn_unused_result))
@@ -960,7 +910,7 @@ public:
@param mode encryption mode
@return pointer to created tablespace, to be filled in with add()
@retval nullptr on failure (such as when the same tablespace exists) */
- static fil_space_t *create(ulint id, ulint flags,
+ static fil_space_t *create(uint32_t id, uint32_t flags,
fil_type_t purpose, fil_space_crypt_t *crypt_data,
fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT);
@@ -969,7 +919,7 @@ public:
@param id tablespace identifier
@return tablespace
@retval nullptr if the tablespace is missing or inaccessible */
- static fil_space_t *get(ulint id);
+ static fil_space_t *get(uint32_t id);
/** Add/remove the free page in the freed ranges list.
@param[in] offset page number to be added
@@ -1417,14 +1367,12 @@ or the caller should be in single-threaded crash recovery mode
Normally, fil_space_t::get() should be used instead.
@param[in] id tablespace ID
@return tablespace, or NULL if not found */
-fil_space_t*
-fil_space_get(
- ulint id)
- MY_ATTRIBUTE((warn_unused_result));
+fil_space_t *fil_space_get(uint32_t id)
+ MY_ATTRIBUTE((warn_unused_result));
-/** The tablespace memory cache; also the totality of logs (the log
-data space) is stored here; below we talk about tablespaces */
-struct fil_system_t {
+/** The tablespace memory cache */
+struct fil_system_t
+{
/**
Constructor.
@@ -1483,12 +1431,8 @@ public:
ulint n_open;
/** last time we noted n_open exceeding the limit; protected by mutex */
time_t n_open_exceeded_time;
- ulint max_assigned_id;/*!< maximum space id in the existing
- tables, or assigned during the time
- mysqld has been up; at an InnoDB
- startup we scan the data dictionary
- and set here the maximum of the
- space id's of the tables there */
+ /** maximum persistent tablespace id that has ever been assigned */
+ uint32_t max_assigned_id;
/** nonzero if fil_node_open_file_low() should avoid moving the tablespace
to the end of space_list, for FIFO policy of try_to_close() */
ulint freeze_space_list;
@@ -1501,13 +1445,13 @@ public:
the latest redo log checkpoint.
Protected only by log_sys.mutex. */
- /** List of all file spaces need key rotation */
- ilist<fil_space_t, rotation_list_tag_t> default_encrypt_tables;
+ /** list of all ENCRYPTED=DEFAULT tablespaces that need
+ to be converted to the current value of innodb_encrypt_tables */
+ ilist<fil_space_t, default_encrypt_tag_t> default_encrypt_tables;
- bool space_id_reuse_warned;
- /*!< whether fil_space_t::create()
- has issued a warning about
- potential space_id reuse */
+ /** whether fil_space_t::create() has issued a warning about
+ potential space_id reuse */
+ bool space_id_reuse_warned;
/** Return the next tablespace from default_encrypt_tables list.
@param space previous tablespace (nullptr to start from the start)
@@ -1629,36 +1573,27 @@ Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
@return true if assigned, false if not */
-bool
-fil_assign_new_space_id(
-/*====================*/
- ulint* space_id); /*!< in/out: space id */
+bool fil_assign_new_space_id(uint32_t *space_id);
/** Frees a space object from the tablespace memory cache.
Closes the files in the chain but does not delete them.
There must not be any pending i/o's or flushes on the files.
-@param[in] id tablespace identifier
-@param[in] x_latched whether the caller holds X-mode space->latch
+@param id tablespace identifier
+@param x_latched whether the caller holds exclusive fil_space_t::latch
@return true if success */
-bool
-fil_space_free(
- ulint id,
- bool x_latched);
+bool fil_space_free(uint32_t id, bool x_latched);
/** Set the recovered size of a tablespace in pages.
@param id tablespace ID
@param size recovered size in pages
@param flags tablespace flags */
-void fil_space_set_recv_size_and_flags(ulint id, uint32_t size,
+void fil_space_set_recv_size_and_flags(uint32_t id, uint32_t size,
uint32_t flags);
/*******************************************************************//**
Sets the max tablespace id counter if the given number is bigger than the
previous value. */
-void
-fil_set_max_space_id_if_bigger(
-/*===========================*/
- ulint max_id);/*!< in: maximum known id */
+void fil_set_max_space_id_if_bigger(uint32_t max_id);
/** Write the flushed LSN to the page header of the first page in the
system tablespace.
@@ -1674,12 +1609,12 @@ MY_ATTRIBUTE((warn_unused_result))
@param id tablespace identifier
@return detached file handle (to be closed by the caller)
@return OS_FILE_CLOSED if no file existed */
-pfs_os_file_t fil_delete_tablespace(ulint id);
+pfs_os_file_t fil_delete_tablespace(uint32_t id);
/** Close a single-table tablespace on failed IMPORT TABLESPACE.
The tablespace must be cached in the memory cache.
Free all pages used by the tablespace. */
-void fil_close_tablespace(ulint id);
+void fil_close_tablespace(uint32_t id);
/*******************************************************************//**
Allocates and builds a file name from a path, a table or tablespace name
@@ -1709,10 +1644,10 @@ must be >= FIL_IBD_FILE_INITIAL_SIZE
@retval NULL on error */
fil_space_t*
fil_ibd_create(
- ulint space_id,
+ uint32_t space_id,
const table_name_t name,
const char* path,
- ulint flags,
+ uint32_t flags,
uint32_t size,
fil_encryption_t mode,
uint32_t key_id,
@@ -1723,7 +1658,7 @@ fil_ibd_create(
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in,out] space tablespace
@param[in] flags desired tablespace flags */
-void fsp_flags_try_adjust(fil_space_t* space, ulint flags);
+void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags);
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
@@ -1756,8 +1691,8 @@ fil_space_t*
fil_ibd_open(
unsigned validate,
fil_type_t purpose,
- ulint id,
- ulint flags,
+ uint32_t id,
+ uint32_t flags,
fil_space_t::name_type name,
const char* path_in,
dberr_t* err = NULL)
@@ -1782,12 +1717,8 @@ enum fil_load_status {
@param[out] space the tablespace, or NULL on error
@return status of the operation */
enum fil_load_status
-fil_ibd_load(
- ulint space_id,
- const char* filename,
- fil_space_t*& space)
- MY_ATTRIBUTE((warn_unused_result));
-
+fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
+ MY_ATTRIBUTE((warn_unused_result));
/** Determine if a matching tablespace exists in the InnoDB tablespace
memory cache. Note that if we have not done a crash recovery at the database
@@ -1796,7 +1727,8 @@ startup, there may be many tablespaces which are not yet in the memory cache.
@param[in] table_flags table flags
@return the tablespace
@retval NULL if no matching tablespace exists in the memory cache */
-fil_space_t *fil_space_for_table_exists_in_mem(ulint id, ulint table_flags);
+fil_space_t *fil_space_for_table_exists_in_mem(uint32_t id,
+ uint32_t table_flags);
/** Try to extend a tablespace if it is smaller than the specified size.
@param[in,out] space tablespace
@@ -1827,12 +1759,11 @@ fil_delete_file(
/*============*/
const char* path); /*!< in: filepath of the ibd tablespace */
-/*******************************************************************//**
-Returns the table space by a given id, NULL if not found. */
-fil_space_t*
-fil_space_get_by_id(
-/*================*/
- ulint id); /*!< in: space id */
+/** Look up a tablespace.
+@param tablespace identifier
+@return tablespace
+@retval nullptr if not found */
+fil_space_t *fil_space_get_by_id(uint32_t id);
/** Note that a non-predefined persistent tablespace has been modified
by redo log.
@@ -1871,6 +1802,9 @@ inline bool fil_names_write_if_was_clean(fil_space_t* space)
return(was_clean);
}
+
+bool fil_comp_algo_loaded(ulint comp_algo);
+
/** On a log checkpoint, reset fil_names_dirty_and_write() flags
and write out FILE_MODIFY and FILE_CHECKPOINT if needed.
@param[in] lsn checkpoint LSN
diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h
index a22867ad56a..2927da3c2fb 100644
--- a/storage/innobase/include/fil0pagecompress.h
+++ b/storage/innobase/include/fil0pagecompress.h
@@ -40,7 +40,7 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
ulint fil_page_compress(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
MY_ATTRIBUTE((nonnull, warn_unused_result));
@@ -52,9 +52,6 @@ ulint fil_page_compress(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress(
- byte* tmp_buf,
- byte* buf,
- ulint flags)
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ulint fil_page_decompress(byte *tmp_buf, byte *buf, uint32_t flags)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
#endif
diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h
index 8c11d61c5aa..9dfb3cc7561 100644
--- a/storage/innobase/include/fsp0file.h
+++ b/storage/innobase/include/fsp0file.h
@@ -56,7 +56,7 @@ public:
m_size(),
m_order(),
m_type(SRV_NOT_RAW),
- m_space_id(ULINT_UNDEFINED),
+ m_space_id(UINT32_MAX),
m_flags(),
m_exists(),
m_is_valid(),
@@ -67,7 +67,7 @@ public:
/* No op */
}
- Datafile(ulint flags, uint32_t size, ulint order)
+ Datafile(uint32_t flags, uint32_t size, ulint order)
:
m_filepath(),
m_filename(),
@@ -76,7 +76,7 @@ public:
m_size(size),
m_order(order),
m_type(SRV_NOT_RAW),
- m_space_id(ULINT_UNDEFINED),
+ m_space_id(UINT32_MAX),
m_flags(flags),
m_exists(),
m_is_valid(),
@@ -154,7 +154,7 @@ public:
}
/** Initialize the tablespace flags */
- void init(ulint flags) { m_flags= flags; }
+ void init(uint32_t flags) { m_flags= flags; }
/** Release the resources. */
virtual void shutdown();
@@ -198,7 +198,7 @@ public:
@param[in] flags The expected tablespace flags.
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
- dberr_t validate_to_dd(ulint space_id, ulint flags)
+ dberr_t validate_to_dd(uint32_t space_id, uint32_t flags)
MY_ATTRIBUTE((warn_unused_result));
/** Validates this datafile for the purpose of recovery.
@@ -254,24 +254,15 @@ public:
/** Get Datafile::m_space_id.
@return m_space_id */
- ulint space_id() const
- {
- return(m_space_id);
- }
+ uint32_t space_id() const { return m_space_id; }
/** Get Datafile::m_flags.
@return m_flags */
- ulint flags() const
- {
- return(m_flags);
- }
+ uint32_t flags() const { return m_flags; }
/**
@return true if m_handle is open, false if not */
- bool is_open() const
- {
- return(m_handle != OS_FILE_CLOSED);
- }
+ bool is_open() const { return m_handle != OS_FILE_CLOSED; }
/** Get Datafile::m_is_valid.
@return m_is_valid */
@@ -324,9 +315,9 @@ public:
@return the first data page */
const byte* get_first_page() const { return(m_first_page); }
- void set_space_id(ulint space_id) { m_space_id= space_id; }
+ void set_space_id(uint32_t space_id) { m_space_id= space_id; }
- void set_flags(ulint flags) { m_flags = flags; }
+ void set_flags(uint32_t flags) { m_flags = flags; }
private:
/** Free the filepath buffer. */
void free_filepath();
@@ -425,12 +416,12 @@ private:
/** Tablespace ID. Contained in the datafile header.
If this is a system tablespace, FSP_SPACE_ID is only valid
in the first datafile. */
- ulint m_space_id;
+ uint32_t m_space_id;
/** Tablespace flags. Contained in the datafile header.
If this is a system tablespace, FSP_SPACE_FLAGS are only valid
in the first datafile. */
- ulint m_flags;
+ uint32_t m_flags;
/** true if file already existed on startup */
bool m_exists;
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 7b66e58e488..52334056353 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -590,14 +590,11 @@ fseg_print(
/** Convert FSP_SPACE_FLAGS from the buggy MariaDB 10.1.0..10.1.20 format.
@param[in] flags the contents of FSP_SPACE_FLAGS
@return the flags corrected from the buggy MariaDB 10.1 format
-@retval ULINT_UNDEFINED if the flags are not in the buggy 10.1 format */
+@retval UINT32_MAX if the flags are not in the buggy 10.1 format */
MY_ATTRIBUTE((warn_unused_result, const))
-UNIV_INLINE
-ulint
-fsp_flags_convert_from_101(ulint flags)
+inline uint32_t fsp_flags_convert_from_101(uint32_t flags)
{
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
- return(ULINT_UNDEFINED););
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return UINT32_MAX;);
if (flags == 0 || fil_space_t::full_crc32(flags)) {
return(flags);
}
@@ -606,7 +603,7 @@ fsp_flags_convert_from_101(ulint flags)
/* The most significant FSP_SPACE_FLAGS bit that was ever set
by MariaDB 10.1.0 to 10.1.20 was bit 17 (misplaced DATA_DIR flag).
The flags must be less than 1<<18 in order to be valid. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
@@ -615,7 +612,7 @@ fsp_flags_convert_from_101(ulint flags)
ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
must also be set. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
/* Bits 6..10 denote compression in MariaDB 10.1.0 to 10.1.20.
@@ -644,19 +641,19 @@ fsp_flags_convert_from_101(ulint flags)
invalid (COMPRESSION_LEVEL=3 but COMPRESSION=0)
+0b00000: innodb_page_size=16k (looks like COMPRESSION=0)
??? Could actually be compressed; see PAGE_SSIZE below */
- const ulint level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
+ const uint32_t level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
flags);
if (FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) != (level != 0)
|| level > 9) {
/* The compression flags are not in the buggy MariaDB
10.1 format. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
if (!(~flags & FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101)) {
/* The ATOMIC_WRITES flags cannot be 0b11.
(The bits 11..12 should actually never be 0b11,
because in MySQL they would be SHARED|TEMPORARY.) */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
/* Bits 13..16 are the wrong position for PAGE_SSIZE, and they
@@ -671,23 +668,23 @@ fsp_flags_convert_from_101(ulint flags)
will be properly rejected by older MariaDB 10.1.x because they
would read as PAGE_SSIZE>=8 which is not valid. */
- const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
+ const uint32_t ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
/* the page_size is not between 4k and 64k;
16k should be encoded as 0, not 5 */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
- const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ const uint32_t zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
if (zssize == 0) {
/* not ROW_FORMAT=COMPRESSED */
} else if (zssize > (ssize ? ssize : 5)) {
/* invalid KEY_BLOCK_SIZE */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
} else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
| FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
/* both these flags should be set for
ROW_FORMAT=COMPRESSED */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
flags = ((flags & 0x3f) | ssize << FSP_FLAGS_POS_PAGE_SSIZE
@@ -702,19 +699,11 @@ fsp_flags_convert_from_101(ulint flags)
@param[in] actual flags read from FSP_SPACE_FLAGS
@return whether the flags match */
MY_ATTRIBUTE((warn_unused_result))
-UNIV_INLINE
-bool
-fsp_flags_match(ulint expected, ulint actual)
+inline bool fsp_flags_match(uint32_t expected, uint32_t actual)
{
- expected &= ~FSP_FLAGS_MEM_MASK;
- ut_ad(fil_space_t::is_valid_flags(expected, false));
-
- if (actual == expected) {
- return(true);
- }
-
- actual = fsp_flags_convert_from_101(actual);
- return(actual == expected);
+ expected&= ~FSP_FLAGS_MEM_MASK;
+ ut_ad(fil_space_t::is_valid_flags(expected, false));
+ return actual == expected || fsp_flags_convert_from_101(actual) == expected;
}
/** Determine the descriptor index within a descriptor page.
diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h
index ed65af52bc8..a2bb46d3125 100644
--- a/storage/innobase/include/fsp0space.h
+++ b/storage/innobase/include/fsp0space.h
@@ -47,22 +47,13 @@ public:
/** Data file iterator */
typedef files_t::const_iterator const_iterator;
- Tablespace()
- :
- m_files(),
- m_space_id(ULINT_UNDEFINED),
- m_path(),
- m_flags(),
- m_ignore_read_only(false)
- {
- /* No op */
- }
+ Tablespace() {}
virtual ~Tablespace()
{
shutdown();
ut_ad(m_files.empty());
- ut_ad(m_space_id == ULINT_UNDEFINED);
+ ut_ad(m_space_id == UINT32_MAX);
}
// Disable copying
@@ -104,22 +95,19 @@ public:
/** Set the space id of the tablespace
@param[in] space_id tablespace ID to set */
- void set_space_id(ulint space_id)
+ void set_space_id(uint32_t space_id)
{
- ut_ad(m_space_id == ULINT_UNDEFINED);
+ ut_ad(m_space_id == UINT32_MAX);
m_space_id = space_id;
}
/** Get the space id of the tablespace
@return m_space_id space id of the tablespace */
- ulint space_id() const
- {
- return(m_space_id);
- }
+ uint32_t space_id() const { return m_space_id; }
/** Set the tablespace flags
@param[in] fsp_flags tablespace flags */
- void set_flags(ulint fsp_flags)
+ void set_flags(uint32_t fsp_flags)
{
ut_ad(fil_space_t::is_valid_flags(fsp_flags, false));
m_flags = fsp_flags;
@@ -127,24 +115,15 @@ public:
/** Get the tablespace flags
@return m_flags tablespace flags */
- ulint flags() const
- {
- return(m_flags);
- }
+ uint32_t flags() const { return m_flags; }
/** Get the tablespace encryption mode
@return m_mode tablespace encryption mode */
- fil_encryption_t encryption_mode() const
- {
- return (m_mode);
- }
+ fil_encryption_t encryption_mode() const { return m_mode; }
/** Get the tablespace encryption key_id
@return m_key_id tablespace encryption key_id */
- uint32_t key_id() const
- {
- return (m_key_id);
- }
+ uint32_t key_id() const { return m_key_id; }
/** Set Ignore Read Only Status for tablespace.
@param[in] read_only_status read only status indicator */
@@ -210,24 +189,21 @@ private:
@param[in] file data file object */
void file_found(Datafile& file);
- /* DATA MEMBERS */
-
/** Tablespace ID */
- ulint m_space_id;
+ uint32_t m_space_id = UINT32_MAX;
+ /** Tablespace flags */
+ uint32_t m_flags = UINT32_MAX;
- /** Path where tablespace files will reside, not including a filename.*/
+ /** Path where tablespace files will reside, excluding a filename */
char* m_path;
- /** Tablespace flags */
- ulint m_flags;
-
/** Encryption mode and key_id */
fil_encryption_t m_mode;
uint32_t m_key_id;
protected:
/** Ignore server read only configuration for this tablespace. */
- bool m_ignore_read_only;
+ bool m_ignore_read_only = false;
};
#endif /* fsp0space_h */
diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h
index 2e0a395f71c..b6bdadd3501 100644
--- a/storage/innobase/include/fsp0sysspace.h
+++ b/storage/innobase/include/fsp0sysspace.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2016, 2021, 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
@@ -266,24 +267,15 @@ extern SysTablespace srv_tmp_space;
/** Check if the space_id is for a system-tablespace (shared + temp).
@param[in] id Space ID to check
@return true if id is a system tablespace, false if not. */
-UNIV_INLINE
-bool
-is_system_tablespace(ulint id)
+inline bool is_system_tablespace(uint32_t id)
{
- return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID);
+ return id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID;
}
/** Check if predefined shared tablespace.
@return true if predefined shared tablespace */
-UNIV_INLINE
-bool
-is_predefined_tablespace(
- ulint id)
+inline bool is_predefined_tablespace(uint32_t id)
{
- ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE);
- ut_ad(TRX_SYS_SPACE == 0);
- return(id == TRX_SYS_SPACE
- || id == SRV_TMP_SPACE_ID
- || srv_is_undo_tablespace(id));
+ return is_system_tablespace(id) || srv_is_undo_tablespace(id);
}
#endif /* fsp0sysspace_h */
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index 1912c31b744..9a23e840380 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -25,25 +25,24 @@ Created May 26, 2009 Vasil Dimov
*******************************************************/
#pragma once
-#include <cstddef>
+#include "ut0byte.h"
-/** The fil_space_t::id of the redo log. All persistent tablespaces
-have a smaller fil_space_t::id. */
-static constexpr size_t SRV_SPACE_ID_UPPER_BOUND= 0xFFFFFFF0;
+/** All persistent tablespaces have a smaller fil_space_t::id than this. */
+constexpr uint32_t SRV_SPACE_ID_UPPER_BOUND= 0xFFFFFFF0U;
/** The fil_space_t::id of the innodb_temporary tablespace. */
-#define SRV_TMP_SPACE_ID 0xFFFFFFFEU
-
-#include "ut0byte.h"
+constexpr uint32_t SRV_TMP_SPACE_ID= 0xFFFFFFFEU;
/* Possible values of innodb_compression_algorithm */
-#define PAGE_UNCOMPRESSED 0
-#define PAGE_ZLIB_ALGORITHM 1
-#define PAGE_LZ4_ALGORITHM 2
-#define PAGE_LZO_ALGORITHM 3
-#define PAGE_LZMA_ALGORITHM 4
+#define PAGE_UNCOMPRESSED 0
+#define PAGE_ZLIB_ALGORITHM 1
+#define PAGE_LZ4_ALGORITHM 2
+#define PAGE_LZO_ALGORITHM 3
+#define PAGE_LZMA_ALGORITHM 4
#define PAGE_BZIP2_ALGORITHM 5
#define PAGE_SNAPPY_ALGORITHM 6
-#define PAGE_ALGORITHM_LAST PAGE_SNAPPY_ALGORITHM
+#define PAGE_ALGORITHM_LAST PAGE_SNAPPY_ALGORITHM
+
+extern const char *page_compression_algorithms[];
/** @name Flags for inserting records in order
If records are inserted in order, there are the following
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index e38515f0402..c246b2ef513 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -365,7 +365,7 @@ dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block,
/** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead.
@param[in] space missing or to-be-discarded tablespace */
-void ibuf_delete_for_discarded_space(ulint space);
+void ibuf_delete_for_discarded_space(uint32_t space);
/** Contract the change buffer by reading pages to the buffer pool.
@return a lower limit for the combined size in bytes of entries which
diff --git a/storage/innobase/include/log0log.inl b/storage/innobase/include/log0log.inl
index c29c0bfa55f..73434737925 100644
--- a/storage/innobase/include/log0log.inl
+++ b/storage/innobase/include/log0log.inl
@@ -184,8 +184,8 @@ log_block_convert_lsn_to_no(
lsn_t lsn) /*!< in: lsn of a byte within the block */
{
return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) &
- DBUG_EVALUATE_IF("innodb_small_log_block_no_limit",
- 0xFUL, 0x3FFFFFFFUL)) + 1);
+ (DBUG_IF("innodb_small_log_block_no_limit")
+ ? 0xFUL : 0x3FFFFFFFUL)) + 1);
}
/** Calculate the CRC-32C checksum of a log block.
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index b1c09cfa2bc..6c47c135526 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -88,13 +88,13 @@ void recv_sys_justify_left_parsing_buf();
@param[in] len length of name, in bytes
@param[in] new_name new file name (NULL if not rename)
@param[in] new_len length of new_name, in bytes (0 if NULL) */
-extern void (*log_file_op)(ulint space_id, int type,
+extern void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
/** Report an operation which does INIT_PAGE for page0 during backup.
@param space_id tablespace identifier */
-extern void (*first_page_init)(ulint space_id);
+extern void (*first_page_init)(uint32_t space_id);
/** Stored redo log record */
struct log_rec_t
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 1b7455c046b..ffc9b85193f 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -260,10 +260,10 @@ struct mtr_t {
(needed for generating a FILE_MODIFY record)
@param[in] space_id user or system tablespace ID
@return the tablespace */
- fil_space_t* set_named_space_id(ulint space_id)
+ fil_space_t* set_named_space_id(uint32_t space_id)
{
ut_ad(!m_user_space_id);
- ut_d(m_user_space_id = static_cast<uint32_t>(space_id));
+ ut_d(m_user_space_id = space_id);
if (!space_id) {
return fil_system.sys_space;
} else {
@@ -281,7 +281,7 @@ struct mtr_t {
void set_named_space(fil_space_t* space)
{
ut_ad(!m_user_space_id);
- ut_d(m_user_space_id = static_cast<uint32_t>(space->id));
+ ut_d(m_user_space_id = space->id);
if (space->id) {
m_user_space = space;
}
@@ -292,7 +292,7 @@ struct mtr_t {
(needed for generating a FILE_MODIFY record)
@param[in] space tablespace
@return whether the mini-transaction is associated with the space */
- bool is_named_space(ulint space) const;
+ bool is_named_space(uint32_t space) const;
/** Check the tablespace associated with the mini-transaction
(needed for generating a FILE_MODIFY record)
@param[in] space tablespace
@@ -300,10 +300,10 @@ struct mtr_t {
bool is_named_space(const fil_space_t* space) const;
#endif /* UNIV_DEBUG */
- /** Acquire a tablespace X-latch.
- @param[in] space_id tablespace ID
- @return the tablespace object (never NULL) */
- fil_space_t* x_lock_space(ulint space_id);
+ /** Acquire a tablespace X-latch.
+ @param space_id tablespace ID
+ @return the tablespace object (never NULL) */
+ fil_space_t *x_lock_space(uint32_t space_id);
/** Acquire a shared rw-latch. */
void s_lock(
@@ -667,7 +667,7 @@ public:
@param space_id tablespace identifier
@param path file path
@param new_path new file path for type=FILE_RENAME */
- inline void log_file_op(mfile_type_t type, ulint space_id,
+ inline void log_file_op(mfile_type_t type, uint32_t space_id,
const char *path,
const char *new_path= nullptr);
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 52096d48313..9d1d55545ac 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -24,8 +24,7 @@ Index build routines using a merge sort
Created 13/06/2005 Jan Lindstrom
*******************************************************/
-#ifndef row0merge_h
-#define row0merge_h
+#pragma once
#include "que0types.h"
#include "trx0types.h"
@@ -36,7 +35,8 @@ Created 13/06/2005 Jan Lindstrom
#include "row0mysql.h"
#include "lock0types.h"
#include "srv0srv.h"
-#include "ut0stage.h"
+
+class ut_stage_alter_t;
/* Reserve free space from every block for key_version */
#define ROW_MERGE_RESERVE_SIZE 4
@@ -273,15 +273,16 @@ row_merge_build_indexes(
const col_collations* col_collate)
MY_ATTRIBUTE((warn_unused_result));
-/********************************************************************//**
-Write a buffer to a block. */
-void
-row_merge_buf_write(
-/*================*/
- const row_merge_buf_t* buf, /*!< in: sorted buffer */
- const merge_file_t* of, /*!< in: output file */
- row_merge_block_t* block) /*!< out: buffer for writing to file */
- MY_ATTRIBUTE((nonnull));
+/** Write a buffer to a block.
+@param buf sorted buffer
+@param block buffer for writing to file
+@param blob_file blob file handle for doing bulk insert operation */
+dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
+#ifndef DBUG_OFF
+ const merge_file_t *of, /*!< output file */
+#endif
+ row_merge_block_t *block,
+ merge_file_t *blob_file= nullptr);
/********************************************************************//**
Sort a buffer. */
@@ -416,4 +417,79 @@ row_merge_read_rec(
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
MY_ATTRIBUTE((warn_unused_result));
-#endif /* row0merge.h */
+
+/** Buffer for bulk insert */
+class row_merge_bulk_t
+{
+ /** Buffer for each index in the table. main memory
+ buffer for sorting the index */
+ row_merge_buf_t *m_merge_buf;
+ /** Block for IO operation */
+ row_merge_block_t *m_block= nullptr;
+ /** File to store the buffer and used for merge sort */
+ merge_file_t *m_merge_files= nullptr;
+ /** Temporary file to be used for merge sort */
+ pfs_os_file_t m_tmpfd;
+ /** Allocate memory for merge file data structure */
+ ut_allocator<row_merge_block_t> m_alloc;
+ /** Storage for description for the m_alloc */
+ ut_new_pfx_t m_block_pfx;
+ /** Temporary file to store the blob */
+ merge_file_t m_blob_file;
+ /** Storage for description for the crypt_block */
+ ut_new_pfx_t m_crypt_pfx;
+ /** Block for encryption */
+ row_merge_block_t *m_crypt_block= nullptr;
+public:
+ /** Constructor.
+ Create all merge files, merge buffer for all the table indexes
+ expect fts indexes.
+ Create a merge block which is used to write IO operation
+ @param table table which undergoes bulk insert operation */
+ row_merge_bulk_t(dict_table_t *table);
+
+ /** Destructor.
+ Remove all merge files, merge buffer for all table indexes. */
+ ~row_merge_bulk_t();
+
+ /** Remove all buffer for the table indexes */
+ void remove_all_bulk_buffer();
+
+ /** Clean the merge buffer for the given index number */
+ void clean_bulk_buffer(ulint index_no);
+
+ /** Create the temporary file for the given index number
+ @retval true if temporary file creation went well */
+ bool create_tmp_file(ulint index_no);
+
+ /** Write the merge buffer to the tmp file for the given
+ index number.
+ @param index_no buffer to be written for the index */
+ dberr_t write_to_tmp_file(ulint index_no);
+
+ /** Add the tuple to the merge buffer for the given index.
+ If the buffer ran out of memory then write the buffer into
+ the temporary file and do insert the tuple again.
+ @param row tuple to be inserted
+ @param ind index to be buffered
+ @param trx bulk transaction */
+ dberr_t bulk_insert_buffered(const dtuple_t &row, const dict_index_t &ind,
+ trx_t *trx);
+
+ /** Do bulk insert operation into the index tree from
+ buffer or merge file if exists
+ @param index_no index to be inserted
+ @param trx bulk transaction */
+ dberr_t write_to_index(ulint index_no, trx_t *trx);
+
+ /** Do bulk insert for the buffered insert for the table.
+ @param table table which undergoes for bulk insert operation
+ @param trx bulk transaction */
+ dberr_t write_to_table(dict_table_t *table, trx_t *trx);
+
+ /** Allocate block for writing the buffer into disk */
+ dberr_t alloc_block();
+
+ /** Init temporary files for each index */
+ void init_tmp_file();
+};
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index ad892ac9ae9..4cd77b08a60 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -254,12 +254,12 @@ extern bool srv_was_started;
extern char* srv_undo_dir;
/** Number of undo tablespaces to use. */
-extern ulong srv_undo_tablespaces;
+extern uint srv_undo_tablespaces;
/** The number of UNDO tablespaces that are active (hosting some rollback
segment). It is quite possible that some of the tablespaces doesn't host
any of the rollback-segment based on configuration used. */
-extern ulint srv_undo_tablespaces_active;
+extern uint32_t srv_undo_tablespaces_active;
/** Maximum size of undo tablespace. */
extern unsigned long long srv_max_undo_log_size;
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 58ec5ab1707..bb348d7ef8b 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -173,7 +173,7 @@ trx_undo_report_row_operation(
const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
- MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1,2), warn_unused_result));
/** status bit used for trx_undo_prev_version_build() */
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index ad941b89691..0450be89cfb 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri
#include "fts0fts.h"
#include "read0types.h"
#include "ilist.h"
+#include "row0merge.h"
#include <vector>
@@ -433,6 +434,11 @@ class trx_mod_table_time_t
/** Whether the modified table is a FTS auxiliary table */
bool fts_aux_table= false;
#endif /* UNIV_DEBUG */
+
+ /** Buffer to store insert opertion */
+ row_merge_bulk_t *bulk_store= nullptr;
+
+ friend struct trx_t;
public:
/** Constructor
@param rows number of modified rows so far */
@@ -466,8 +472,14 @@ public:
first_versioned= BULK;
}
- /** Notify the start of a bulk insert operation */
- void start_bulk_insert() { first|= BULK; }
+ /** Notify the start of a bulk insert operation
+ @param table table to do bulk operation */
+ void start_bulk_insert(dict_table_t *table)
+ {
+ first|= BULK;
+ if (!table->is_temporary())
+ bulk_store= new row_merge_bulk_t(table);
+ }
/** Notify the end of a bulk insert operation */
void end_bulk_insert() { first&= ~BULK; }
@@ -493,6 +505,33 @@ public:
bool is_aux_table() const { return fts_aux_table; }
#endif /* UNIV_DEBUG */
+
+ /** @return the first undo record that modified the table */
+ undo_no_t get_first() const
+ {
+ ut_ad(valid());
+ return LIMIT & first;
+ }
+
+ /** Add the tuple to the transaction bulk buffer for the given index.
+ @param entry tuple to be inserted
+ @param index bulk insert for the index
+ @param trx transaction */
+ dberr_t bulk_insert_buffered(const dtuple_t &entry,
+ const dict_index_t &index, trx_t *trx)
+ {
+ return bulk_store->bulk_insert_buffered(entry, index, trx);
+ }
+
+ /** Do bulk insert operation present in the buffered operation
+ @return DB_SUCCESS or error code */
+ dberr_t write_bulk(dict_table_t *table, trx_t *trx);
+
+ /** @return whether the buffer storage exist */
+ bool bulk_buffer_exist() const
+ {
+ return bulk_store && is_bulk_insert();
+ }
};
/** Collection of persistent tables and their first modification
@@ -1110,7 +1149,32 @@ public:
return false;
}
+ /** @return logical modification time of a table only
+ if the table has bulk buffer exist in the transaction */
+ trx_mod_table_time_t *check_bulk_buffer(dict_table_t *table)
+ {
+ if (UNIV_LIKELY(!bulk_insert))
+ return nullptr;
+ ut_ad(!check_unique_secondary);
+ ut_ad(!check_foreigns);
+ auto it= mod_tables.find(table);
+ if (it == mod_tables.end() || !it->second.bulk_buffer_exist())
+ return nullptr;
+ return &it->second;
+ }
+
+ /** Do the bulk insert for the buffered insert operation
+ for the transaction.
+ @return DB_SUCCESS or error code */
+ dberr_t bulk_insert_apply()
+ {
+ return UNIV_UNLIKELY(bulk_insert) ? bulk_insert_apply_low(): DB_SUCCESS;
+ }
+
private:
+ /** Apply the buffered bulk inserts. */
+ dberr_t bulk_insert_apply_low();
+
/** Assign a rollback segment for modifying temporary tables.
@return the assigned rollback segment */
trx_rseg_t *assign_temp_rseg();
diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h
index 07c1c6a756b..d6ce902977c 100644
--- a/storage/innobase/include/trx0types.h
+++ b/storage/innobase/include/trx0types.h
@@ -38,7 +38,7 @@ the terminating NUL character. */
static const ulint TRX_ID_MAX_LEN = 17;
/** Space id of the transaction system page (the system tablespace) */
-static const ulint TRX_SYS_SPACE = 0;
+static constexpr uint32_t TRX_SYS_SPACE= 0;
/** Page number of the transaction system page */
#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index c5f62f6cf57..7ff8eb56068 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -206,36 +206,6 @@ management to ensure correct alignment for doubles etc. */
========================
*/
-#ifdef HAVE_LZO
-#define IF_LZO(A,B) A
-#else
-#define IF_LZO(A,B) B
-#endif
-
-#ifdef HAVE_LZ4
-#define IF_LZ4(A,B) A
-#else
-#define IF_LZ4(A,B) B
-#endif
-
-#ifdef HAVE_LZMA
-#define IF_LZMA(A,B) A
-#else
-#define IF_LZMA(A,B) B
-#endif
-
-#ifdef HAVE_BZIP2
-#define IF_BZIP2(A,B) A
-#else
-#define IF_BZIP2(A,B) B
-#endif
-
-#ifdef HAVE_SNAPPY
-#define IF_SNAPPY(A,B) A
-#else
-#define IF_SNAPPY(A,B) B
-#endif
-
#if defined (HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
#define IF_PUNCH_HOLE(A,B) A
#else
@@ -505,7 +475,7 @@ it is read or written. */
#include "ut0lst.h"
#include "ut0ut.h"
-extern ulong srv_page_size_shift;
+extern uint32_t srv_page_size_shift;
extern ulong srv_page_size;
/* Dimension of spatial object we support so far. It has its root in
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index 63628cc169f..aa0cfb9e060 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -304,12 +304,9 @@ private:
pool = UT_NEW_NOKEY(PoolType(m_size));
if (pool != NULL) {
-
- ut_ad(n_pools <= m_pools.size());
-
m_pools.push_back(pool);
- ib::info() << "Number of pools: "
+ ib::info() << "Number of transaction pools: "
<< m_pools.size();
added = true;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index b0651d8b8da..deda40fd924 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -608,10 +608,10 @@ struct file_name_t {
/** Map of dirty tablespaces during recovery */
typedef std::map<
- ulint,
+ uint32_t,
file_name_t,
- std::less<ulint>,
- ut_allocator<std::pair<const ulint, file_name_t> > > recv_spaces_t;
+ std::less<uint32_t>,
+ ut_allocator<std::pair<const uint32_t, file_name_t> > > recv_spaces_t;
static recv_spaces_t recv_spaces;
@@ -1033,11 +1033,11 @@ fail:
@param[in] len length of name, in bytes
@param[in] new_name new file name (NULL if not rename)
@param[in] new_len length of new_name, in bytes (0 if NULL) */
-void (*log_file_op)(ulint space_id, int type,
+void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
-void (*first_page_init)(ulint space_id);
+void (*first_page_init)(uint32_t space_id);
/** Information about initializing page contents during redo log processing.
FIXME: Rely on recv_sys.pages! */
@@ -1301,10 +1301,15 @@ same_space:
f.name = fname.name;
f.status = file_name_t::NORMAL;
} else {
- ib::error() << "Tablespace " << space_id
- << " has been found in two places: '"
- << f.name << "' and '" << name << "'."
- " You must delete one of them.";
+ sql_print_error("InnoDB: Tablespace " UINT32PF
+ " has been found"
+ " in two places:"
+ " '%.*s' and '%s'."
+ " You must delete"
+ " one of them.",
+ space_id,
+ int(f.name.size()),
+ f.name.data(), name);
recv_sys.set_corrupt_fs();
}
break;
@@ -1327,10 +1332,12 @@ same_space:
Enable some more diagnostics when
forcing recovery. */
- ib::info()
- << "At LSN: " << recv_sys.recovered_lsn
- << ": unable to open file " << name
- << " for tablespace " << space_id;
+ sql_print_information(
+ "InnoDB: At LSN: " LSN_PF
+ ": unable to open file %s"
+ " for tablespace " UINT32PF,
+ recv_sys.recovered_lsn,
+ name, space_id);
}
break;
@@ -1634,10 +1641,11 @@ fail:
}
if (recv_sys.report(time(NULL))) {
- ib::info() << "Read redo log up to LSN=" << *start_lsn;
- service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
- "Read redo log up to LSN=" LSN_PF,
- *start_lsn);
+ sql_print_information("InnoDB: Read redo log up to LSN="
+ LSN_PF, *start_lsn);
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Read redo log up to LSN=" LSN_PF, *start_lsn);
}
if (*start_lsn != end_lsn) {
@@ -1708,9 +1716,9 @@ static bool redo_file_sizes_are_correct()
if (it == paths.end())
return true;
- ib::error() << "Log file " << *it << " is of different size "
- << get_size(*it) << " bytes than other log files " << size
- << " bytes!";
+ sql_print_error("InnoDB: Log file %.*s is of different size " UINT64PF
+ " bytes than other log files " UINT64PF " bytes!",
+ int(it->size()), it->data(), get_size(*it), size);
return false;
}
@@ -1889,13 +1897,11 @@ static dberr_t recv_log_recover_10_4()
ulint cksum = log_block_get_checksum(buf);
if (UNIV_UNLIKELY(crc != cksum)) {
- ib::error() << "Invalid log block checksum."
- << " block: "
- << log_block_get_hdr_no(buf)
- << " checkpoint no: "
- << log_block_get_checkpoint_no(buf)
- << " expected: " << crc
- << " found: " << cksum;
+ sql_print_error("InnoDB: Invalid log block checksum."
+ " block: " ULINTPF " checkpoint no: " ULINTPF
+ " expected: " ULINTPF " found: " ULINTPF,
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf), crc, cksum);
return DB_CORRUPTION;
}
@@ -2023,7 +2029,7 @@ recv_find_max_checkpoint(ulint* max_field)
if (*max_field == 0) {
/* Before 10.2.2, we could get here during database
- initialization if we created an LOG_FILE_NAME file that
+ initialization if we created an ib_logfile0 file that
was filled with zeroes, and were killed. After
10.2.2, we would reject such a file already earlier,
when checking the file header. */
@@ -2235,17 +2241,19 @@ loop:
goto eom_found;
if (UNIV_LIKELY((*l & 0x70) != RESERVED));
else if (srv_force_recovery)
- ib::warn() << "Ignoring unknown log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring unknown log record at LSN " LSN_PF,
+ recovered_lsn);
else
{
malformed:
- ib::error() << "Malformed log record;"
- " set innodb_force_recovery=1 to ignore.";
+ sql_print_error("InnoDB: Malformed log record;"
+ " set innodb_force_recovery=1 to ignore.");
corrupted:
const size_t trailing_bytes= std::min<size_t>(100, size_t(end - l));
- ib::info() << "Dump from the start of the mini-transaction (LSN="
- << start_lsn << ") to "
- << trailing_bytes << " bytes after the record:";
+ sql_print_information("InnoDB: Dump from the start of the"
+ " mini-transaction (LSN=" LSN_PF ") to %zu"
+ " bytes after the record:",
+ start_lsn, trailing_bytes);
ut_print_buf(stderr, log, l - log + trailing_bytes);
putc('\n', stderr);
found_corrupt_log= true;
@@ -2262,7 +2270,7 @@ corrupted:
const uint32_t addlen= mlog_decode_varint(l);
if (UNIV_UNLIKELY(addlen == MLOG_DECODE_ERROR))
{
- ib::error() << "Corrupted record length";
+ sql_print_error("InnoDB: Corrupted record length");
goto corrupted;
}
rlen= addlen + 15;
@@ -2326,7 +2334,8 @@ record_corrupted:
/* FREE_PAGE,INIT_PAGE cannot be with same_page flag */
if (!srv_force_recovery)
goto malformed;
- ib::warn() << "Ignoring malformed log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring malformed log record at LSN "
+ LSN_PF, recovered_lsn);
last_offset= 1; /* the next record must not be same_page */
continue;
}
@@ -2339,12 +2348,13 @@ record_corrupted:
page_id_corrupted:
if (!srv_force_recovery)
{
- ib::error() << "Corrupted page identifier at " << recovered_lsn
- << "; set innodb_force_recovery=1 to ignore the record.";
+ sql_print_error("InnoDB: Corrupted page identifier at " LSN_PF
+ "; set innodb_force_recovery=1 to ignore the record.",
+ recovered_lsn);
goto corrupted;
}
- ib::warn() << "Ignoring corrupted page identifier at LSN "
- << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring corrupted page identifier at LSN "
+ LSN_PF, recovered_lsn);
continue;
}
space_id= mlog_decode_varint(l);
@@ -2605,7 +2615,8 @@ same_page:
default:
if (!srv_force_recovery)
goto malformed;
- ib::warn() << "Ignoring malformed log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring malformed log record at LSN "
+ LSN_PF, recovered_lsn);
continue;
case FILE_DELETE:
case FILE_MODIFY:
@@ -2615,13 +2626,13 @@ same_page:
file_rec_error:
if (!srv_force_recovery)
{
- ib::error() << "Corrupted file-level record;"
- " set innodb_force_recovery=1 to ignore.";
+ sql_print_error("InnoDB: Corrupted file-level record;"
+ " set innodb_force_recovery=1 to ignore.");
goto corrupted;
}
- ib::warn() << "Ignoring corrupted file-level record at LSN "
- << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring corrupted file-level record"
+ " at LSN " LSN_PF, recovered_lsn);
continue;
}
/* fall through */
@@ -2778,12 +2789,13 @@ static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr,
if (skipped_after_init) {
skipped_after_init = false;
ut_ad(end_lsn == page_lsn);
- if (end_lsn != page_lsn)
- ib::warn()
- << "The last skipped log record LSN "
- << end_lsn
- << " is not equal to page LSN "
- << page_lsn;
+ if (end_lsn != page_lsn) {
+ sql_print_warning(
+ "InnoDB: The last skipped log record"
+ " LSN " LSN_PF
+ " is not equal to page LSN " LSN_PF,
+ end_lsn, page_lsn);
+ }
}
end_lsn = l->lsn;
@@ -2930,10 +2942,12 @@ done:
ut_ad(!block || !recv_sys.pages.empty());
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);
+ const size_t n = recv_sys.pages.size();
+ sql_print_information("InnoDB: To recover: %zu pages from log",
+ n);
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "To recover: %zu pages"
+ " from log", n);
}
return block;
@@ -3061,7 +3075,7 @@ static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i)
if (p != page_nos)
{
mysql_mutex_unlock(&recv_sys.mutex);
- buf_read_recv_pages(page_id.space(), page_nos, ulint(p - page_nos));
+ buf_read_recv_pages(page_id.space(), {page_nos, p});
mysql_mutex_lock(&recv_sys.mutex);
}
}
@@ -3257,8 +3271,8 @@ void recv_sys_t::apply(bool last_batch)
const char *msg= last_batch
? "Starting final batch to recover "
: "Starting a batch to recover ";
- const ulint n= pages.size();
- ib::info() << msg << n << " pages from redo log.";
+ const size_t n= pages.size();
+ sql_print_information("InnoDB: %s %zu pages from redo log.", msg, n);
sd_notifyf(0, "STATUS=%s" ULINTPF " pages from redo log", msg, n);
apply_log_recs= true;
@@ -3380,7 +3394,8 @@ next_free_block:
continue;
}
if (is_corrupt_fs() && !srv_force_recovery)
- ib::info() << "Set innodb_force_recovery=1 to ignore corrupted pages.";
+ sql_print_information("InnoDB: Set innodb_force_recovery=1"
+ " to ignore corrupted pages.");
mysql_mutex_unlock(&mutex);
return;
}
@@ -3625,14 +3640,18 @@ static bool recv_scan_log_recs(
recv_needed_recovery = true;
if (srv_read_only_mode) {
- ib::warn() << "innodb_read_only"
- " prevents crash recovery";
+ sql_print_warning(
+ "InnoDB: innodb_read_only"
+ " prevents crash recovery");
return(true);
}
- ib::info() << "Starting crash recovery from"
- " checkpoint LSN=" << checkpoint_lsn
- << "," << recv_sys.scanned_lsn;
+ sql_print_information("InnoDB: Starting"
+ " crash recovery from"
+ " checkpoint LSN=" LSN_PF
+ "," LSN_PF,
+ checkpoint_lsn,
+ recv_sys.scanned_lsn);
}
/* We were able to find more log data: add it to the
@@ -3646,15 +3665,17 @@ static bool recv_scan_log_recs(
if (recv_sys.len + 4 * OS_FILE_LOG_BLOCK_SIZE
>= recv_parsing_buf_size) {
- ib::error() << "Log parsing buffer overflow."
- " Recovery may have failed!";
+ sql_print_error("InnoDB: Log parsing buffer"
+ " overflow."
+ " Recovery may have failed!");
recv_sys.set_corrupt_log();
if (!srv_force_recovery) {
- ib::error()
- << "Set innodb_force_recovery"
- " to ignore this error.";
+ sql_print_information(
+ "InnoDB: Set"
+ " innodb_force_recovery"
+ " to ignore this error.");
return(true);
}
} else if (!recv_sys.is_corrupt_log()) {
@@ -3801,29 +3822,38 @@ recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
if (i->second.name.find("/#sql") != std::string::npos) {
- ib::warn() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << " when"
- " restoring a (partial?) backup. All redo log"
- " for this file will be ignored!";
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s when"
+ " restoring a (partial?) backup."
+ " All redo log"
+ " for this file will be ignored!",
+ i->first, int(i->second.name.size()),
+ i->second.name.data());
}
return(err);
}
if (srv_force_recovery == 0) {
- ib::error() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << ".";
+ sql_print_error("InnoDB: Tablespace " UINT32PF " was not"
+ " found at %.*s.", i->first,
+ int(i->second.name.size()),
+ i->second.name.data());
if (err == DB_SUCCESS) {
- ib::error() << "Set innodb_force_recovery=1 to"
+ sql_print_information(
+ "InnoDB: Set innodb_force_recovery=1 to"
" ignore this and to permanently lose"
- " all changes to the tablespace.";
+ " all changes to the tablespace.");
err = DB_TABLESPACE_NOT_FOUND;
}
} else {
- ib::warn() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << ", and"
- " innodb_force_recovery was set. All redo log"
- " for this tablespace will be ignored!";
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s"
+ ", and innodb_force_recovery was set."
+ " All redo log for this tablespace"
+ " will be ignored!",
+ i->first, int(i->second.name.size()),
+ i->second.name.data());
}
return(err);
@@ -3846,7 +3876,7 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
for (recv_sys_t::map::iterator p = recv_sys.pages.begin();
p != recv_sys.pages.end();) {
ut_ad(!p->second.log.empty());
- const ulint space = p->first.space();
+ const uint32_t space = p->first.space();
if (is_predefined_tablespace(space)) {
next:
p++;
@@ -3898,20 +3928,25 @@ func_exit:
missing_tablespace = true;
- if (srv_force_recovery > 0) {
- ib::warn() << "Tablespace " << rs.first
- <<" was not found at " << rs.second.name
- <<", and innodb_force_recovery was set."
- <<" All redo log for this tablespace"
- <<" will be ignored!";
+ if (srv_force_recovery) {
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s,"
+ " and innodb_force_recovery was set."
+ " All redo log for this tablespace"
+ " will be ignored!",
+ rs.first, int(rs.second.name.size()),
+ rs.second.name.data());
continue;
}
if (!rescan) {
- ib::info() << "Tablespace " << rs.first
- << " was not found at '"
- << rs.second.name << "', but there"
- <<" were no modifications either.";
+ sql_print_information("InnoDB: Tablespace " UINT32PF
+ " was not found at '%.*s',"
+ " but there were"
+ " no modifications either.",
+ rs.first,
+ int(rs.second.name.size()),
+ rs.second.name.data());
}
}
@@ -3960,9 +3995,10 @@ recv_init_crash_recovery_spaces(bool rescan, bool& missing_tablespace)
std::move(rs.second.freed_ranges));
}
} else if (rs.second.name == "") {
- ib::error() << "Missing FILE_CREATE, FILE_DELETE"
- " or FILE_MODIFY before FILE_CHECKPOINT"
- " for tablespace " << rs.first;
+ sql_print_error("InnoDB: Missing FILE_CREATE,"
+ " FILE_DELETE or FILE_MODIFY"
+ " before FILE_CHECKPOINT"
+ " for tablespace " UINT32PF, rs.first);
recv_sys.set_corrupt_log();
return(DB_CORRUPTION);
} else {
@@ -4019,18 +4055,19 @@ static dberr_t recv_rename_files()
only be possible if the recovery of both files was deferred
(no valid page 0 is contained in either file). We shall not
rename the file, just rename the metadata. */
- ib::info() << "Renaming tablespace metadata " << id
- << " from '" << old << "' to '" << r.second
- << "' that is also associated with tablespace "
- << other->id;
+ sql_print_information("InnoDB: Renaming tablespace metadata " UINT32PF
+ " from '%s' to '%s' that is also associated"
+ " with tablespace " UINT32PF,
+ id, old, new_name, other->id);
space->chain.start->name= mem_strdup(new_name);
ut_free(old);
}
else if (!os_file_status(new_name, &exists, &ftype) || exists)
{
- ib::error() << "Cannot replay rename of tablespace " << id
- << " from '" << old << "' to '" << r.second <<
- (exists ? "' because the target file exists" : "'");
+ sql_print_error("InnoDB: Cannot replay rename of tablespace " UINT32PF
+ " from '%s' to '%s'%s",
+ id, old, new_name, exists ?
+ " because the target file exists" : "");
err= DB_TABLESPACE_EXISTS;
}
else
@@ -4038,8 +4075,8 @@ static dberr_t recv_rename_files()
mysql_mutex_unlock(&fil_system.mutex);
err= space->rename(new_name, false);
if (err != DB_SUCCESS)
- ib::error() << "Cannot replay rename of tablespace " << id
- << " to '" << r.second << "': " << err;
+ sql_print_error("InnoDB: Cannot replay rename of tablespace "
+ UINT32PF " to '%s: %s", new_name, ut_strerr(err));
goto done;
}
mysql_mutex_unlock(&fil_system.mutex);
@@ -4080,9 +4117,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex));
if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) {
-
- ib::info() << "innodb_force_recovery=6 skips redo log apply";
-
+ sql_print_information("InnoDB: innodb_force_recovery=6"
+ " skips redo log apply");
return(DB_SUCCESS);
}
@@ -4093,7 +4129,6 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
err = recv_find_max_checkpoint(&max_cp_field);
if (err != DB_SUCCESS) {
-
recv_sys.recovered_lsn = log_sys.get_lsn();
mysql_mutex_unlock(&log_sys.mutex);
return(err);
@@ -4154,7 +4189,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
if (recv_sys.is_corrupt_log() && !srv_force_recovery) {
mysql_mutex_unlock(&log_sys.mutex);
- ib::warn() << "Log scan aborted at LSN " << contiguous_lsn;
+ sql_print_warning("InnoDB: Log scan aborted at LSN " LSN_PF,
+ contiguous_lsn);
return(DB_ERROR);
}
@@ -4162,13 +4198,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
lsn_t scan_lsn = log_sys.log.scanned_lsn;
if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) {
mysql_mutex_unlock(&log_sys.mutex);
- ib::error err;
- err << "Missing FILE_CHECKPOINT";
- if (end_lsn) {
- err << " at " << end_lsn;
- }
- err << " between the checkpoint " << checkpoint_lsn
- << " and the end " << scan_lsn << ".";
+ sql_print_error("InnoDB: Missing FILE_CHECKPOINT"
+ " at " LSN_PF
+ " between the checkpoint " LSN_PF
+ " and the end " LSN_PF ".",
+ end_lsn, checkpoint_lsn, scan_lsn);
return(DB_ERROR);
}
@@ -4198,29 +4232,26 @@ completed:
ut_ad(!srv_log_file_created);
if (checkpoint_lsn + sizeof_checkpoint < flush_lsn) {
- ib::warn()
- << "Are you sure you are using the right "
- << LOG_FILE_NAME
- << " to start up the database? Log sequence "
- "number in the "
- << LOG_FILE_NAME << " is " << checkpoint_lsn
- << ", less than the log sequence number in "
- "the first system tablespace file header, "
- << flush_lsn << ".";
+ sql_print_warning("InnoDB: Are you sure you are using"
+ " the right ib_logfile0"
+ " to start up the database?"
+ " The checkpoint is " LSN_PF
+ ", less than the"
+ " log sequence number " LSN_PF
+ " in the system tablespace.",
+ checkpoint_lsn, flush_lsn);
}
if (!recv_needed_recovery) {
-
- ib::info()
- << "The log sequence number " << flush_lsn
- << " in the system tablespace does not match"
- " the log sequence number "
- << checkpoint_lsn << " in the "
- << LOG_FILE_NAME << "!";
+ sql_print_information(
+ "InnoDB: The log sequence number " LSN_PF
+ " in the system tablespace does not match"
+ " the log checkpoint " LSN_PF
+ " in ib_logfile0!", flush_lsn, checkpoint_lsn);
if (srv_read_only_mode) {
- ib::error() << "innodb_read_only"
- " prevents crash recovery";
+ sql_print_error("InnoDB: innodb_read_only"
+ " prevents crash recovery");
mysql_mutex_unlock(&log_sys.mutex);
return(DB_READ_ONLY);
}
@@ -4310,21 +4341,20 @@ completed:
&& (log_sys.log.scanned_lsn < checkpoint_lsn
|| log_sys.log.scanned_lsn < recv_max_page_lsn)) {
- ib::error() << "We scanned the log up to "
- << log_sys.log.scanned_lsn
- << ". A checkpoint was at " << checkpoint_lsn << " and"
- " the maximum LSN on a database page was "
- << recv_max_page_lsn << ". It is possible that the"
- " database is now corrupt!";
+ sql_print_error("InnoDB: We scanned the log up to " LSN_PF "."
+ " A checkpoint was at " LSN_PF
+ " and the maximum LSN on a database page was "
+ LSN_PF ". It is possible that the"
+ " database is now corrupt!",
+ log_sys.log.scanned_lsn, checkpoint_lsn,
+ recv_max_page_lsn);
}
if (recv_sys.recovered_lsn < checkpoint_lsn) {
mysql_mutex_unlock(&log_sys.mutex);
-
- ib::error() << "Recovered only to lsn:"
- << recv_sys.recovered_lsn
- << " checkpoint_lsn: " << checkpoint_lsn;
-
+ sql_print_error("InnoDB: Recovered only to lsn: " LSN_PF
+ " checkpoint_lsn: " LSN_PF,
+ recv_sys.recovered_lsn, checkpoint_lsn);
return(DB_ERROR);
}
@@ -4385,11 +4415,11 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id,
{
if (page_id.page_no() == 0)
{
- ulint flags= fsp_header_get_flags(page);
+ uint32_t flags= fsp_header_get_flags(page);
if (!fil_space_t::is_valid_flags(flags, page_id.space()))
{
- ulint cflags= fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED)
+ uint32_t cflags= fsp_flags_convert_from_101(flags);
+ if (cflags == UINT32_MAX)
{
ib::warn() << "Ignoring a doublewrite copy of page " << page_id
<< "due to invalid flags " << ib::hex(flags);
diff --git a/storage/innobase/lz4.cmake b/storage/innobase/lz4.cmake
deleted file mode 100644
index a908dd3b73e..00000000000
--- a/storage/innobase/lz4.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZ4 AUTO CACHE STRING
- "Build with lz4. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZ4)
- IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
- CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB)
- CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
-
- IF (HAVE_LZ4_SHARED_LIB AND HAVE_LZ4_H)
- SET(HAVE_INNODB_LZ4 TRUE)
- ADD_DEFINITIONS(-DHAVE_LZ4=1)
- IF (HAVE_LZ4_COMPRESS_DEFAULT)
- ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
- ENDIF()
- LINK_LIBRARIES(lz4)
- ELSE()
- IF (WITH_INNODB_LZ4 STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lz4 library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZ4 HAVE_INNODB_LZ4 "LZ4 compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/lzma.cmake b/storage/innobase/lzma.cmake
deleted file mode 100644
index 3060139c27c..00000000000
--- a/storage/innobase/lzma.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZMA AUTO CACHE STRING
- "Build with lzma. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZMA)
- IF (WITH_INNODB_LZMA STREQUAL "ON" OR WITH_INNODB_LZMA STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lzma.h HAVE_LZMA_H)
- CHECK_LIBRARY_EXISTS(lzma lzma_stream_buffer_decode "" HAVE_LZMA_DECODE)
- CHECK_LIBRARY_EXISTS(lzma lzma_easy_buffer_encode "" HAVE_LZMA_ENCODE)
-
- IF (HAVE_LZMA_DECODE AND HAVE_LZMA_ENCODE AND HAVE_LZMA_H)
- SET(HAVE_INNODB_LZMA TRUE)
- ADD_DEFINITIONS(-DHAVE_LZMA=1)
- LINK_LIBRARIES(lzma)
- ELSE()
- IF (WITH_INNODB_LZMA STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lzma library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZMA HAVE_INNODB_LZMA "LZMA compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/lzo.cmake b/storage/innobase/lzo.cmake
deleted file mode 100644
index ca2de6ab1c5..00000000000
--- a/storage/innobase/lzo.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZO AUTO CACHE STRING
- "Build with lzo. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZO)
- IF (WITH_INNODB_LZO STREQUAL "ON" OR WITH_INNODB_LZO STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
- CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB)
-
- IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H)
- SET(HAVE_INNODB_LZO TRUE)
- ADD_DEFINITIONS(-DHAVE_LZO=1)
- LINK_LIBRARIES(lzo2)
- ELSE()
- IF (WITH_INNODB_LZO STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lzo library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZO HAVE_INNODB_LZO "LZO compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 6f4a4ab9353..4626957b55d 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -477,7 +477,7 @@ void mtr_t::commit_files(lsn_t checkpoint_lsn)
@param[in] space tablespace
@return whether the mini-transaction is associated with the space */
bool
-mtr_t::is_named_space(ulint space) const
+mtr_t::is_named_space(uint32_t space) const
{
ut_ad(!m_user_space || m_user_space->id != TRX_SYS_SPACE);
return !is_logged() || m_user_space_id == space ||
@@ -499,8 +499,7 @@ bool mtr_t::is_named_space(const fil_space_t* space) const
/** Acquire a tablespace X-latch.
@param[in] space_id tablespace ID
@return the tablespace object (never NULL) */
-fil_space_t*
-mtr_t::x_lock_space(ulint space_id)
+fil_space_t *mtr_t::x_lock_space(uint32_t space_id)
{
fil_space_t* space;
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 44783f72972..5cbf5803577 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -4105,14 +4105,14 @@ corrupted:
FSP_HEADER_OFFSET + FSP_SPACE_ID + page, 4)
? ULINT_UNDEFINED
: mach_read_from_4(FIL_PAGE_SPACE_ID + page);
- ulint flags= fsp_header_get_flags(page);
+ uint32_t flags= fsp_header_get_flags(page);
const uint32_t size= fsp_header_get_field(page, FSP_SIZE);
const uint32_t free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT);
const uint32_t free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page);
if (!fil_space_t::is_valid_flags(flags, space->id))
{
- ulint cflags= fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED)
+ uint32_t cflags= fsp_flags_convert_from_101(flags);
+ if (cflags == UINT32_MAX)
{
invalid:
ib::error() << "Expected tablespace flags "
@@ -4122,8 +4122,8 @@ invalid:
goto corrupted;
}
- ulint cf= cflags & ~FSP_FLAGS_MEM_MASK;
- ulint sf= space->flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t cf= cflags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t sf= space->flags & ~FSP_FLAGS_MEM_MASK;
if (!fil_space_t::is_flags_equal(cf, sf) &&
!fil_space_t::is_flags_equal(sf, cf))
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index cc8844c3bd4..86e9662439a 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -875,7 +875,9 @@ loop:
if (t_ctx.rows_added[t_ctx.buf_used] && !processed) {
row_merge_buf_sort(buf[t_ctx.buf_used], NULL);
row_merge_buf_write(buf[t_ctx.buf_used],
+#ifndef DBUG_OFF
merge_file[t_ctx.buf_used],
+#endif
block[t_ctx.buf_used]);
if (!row_merge_write(merge_file[t_ctx.buf_used]->fd,
@@ -941,8 +943,11 @@ exit:
for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {
if (t_ctx.rows_added[i]) {
row_merge_buf_sort(buf[i], NULL);
- row_merge_buf_write(
- buf[i], merge_file[i], block[i]);
+ row_merge_buf_write(buf[i],
+#ifndef DBUG_OFF
+ merge_file[i],
+#endif
+ block[i]);
/* Write to temp file, only if records have
been flushed to temp file before (offset > 0):
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 590f9d73990..65c17a4e4b1 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -41,12 +41,8 @@ Created 2012-02-08 by Sunny Bains.
#include "fil0pagecompress.h"
#include "trx0undo.h"
#include "lock0lock.h"
-#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
-#endif
-#ifdef HAVE_SNAPPY
#include "snappy-c.h"
-#endif
#include "scope.h"
@@ -83,9 +79,9 @@ struct row_index_t {
in the exporting server */
byte* m_name; /*!< Index name */
- ulint m_space; /*!< Space where it is placed */
+ uint32_t m_space; /*!< Space where it is placed */
- ulint m_page_no; /*!< Root page number */
+ uint32_t m_page_no; /*!< Root page number */
ulint m_type; /*!< Index type */
@@ -406,14 +402,14 @@ class AbstractCallback
public:
/** Constructor
@param trx covering transaction */
- AbstractCallback(trx_t* trx, ulint space_id)
+ AbstractCallback(trx_t* trx, uint32_t space_id)
:
m_zip_size(0),
m_trx(trx),
m_space(space_id),
m_xdes(),
- m_xdes_page_no(ULINT_UNDEFINED),
- m_space_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
+ m_xdes_page_no(UINT32_MAX),
+ m_space_flags(UINT32_MAX) UNIV_NOTHROW { }
/** Free any extent descriptor instance */
virtual ~AbstractCallback()
@@ -436,10 +432,7 @@ public:
}
/** @return the tablespace flags */
- ulint get_space_flags() const
- {
- return(m_space_flags);
- }
+ uint32_t get_space_flags() const { return m_space_flags; }
/**
Set the name of the physical file and the file handle that is used
@@ -470,7 +463,7 @@ public:
virtual dberr_t operator()(buf_block_t* block) UNIV_NOTHROW = 0;
/** @return the tablespace identifier */
- ulint get_space_id() const { return m_space; }
+ uint32_t get_space_id() const { return m_space; }
bool is_interrupted() const { return trx_is_interrupted(m_trx); }
@@ -513,7 +506,7 @@ protected:
@param page page contents
@return DB_SUCCESS or error code. */
dberr_t set_current_xdes(
- ulint page_no,
+ uint32_t page_no,
const page_t* page) UNIV_NOTHROW
{
m_xdes_page_no = page_no;
@@ -578,19 +571,16 @@ protected:
trx_t* m_trx;
/** Space id of the file being iterated over. */
- ulint m_space;
-
- /** Current size of the space in pages */
- ulint m_size;
+ uint32_t m_space;
/** Current extent descriptor page */
xdes_t* m_xdes;
/** Physical page offset in the file of the extent descriptor */
- ulint m_xdes_page_no;
+ uint32_t m_xdes_page_no;
/** Flags value read from the header page */
- ulint m_space_flags;
+ uint32_t m_space_flags;
};
/** Determine the page size to use for traversing the tablespace
@@ -606,8 +596,8 @@ AbstractCallback::init(
m_space_flags = fsp_header_get_flags(page);
if (!fil_space_t::is_valid_flags(m_space_flags, true)) {
- ulint cflags = fsp_flags_convert_from_101(m_space_flags);
- if (cflags == ULINT_UNDEFINED) {
+ uint32_t cflags = fsp_flags_convert_from_101(m_space_flags);
+ if (cflags == UINT32_MAX) {
return(DB_CORRUPTION);
}
m_space_flags = cflags;
@@ -636,8 +626,7 @@ AbstractCallback::init(
return(DB_CORRUPTION);
}
- m_size = mach_read_from_4(page + FSP_SIZE);
- if (m_space == ULINT_UNDEFINED) {
+ if (m_space == UINT32_MAX) {
m_space = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID
+ page);
}
@@ -671,13 +660,13 @@ struct FetchIndexRootPages : public AbstractCallback {
/** Index information gathered from the .ibd file. */
struct Index {
- Index(index_id_t id, ulint page_no)
+ Index(index_id_t id, uint32_t page_no)
:
m_id(id),
m_page_no(page_no) { }
index_id_t m_id; /*!< Index id */
- ulint m_page_no; /*!< Root page number */
+ uint32_t m_page_no; /*!< Root page number */
};
/** Constructor
@@ -685,7 +674,7 @@ struct FetchIndexRootPages : public AbstractCallback {
@param table table definition in server .*/
FetchIndexRootPages(const dict_table_t* table, trx_t* trx)
:
- AbstractCallback(trx, ULINT_UNDEFINED),
+ AbstractCallback(trx, UINT32_MAX),
m_table(table), m_index(0, 0) UNIV_NOTHROW { }
/** Destructor */
@@ -730,7 +719,7 @@ dberr_t FetchIndexRootPages::operator()(buf_block_t* block) UNIV_NOTHROW
m_index.m_page_no = block->page.id().page_no();
/* Check that the tablespace flags match the table flags. */
- ulint expected = dict_tf_to_fsp_flags(m_table->flags);
+ const uint32_t expected = dict_tf_to_fsp_flags(m_table->flags);
if (!fsp_flags_match(expected, m_space_flags)) {
ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
@@ -847,7 +836,7 @@ public:
@param cfg config of table being imported.
@param space_id tablespace identifier
@param trx transaction covering the import */
- PageConverter(row_import* cfg, ulint space_id, trx_t* trx)
+ PageConverter(row_import* cfg, uint32_t space_id, trx_t* trx)
:
AbstractCallback(trx, space_id),
m_cfg(cfg),
@@ -1419,7 +1408,7 @@ row_import::set_root_by_name() UNIV_NOTHROW
/* We've already checked that it exists. */
ut_a(index != 0);
- index->page = static_cast<uint32_t>(cfg_index->m_page_no);
+ index->page = cfg_index->m_page_no;
}
}
@@ -1476,8 +1465,7 @@ row_import::set_root_by_heuristic() UNIV_NOTHROW
cfg_index[i].m_srv_index = index;
- index->page = static_cast<uint32_t>(
- cfg_index[i++].m_page_no);
+ index->page = cfg_index[i++].m_page_no;
}
}
@@ -3010,8 +2998,8 @@ row_import_read_meta_data(
/* decrypt and decompress page if needed */
static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
- size_t space_flags, span<byte> page,
- size_t space_id, byte *page_compress_buf)
+ uint32_t space_flags, span<byte> page,
+ uint32_t space_id, byte *page_compress_buf)
{
auto *data= page.data();
@@ -3020,8 +3008,8 @@ static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
if (!buf_page_verify_crypt_checksum(data, space_flags))
return DB_CORRUPTION;
- if (dberr_t err= fil_space_decrypt(space_id, space_crypt, data,
- page.size(), space_flags, data))
+ if (dberr_t err= fil_space_decrypt(space_id, space_flags, space_crypt,
+ data, page.size(), data))
return err;
}
@@ -3054,13 +3042,11 @@ static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
static size_t get_buf_size()
{
- return srv_page_size
-#ifdef HAVE_LZO
- + LZO1X_1_15_MEM_COMPRESS
-#elif defined HAVE_SNAPPY
- + snappy_max_compressed_length(srv_page_size)
-#endif
- ;
+ return srv_page_size + (
+ provider_service_lzo->is_loaded ? LZO1X_1_15_MEM_COMPRESS :
+ provider_service_snappy->is_loaded ? snappy_max_compressed_length(srv_page_size) :
+ 0
+ );
}
/* find, parse instant metadata, performing variaous checks,
@@ -3110,7 +3096,7 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
if (!fil_space_t::is_valid_flags(space_flags, true))
{
auto cflags= fsp_flags_convert_from_101(space_flags);
- if (cflags == ULINT_UNDEFINED)
+ if (cflags == UINT32_MAX)
{
ib::error() << "Invalid FSP_SPACE_FLAGS=" << ib::hex(space_flags);
return DB_CORRUPTION;
@@ -3728,12 +3714,8 @@ page_corrupted:
if (!buf_page_verify_crypt_checksum(readptr, m_space_flags))
goto page_corrupted;
- if (ENCRYPTION_KEY_NOT_ENCRYPTED ==
- buf_page_get_key_version(readptr, m_space_flags))
- goto page_corrupted;
-
- if ((err= fil_space_decrypt(get_space_id(), iter.crypt_data, readptr, size,
- m_space_flags, readptr)))
+ if ((err= fil_space_decrypt(get_space_id(), m_space_flags, iter.crypt_data,
+ readptr, size, readptr)))
goto func_exit;
}
@@ -3776,7 +3758,7 @@ static dberr_t fil_iterate(
return DB_OUT_OF_MEMORY;
}
- ulint actual_space_id = 0;
+ uint32_t actual_space_id = 0;
const bool full_crc32 = fil_space_t::full_crc32(
callback.get_space_flags());
@@ -3903,9 +3885,9 @@ page_corrupted:
if ((err = fil_space_decrypt(
actual_space_id,
+ callback.get_space_flags(),
iter.crypt_data, dst,
callback.physical_size(),
- callback.get_space_flags(),
src))) {
goto func_exit;
}
@@ -4448,11 +4430,9 @@ row_import_for_mysql(
we will not be writing any redo log for it before we have invoked
fil_space_t::set_imported() to declare it a persistent tablespace. */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
-
table->space = fil_ibd_open(
2, FIL_TYPE_IMPORT, table->space_id,
- fsp_flags, name, filepath, &err);
+ dict_tf_to_fsp_flags(table->flags), name, filepath, &err);
ut_ad((table->space == NULL) == (err != DB_SUCCESS));
DBUG_EXECUTE_IF("ib_import_open_tablespace_failure",
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 9b1d9a8b57f..427fdedee60 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2642,19 +2642,25 @@ commit_exit:
&& !index->table->skip_alter_undo
&& !index->table->n_rec_locks
&& !index->table->is_active_ddl()
+ && !index->table->has_spatial_index()
&& !trx->is_wsrep() /* FIXME: MDEV-24623 */
&& !thd_is_slave(trx->mysql_thd) /* FIXME: MDEV-24622 */) {
DEBUG_SYNC_C("empty_root_page_insert");
+ trx->bulk_insert = true;
+
if (!index->table->is_temporary()) {
err = lock_table(index->table, NULL, LOCK_X, thr);
if (err != DB_SUCCESS) {
trx->error_state = err;
+ trx->bulk_insert = false;
goto commit_exit;
}
if (index->table->n_rec_locks) {
+avoid_bulk:
+ trx->bulk_insert = false;
goto skip_bulk_insert;
}
@@ -2669,9 +2675,20 @@ commit_exit:
#else /* BTR_CUR_HASH_ADAPT */
index->table->bulk_trx_id = trx->id;
#endif /* BTR_CUR_HASH_ADAPT */
- }
- trx->bulk_insert = true;
+ /* Write TRX_UNDO_EMPTY undo log and
+ start buffering the insert operation */
+ err = trx_undo_report_row_operation(
+ thr, index, entry,
+ nullptr, 0, nullptr, nullptr,
+ nullptr);
+
+ if (err != DB_SUCCESS) {
+ goto avoid_bulk;
+ }
+
+ goto commit_exit;
+ }
}
skip_bulk_insert:
@@ -3193,7 +3210,7 @@ row_ins_sec_index_entry(
bool check_foreign) /*!< in: true if check
foreign table is needed, false otherwise */
{
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
mem_heap_t* offsets_heap;
mem_heap_t* heap;
trx_id_t trx_id = 0;
@@ -3270,13 +3287,24 @@ row_ins_index_entry(
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr) /*!< in: query thread */
{
- ut_ad(thr_get_trx(thr)->id || index->table->no_rollback()
+ trx_t* trx = thr_get_trx(thr);
+
+ ut_ad(trx->id || index->table->no_rollback()
|| index->table->is_temporary());
DBUG_EXECUTE_IF("row_ins_index_entry_timeout", {
DBUG_SET("-d,row_ins_index_entry_timeout");
return(DB_LOCK_WAIT);});
+ if (index->is_btree()) {
+ if (auto t= trx->check_bulk_buffer(index->table)) {
+ /* MDEV-25036 FIXME: check also foreign key
+ constraints */
+ ut_ad(!trx->check_foreigns);
+ return t->bulk_insert_buffered(*entry, *index, trx);
+ }
+ }
+
if (index->is_primary()) {
return row_ins_clust_index_entry(index, entry, thr, 0);
} else {
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 8914021d09d..7683c4dbedc 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -257,9 +257,18 @@ public:
@param[in] row_buf row_buf the sorted data tuples,
or NULL if fd, block will be used instead
@param[in,out] btr_bulk btr bulk instance
+@param[in] table_total_rows total rows of old table
+@param[in] pct_progress total progress percent untill now
+@param[in] pct_cost current progress percent
+@param[in] crypt_block buffer for encryption or NULL
+@param[in] space space id
@param[in,out] stage performance schema accounting object, used by
ALTER TABLE. If not NULL stage->begin_phase_insert() will be called initially
and then stage->inc() will be called for each record that is processed.
+@param[in] blob_file To read big column field data from
+ the given blob file. It is
+ applicable only for bulk insert
+ operation
@return DB_SUCCESS or error number */
static MY_ATTRIBUTE((warn_unused_result))
dberr_t
@@ -270,14 +279,13 @@ row_merge_insert_index_tuples(
row_merge_block_t* block,
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
- const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const double pct_progress, /*!< in: total progress
- percent until now */
- const double pct_cost, /*!< in: current progress percent
- */
- row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
- ulint space, /*!< in: space id */
- ut_stage_alter_t* stage = NULL);
+ const ib_uint64_t table_total_rows,
+ double pct_progress,
+ double pct_cost,
+ row_merge_block_t* crypt_block,
+ ulint space,
+ ut_stage_alter_t* stage= nullptr,
+ merge_file_t* blob_file= nullptr);
/******************************************************//**
Encode an index record. */
@@ -315,35 +323,23 @@ row_merge_buf_encode(
*b += size;
}
-/******************************************************//**
-Allocate a sort buffer.
-@return own: sort buffer */
static MY_ATTRIBUTE((malloc, nonnull))
row_merge_buf_t*
row_merge_buf_create_low(
-/*=====================*/
- mem_heap_t* heap, /*!< in: heap where allocated */
- dict_index_t* index, /*!< in: secondary index */
- ulint max_tuples, /*!< in: maximum number of
- data tuples */
- ulint buf_size) /*!< in: size of the buffer,
- in bytes */
+ row_merge_buf_t *buf, mem_heap_t *heap, dict_index_t *index)
{
- row_merge_buf_t* buf;
-
- ut_ad(max_tuples > 0);
-
- ut_ad(max_tuples <= srv_sort_buf_size);
-
- buf = static_cast<row_merge_buf_t*>(mem_heap_zalloc(heap, buf_size));
- buf->heap = heap;
- buf->index = index;
- buf->max_tuples = max_tuples;
- buf->tuples = static_cast<mtuple_t*>(
- ut_malloc_nokey(2 * max_tuples * sizeof *buf->tuples));
- buf->tmp_tuples = buf->tuples + max_tuples;
-
- return(buf);
+ ulint max_tuples = srv_sort_buf_size
+ / std::max<ulint>(1, dict_index_get_min_size(index));
+ ut_ad(max_tuples > 0);
+ ut_ad(max_tuples <= srv_sort_buf_size);
+
+ buf->heap = heap;
+ buf->index = index;
+ buf->max_tuples = max_tuples;
+ buf->tuples = static_cast<mtuple_t*>(
+ ut_malloc_nokey(2 * max_tuples * sizeof *buf->tuples));
+ buf->tmp_tuples = buf->tuples + max_tuples;
+ return(buf);
}
/******************************************************//**
@@ -355,18 +351,16 @@ row_merge_buf_create(
dict_index_t* index) /*!< in: secondary index */
{
row_merge_buf_t* buf;
- ulint max_tuples;
ulint buf_size;
mem_heap_t* heap;
- max_tuples = srv_sort_buf_size
- / std::max<ulint>(1, dict_index_get_min_size(index));
-
buf_size = (sizeof *buf);
heap = mem_heap_create(buf_size);
- buf = row_merge_buf_create_low(heap, index, max_tuples, buf_size);
+ buf = static_cast<row_merge_buf_t*>(
+ mem_heap_zalloc(heap, buf_size));
+ row_merge_buf_create_low(buf, heap, index);
return(buf);
}
@@ -459,6 +453,68 @@ row_merge_buf_redundant_convert(
dfield_set_data(field, buf, len);
}
+/** Insert the tuple into bulk buffer insert operation
+@param buf merge buffer for the index operation
+@param table bulk insert operation for the table
+@param row tuple to be inserted
+@return number of rows inserted */
+static ulint row_merge_bulk_buf_add(row_merge_buf_t* buf,
+ const dict_table_t &table,
+ const dtuple_t &row)
+{
+ if (buf->n_tuples >= buf->max_tuples)
+ return 0;
+
+ const dict_index_t *index= buf->index;
+ ulint n_fields= dict_index_get_n_fields(index);
+ mtuple_t *entry= &buf->tuples[buf->n_tuples];
+ ulint data_size= 0;
+ ulint extra_size= UT_BITS_IN_BYTES(unsigned(index->n_nullable));
+ dfield_t *field= entry->fields= static_cast<dfield_t*>(
+ mem_heap_alloc(buf->heap, n_fields * sizeof *entry->fields));
+ const dict_field_t *ifield= dict_index_get_nth_field(index, 0);
+
+ for (ulint i = 0; i < n_fields; i++, field++, ifield++)
+ {
+ dfield_copy(field, &row.fields[i]);
+ ulint len= dfield_get_len(field);
+ const dict_col_t* const col= ifield->col;
+
+ if (dfield_is_null(field))
+ continue;
+
+ ulint fixed_len= ifield->fixed_len;
+
+ if (fixed_len);
+ else if (len < 128 || (!DATA_BIG_COL(col)))
+ extra_size++;
+ else
+ extra_size += 2;
+ data_size += len;
+ }
+
+ /* Add to the total size of the record in row_merge_block_t
+ the encoded length of extra_size and the extra bytes (extra_size).
+ See row_merge_buf_write() for the variable-length encoding
+ of extra_size. */
+ data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
+
+ /* Reserve bytes for the end marker of row_merge_block_t. */
+ if (buf->total_size + data_size >= srv_sort_buf_size)
+ return 0;
+
+ buf->total_size += data_size;
+ buf->n_tuples++;
+
+ field= entry->fields;
+
+ do
+ dfield_dup(field++, buf->heap);
+ while (--n_fields);
+
+ return 1;
+}
+
/** Insert a data tuple into a sort buffer.
@param[in,out] buf sort buffer
@param[in] fts_index fts index to be created
@@ -991,25 +1047,135 @@ row_merge_buf_sort(
buf->tuples, buf->tmp_tuples, 0, buf->n_tuples);
}
-/******************************************************//**
-Write a buffer to a block. */
-void
-row_merge_buf_write(
-/*================*/
- const row_merge_buf_t* buf, /*!< in: sorted buffer */
- const merge_file_t* of UNIV_UNUSED,
- /*!< in: output file */
- row_merge_block_t* block) /*!< out: buffer for writing to file */
+/** Write the blob field data to temporary file and fill the offset,
+length in the field data
+@param field tuple field
+@param blob_file file to store the blob data
+@param heap heap to store the blob offset and length
+@return DB_SUCCESS if successful */
+static dberr_t row_merge_write_blob_to_tmp_file(
+ dfield_t *field, merge_file_t *blob_file,mem_heap_t **heap)
+{
+ if (blob_file->fd == OS_FILE_CLOSED)
+ {
+ blob_file->fd= row_merge_file_create_low(nullptr);
+ if (blob_file->fd == OS_FILE_CLOSED)
+ return DB_OUT_OF_MEMORY;
+ }
+ uint64_t val= blob_file->offset;
+ uint32_t len= field->len;
+ dberr_t err= os_file_write(
+ IORequestWrite, "(bulk insert)", blob_file->fd,
+ field->data, blob_file->offset * srv_page_size, len);
+
+ if (err != DB_SUCCESS)
+ return err;
+
+ byte *data= static_cast<byte*>
+ (mem_heap_alloc(*heap, BTR_EXTERN_FIELD_REF_SIZE));
+
+ /* Write zeroes for first 8 bytes */
+ memset(data, 0, 8);
+ /* Write offset for next 8 bytes */
+ mach_write_to_8(data + 8, val);
+ /* Write length of the blob in 4 bytes */
+ mach_write_to_4(data + 16, len);
+ blob_file->offset+= field->len;
+ blob_file->n_rec++;
+ dfield_set_data(field, data, BTR_EXTERN_FIELD_REF_SIZE);
+ dfield_set_ext(field);
+ return err;
+}
+
+/** This function is invoked when tuple size is greater than
+innodb_sort_buffer_size. Basically it recreates the tuple
+by writing the blob field to the temporary file.
+@param entry index fields to be encode the blob
+@param blob_file file to store the blob data
+@param heap heap to store the blob offset and blob length
+@return tuple which fits into sort_buffer_size */
+static dtuple_t* row_merge_buf_large_tuple(const dtuple_t &entry,
+ merge_file_t *blob_file,
+ mem_heap_t **heap)
+{
+ if (!*heap)
+ *heap= mem_heap_create(DTUPLE_EST_ALLOC(entry.n_fields));
+
+ dtuple_t *tuple= dtuple_copy(&entry, *heap);
+ for (ulint i= 0; i < tuple->n_fields; i++)
+ {
+ dfield_t *field= &tuple->fields[i];
+ if (dfield_is_null(field) || field->len <= 2000)
+ continue;
+
+ dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap);
+ if (err != DB_SUCCESS)
+ return nullptr;
+ }
+
+ return tuple;
+}
+
+
+/** Write the field data whose length is more than 2000 bytes
+into blob temporary file and write offset, length into the
+tuple field
+@param entry index fields to be encode the blob
+@param n_fields number of fields in the entry
+@param heap heap to store the blob offset and blob length
+@param blob_file file to store the blob data */
+static dberr_t row_merge_buf_blob(const mtuple_t *entry, ulint n_fields,
+ mem_heap_t **heap, merge_file_t *blob_file)
+{
+
+ if (!*heap)
+ *heap= mem_heap_create(100);
+
+ for (ulint i= 0; i < n_fields; i++)
+ {
+ dfield_t *field= &entry->fields[i];
+ if (dfield_is_null(field) || field->len <= 2000)
+ continue;
+
+ dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap);
+ if (err != DB_SUCCESS)
+ return err;
+ }
+
+ return DB_SUCCESS;
+}
+
+/** Write a buffer to a block.
+@param buf sorted buffer
+@param block buffer for writing to file
+@param blob_file blob file handle for doing bulk insert operation */
+dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
+#ifndef DBUG_OFF
+ const merge_file_t *of, /*!< output file */
+#endif
+ row_merge_block_t *block,
+ merge_file_t *blob_file)
{
const dict_index_t* index = buf->index;
ulint n_fields= dict_index_get_n_fields(index);
byte* b = &block[0];
+ mem_heap_t* blob_heap = nullptr;
+ dberr_t err = DB_SUCCESS;
DBUG_ENTER("row_merge_buf_write");
for (ulint i = 0; i < buf->n_tuples; i++) {
const mtuple_t* entry = &buf->tuples[i];
+ if (blob_file) {
+ ut_ad(buf->index->is_primary());
+ err = row_merge_buf_blob(
+ entry, n_fields, &blob_heap, blob_file);
+ if (err != DB_SUCCESS) {
+ goto func_exit;
+ }
+ }
+
row_merge_buf_encode(&b, index, entry, n_fields);
ut_ad(b < &block[srv_sort_buf_size]);
@@ -1022,7 +1188,7 @@ row_merge_buf_write(
/* Write an "end-of-chunk" marker. */
ut_a(b < &block[srv_sort_buf_size]);
- ut_a(b == &block[0] + buf->total_size);
+ ut_a(b == &block[0] + buf->total_size || blob_file);
*b++ = 0;
#ifdef HAVE_valgrind
/* The rest of the block is uninitialized. Initialize it
@@ -1032,7 +1198,12 @@ row_merge_buf_write(
DBUG_LOG("ib_merge_sort",
"write " << reinterpret_cast<const void*>(b) << ','
<< of->fd << ',' << of->offset << " EOF");
- DBUG_VOID_RETURN;
+func_exit:
+ if (blob_heap) {
+ mem_heap_free(blob_heap);
+ }
+
+ DBUG_RETURN(err);
}
/******************************************************//**
@@ -2696,7 +2867,11 @@ write_buffers:
ut_ad(file->n_rec > 0);
- row_merge_buf_write(buf, file, block);
+ row_merge_buf_write(buf,
+#ifndef DBUG_OFF
+ file,
+#endif
+ block);
if (!row_merge_write(
file->fd, file->offset++,
@@ -3372,7 +3547,7 @@ row_merge_sort(
*/
#ifndef __sun__
/* Progress report only for "normal" indexes. */
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_init(trx->mysql_thd, 1);
}
#endif /* __sun__ */
@@ -3389,7 +3564,7 @@ row_merge_sort(
show processlist progress field */
/* Progress report only for "normal" indexes. */
#ifndef __sun__
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
}
#endif /* __sun__ */
@@ -3419,7 +3594,7 @@ row_merge_sort(
/* Progress report only for "normal" indexes. */
#ifndef __sun__
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_end(trx->mysql_thd);
}
#endif /* __sun__ */
@@ -3427,6 +3602,39 @@ row_merge_sort(
DBUG_RETURN(error);
}
+/** Copy the blob from the given blob file and store it
+in field data for the tuple
+@param tuple tuple to be inserted
+@param heap heap to allocate the memory for the blob storage
+@param blob_file file to handle blob data */
+static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap,
+ merge_file_t *blob_file)
+{
+ for (ulint i = 0; i < dtuple_get_n_fields(tuple); i++)
+ {
+ dfield_t *field= dtuple_get_nth_field(tuple, i);
+ const byte *field_data= static_cast<byte*>(dfield_get_data(field));
+ ulint field_len= dfield_get_len(field);
+ if (!dfield_is_ext(field))
+ continue;
+
+ ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE);
+ ut_ad(!dfield_is_null(field));
+
+ ut_ad(mach_read_from_8(field_data) == 0);
+ uint64_t offset= mach_read_from_8(field_data + 8);
+ uint32_t len= mach_read_from_4(field_data + 16);
+
+ byte *data= (byte*) mem_heap_alloc(heap, len);
+ if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, data,
+ offset, len, nullptr))
+ return err;
+ dfield_set_data(field, data, len);
+ }
+
+ return DB_SUCCESS;
+}
+
/** Copy externally stored columns to the data tuple.
@param[in] mrec record containing BLOB pointers,
or NULL to use tuple instead
@@ -3512,18 +3720,6 @@ row_merge_mtuple_to_dtuple(
dtuple->n_fields * sizeof *mtuple->fields);
}
-/** Insert sorted data tuples to the index.
-@param[in] index index to be inserted
-@param[in] old_table old table
-@param[in] fd file descriptor
-@param[in,out] block file buffer
-@param[in] row_buf row_buf the sorted data tuples,
-or NULL if fd, block will be used instead
-@param[in,out] btr_bulk btr bulk instance
-@param[in,out] stage performance schema accounting object, used by
-ALTER TABLE. If not NULL stage->begin_phase_insert() will be called initially
-and then stage->inc() will be called for each record that is processed.
-@return DB_SUCCESS or error number */
static MY_ATTRIBUTE((warn_unused_result))
dberr_t
row_merge_insert_index_tuples(
@@ -3533,14 +3729,13 @@ row_merge_insert_index_tuples(
row_merge_block_t* block,
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
- const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const double pct_progress, /*!< in: total progress
- percent until now */
- const double pct_cost, /*!< in: current progress percent
- */
- row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
- ulint space, /*!< in: space id */
- ut_stage_alter_t* stage)
+ const ib_uint64_t table_total_rows,
+ double pct_progress,
+ double pct_cost,
+ row_merge_block_t* crypt_block,
+ ulint space,
+ ut_stage_alter_t* stage,
+ merge_file_t* blob_file)
{
const byte* b;
mem_heap_t* heap;
@@ -3651,7 +3846,16 @@ row_merge_insert_index_tuples(
}
}
- if (dict_index_is_clust(index) && dtuple_get_n_ext(dtuple)) {
+ ut_ad(!dtuple_get_n_ext(dtuple) || index->is_primary());
+
+ if (!dtuple_get_n_ext(dtuple)) {
+ } else if (blob_file) {
+ error = row_merge_copy_blob_from_file(
+ dtuple, tuple_heap, blob_file);
+ if (error != DB_SUCCESS) {
+ break;
+ }
+ } else {
/* Off-page columns can be fetched safely
when concurrent modifications to the table
are disabled. (Purge can process delete-marked
@@ -3668,7 +3872,8 @@ row_merge_insert_index_tuples(
row_merge_read_clustered_index() scan
will go through row_log_table_apply(). */
row_merge_copy_blobs(
- mrec, offsets, old_table->space->zip_size(),
+ mrec, offsets,
+ old_table->space->zip_size(),
dtuple, tuple_heap);
}
@@ -4856,6 +5061,337 @@ func_exit:
clust_index->lock.x_unlock();
}
- DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE(););
DBUG_RETURN(error);
}
+
+dberr_t row_merge_bulk_t::alloc_block()
+{
+ if (m_block)
+ return DB_SUCCESS;
+ m_block= m_alloc.allocate_large_dontdump(
+ 3 * srv_sort_buf_size, &m_block_pfx);
+ if (m_block == nullptr)
+ return DB_OUT_OF_MEMORY;
+
+ m_crypt_pfx.m_size= 0;
+ TRASH_ALLOC(&m_crypt_pfx, sizeof m_crypt_pfx);
+ if (log_tmp_is_encrypted())
+ {
+ m_crypt_block= static_cast<row_merge_block_t*>(
+ m_alloc.allocate_large(3 * srv_sort_buf_size, &m_crypt_pfx));
+ if (!m_crypt_block)
+ return DB_OUT_OF_MEMORY;
+ }
+ return DB_SUCCESS;
+}
+
+row_merge_bulk_t::row_merge_bulk_t(dict_table_t *table)
+{
+ ulint n_index= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ n_index++;
+ }
+
+ m_merge_buf= static_cast<row_merge_buf_t*>(
+ ut_zalloc_nokey(n_index * sizeof *m_merge_buf));
+
+ ulint i= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ mem_heap_t *heap= mem_heap_create(100);
+ row_merge_buf_create_low(&m_merge_buf[i], heap, index);
+ i++;
+ }
+
+ m_tmpfd= OS_FILE_CLOSED;
+ m_blob_file.fd= OS_FILE_CLOSED;
+ m_blob_file.offset= 0;
+ m_blob_file.n_rec= 0;
+}
+
+row_merge_bulk_t::~row_merge_bulk_t()
+{
+ ulint i= 0;
+ dict_table_t *table= m_merge_buf[0].index->table;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ row_merge_buf_free(&m_merge_buf[i]);
+ if (m_merge_files)
+ row_merge_file_destroy(&m_merge_files[i]);
+ i++;
+ }
+
+ row_merge_file_destroy_low(m_tmpfd);
+
+ row_merge_file_destroy(&m_blob_file);
+
+ ut_free(m_merge_buf);
+
+ ut_free(m_merge_files);
+
+ if (m_block)
+ m_alloc.deallocate_large(m_block, &m_block_pfx);
+
+ if (m_crypt_block)
+ m_alloc.deallocate_large(m_crypt_block, &m_crypt_pfx);
+}
+
+void row_merge_bulk_t::init_tmp_file()
+{
+ if (m_merge_files)
+ return;
+
+ ulint n_index= 0;
+ dict_table_t *table= m_merge_buf[0].index->table;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ n_index++;
+ }
+
+ m_merge_files= static_cast<merge_file_t*>(
+ ut_malloc_nokey(n_index * sizeof *m_merge_files));
+
+ for (ulint i= 0; i < n_index; i++)
+ {
+ m_merge_files[i].fd= OS_FILE_CLOSED;
+ m_merge_files[i].offset= 0;
+ m_merge_files[i].n_rec= 0;
+ }
+}
+
+void row_merge_bulk_t::clean_bulk_buffer(ulint index_no)
+{
+ mem_heap_empty(m_merge_buf[index_no].heap);
+ m_merge_buf[index_no].total_size = m_merge_buf[index_no].n_tuples = 0;
+}
+
+bool row_merge_bulk_t::create_tmp_file(ulint index_no)
+{
+ return row_merge_file_create_if_needed(
+ &m_merge_files[index_no], &m_tmpfd,
+ m_merge_buf[index_no].n_tuples, NULL);
+}
+
+dberr_t row_merge_bulk_t::write_to_tmp_file(ulint index_no)
+{
+ if (!create_tmp_file(index_no))
+ return DB_OUT_OF_MEMORY;
+ merge_file_t *file= &m_merge_files[index_no];
+ row_merge_buf_t *buf= &m_merge_buf[index_no];
+
+ alloc_block();
+
+ if (dberr_t err= row_merge_buf_write(buf,
+#ifndef DBUG_OFF
+ file,
+#endif
+ m_block,
+ index_no == 0 ? &m_blob_file : nullptr))
+ return err;
+
+ if (!row_merge_write(file->fd, file->offset++,
+ m_block, m_crypt_block,
+ buf->index->table->space->id))
+ return DB_TEMP_FILE_WRITE_FAIL;
+ MEM_UNDEFINED(&m_block[0], srv_sort_buf_size);
+ return DB_SUCCESS;
+}
+
+dberr_t row_merge_bulk_t::bulk_insert_buffered(const dtuple_t &row,
+ const dict_index_t &ind,
+ trx_t *trx)
+{
+ dberr_t err= DB_SUCCESS;
+ ulint i= 0;
+ mem_heap_t *large_tuple_heap= nullptr;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(ind.table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ if (index != &ind)
+ {
+ i++;
+ continue;
+ }
+ row_merge_buf_t *buf= &m_merge_buf[i];
+add_to_buf:
+ if (row_merge_bulk_buf_add(buf, *ind.table, row))
+ {
+ i++;
+ goto func_exit;
+ }
+
+ if (buf->n_tuples == 0)
+ {
+ /* Tuple data size is greater than srv_sort_buf_size */
+ dtuple_t *big_tuple= row_merge_buf_large_tuple(
+ row, &m_blob_file, &large_tuple_heap);
+ if (row_merge_bulk_buf_add(buf, *ind.table, *big_tuple))
+ {
+ i++;
+ goto func_exit;
+ }
+ }
+
+ if (index->is_unique())
+ {
+ row_merge_dup_t dup{index, nullptr, nullptr, 0};
+ row_merge_buf_sort(buf, &dup);
+ if (dup.n_dup)
+ {
+ trx->error_info= index;
+ err= DB_DUPLICATE_KEY;
+ goto func_exit;
+ }
+ }
+ else
+ row_merge_buf_sort(buf, NULL);
+ init_tmp_file();
+ merge_file_t *file= &m_merge_files[i];
+ file->n_rec+= buf->n_tuples;
+ err= write_to_tmp_file(i);
+ if (err != DB_SUCCESS)
+ {
+ trx->error_info= index;
+ goto func_exit;
+ }
+ clean_bulk_buffer(i);
+ buf= &m_merge_buf[i];
+ goto add_to_buf;
+ }
+
+func_exit:
+ if (large_tuple_heap)
+ mem_heap_free(large_tuple_heap);
+ return err;
+}
+
+dberr_t row_merge_bulk_t::write_to_index(ulint index_no, trx_t *trx)
+{
+ dberr_t err= DB_SUCCESS;
+ row_merge_buf_t buf= m_merge_buf[index_no];
+ merge_file_t *file= m_merge_files ?
+ &m_merge_files[index_no] : nullptr;
+ dict_index_t *index= buf.index;
+ dict_table_t *table= index->table;
+ BtrBulk btr_bulk(index, trx);
+ row_merge_dup_t dup = {index, nullptr, nullptr, 0};
+
+ if (buf.n_tuples)
+ {
+ if (dict_index_is_unique(index))
+ {
+ row_merge_buf_sort(&buf, &dup);
+ if (dup.n_dup)
+ {
+ err= DB_DUPLICATE_KEY;
+ goto func_exit;
+ }
+ }
+ else row_merge_buf_sort(&buf, NULL);
+ if (file && file->fd != OS_FILE_CLOSED)
+ {
+ file->n_rec+= buf.n_tuples;
+ err= write_to_tmp_file(index_no);
+ if (err!= DB_SUCCESS)
+ goto func_exit;
+ }
+ else
+ {
+ /* Data got fit in merge buffer. */
+ err= row_merge_insert_index_tuples(
+ index, table, OS_FILE_CLOSED, nullptr,
+ &buf, &btr_bulk, 0, 0, 0, nullptr, table->space_id, nullptr,
+ m_blob_file.fd == OS_FILE_CLOSED ? nullptr : &m_blob_file);
+ goto func_exit;
+ }
+ }
+
+ err= row_merge_sort(trx, &dup, file,
+ m_block, &m_tmpfd, true, 0, 0,
+ m_crypt_block, table->space_id, nullptr);
+ if (err != DB_SUCCESS)
+ goto func_exit;
+
+ err= row_merge_insert_index_tuples(
+ index, table, file->fd, m_block, nullptr,
+ &btr_bulk, 0, 0, 0, m_crypt_block, table->space_id,
+ nullptr, &m_blob_file);
+
+func_exit:
+ if (err != DB_SUCCESS)
+ trx->error_info= index;
+ err= btr_bulk.finish(err);
+ return err;
+}
+
+dberr_t row_merge_bulk_t::write_to_table(dict_table_t *table, trx_t *trx)
+{
+ ulint i= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ dberr_t err= write_to_index(i, trx);
+ if (err != DB_SUCCESS)
+ return err;
+ i++;
+ }
+
+ return DB_SUCCESS;
+}
+
+dberr_t trx_mod_table_time_t::write_bulk(dict_table_t *table, trx_t *trx)
+{
+ if (!bulk_store)
+ return DB_SUCCESS;
+ dberr_t err= bulk_store->write_to_table(table, trx);
+ delete bulk_store;
+ bulk_store= nullptr;
+ return err;
+}
+
+dberr_t trx_t::bulk_insert_apply_low()
+{
+ ut_ad(bulk_insert);
+ ut_ad(!check_unique_secondary);
+ ut_ad(!check_foreigns);
+ dberr_t err;
+ for (auto& t : mod_tables)
+ if (t.second.is_bulk_insert())
+ if ((err= t.second.write_bulk(t.first, this)) != DB_SUCCESS)
+ goto bulk_rollback;
+ return DB_SUCCESS;
+bulk_rollback:
+ undo_no_t low_limit= UINT64_MAX;
+ for (auto& t : mod_tables)
+ {
+ if (t.second.is_bulk_insert())
+ {
+ if (t.second.get_first() < low_limit)
+ low_limit= t.second.get_first();
+ delete t.second.bulk_store;
+ }
+ }
+ trx_savept_t bulk_save{low_limit};
+ rollback(&bulk_save);
+ return err;
+}
diff --git a/storage/innobase/snappy.cmake b/storage/innobase/snappy.cmake
deleted file mode 100644
index 3a2d828ee5c..00000000000
--- a/storage/innobase/snappy.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2015, MariaDB Corporation. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_SNAPPY AUTO CACHE STRING
- "Build with snappy. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_SNAPPY)
- IF (WITH_INNODB_SNAPPY STREQUAL "ON" OR WITH_INNODB_SNAPPY STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(snappy-c.h HAVE_SNAPPY_H)
- CHECK_LIBRARY_EXISTS(snappy snappy_uncompress "" HAVE_SNAPPY_SHARED_LIB)
-
- IF(HAVE_SNAPPY_SHARED_LIB AND HAVE_SNAPPY_H)
- SET(HAVE_INNODB_SNAPPY TRUE)
- ADD_DEFINITIONS(-DHAVE_SNAPPY=1)
- LINK_LIBRARIES(snappy)
- ELSE()
- IF (WITH_INNODB_SNAPPY STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required snappy library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_SNAPPY HAVE_INNODB_SNAPPY "Snappy compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index bbf6e05cf00..af14ff3c149 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -97,15 +97,15 @@ char* srv_data_home;
char* srv_undo_dir;
/** The number of tablespaces to use for rollback segments. */
-ulong srv_undo_tablespaces;
+uint srv_undo_tablespaces;
/** The number of UNDO tablespaces that are open and ready to use. */
-ulint srv_undo_tablespaces_open;
+uint32_t srv_undo_tablespaces_open;
/** The number of UNDO tablespaces that are active (hosting some rollback
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;
+uint32_t srv_undo_tablespaces_active;
/** Rate at which UNDO records should be purged. */
ulong srv_purge_rseg_truncate_frequency;
@@ -162,7 +162,7 @@ uint srv_flush_log_at_timeout;
/** innodb_page_size */
ulong srv_page_size;
/** log2 of innodb_page_size; @see innodb_init_params() */
-ulong srv_page_size_shift;
+uint32_t srv_page_size_shift;
/** innodb_log_write_ahead_size */
ulong srv_log_write_ahead_size;
@@ -1653,7 +1653,8 @@ std::mutex purge_thread_count_mtx;
void srv_update_purge_thread_count(uint n)
{
std::lock_guard<std::mutex> lk(purge_thread_count_mtx);
- purge_create_background_thds(n);
+ ut_ad(n > 0);
+ ut_ad(n <= innodb_purge_threads_MAX);
srv_n_purge_threads = n;
srv_purge_thread_count_changed = 1;
}
@@ -1896,7 +1897,7 @@ static void purge_coordinator_callback(void*)
void srv_init_purge_tasks()
{
- purge_create_background_thds(srv_n_purge_threads);
+ purge_create_background_thds(innodb_purge_threads_MAX);
purge_coordinator_timer= srv_thread_pool->create_timer
(purge_coordinator_callback, nullptr);
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 8b29af5c083..e4249b595d8 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -112,7 +112,7 @@ ibool srv_start_raw_disk_in_use;
uint srv_n_file_io_threads;
/** UNDO tablespaces starts with space id. */
-ulint srv_undo_space_id_start;
+uint32_t srv_undo_space_id_start;
/** TRUE if the server is being started, before rolling back any
incomplete transactions */
@@ -462,7 +462,7 @@ static dberr_t srv_validate_undo_tablespaces()
}
/** @return the number of active undo tablespaces (except system tablespace) */
-static ulint trx_rseg_get_n_undo_tablespaces()
+static uint32_t trx_rseg_get_n_undo_tablespaces()
{
std::set<uint32_t> space_ids;
mtr_t mtr;
@@ -474,7 +474,7 @@ static ulint trx_rseg_get_n_undo_tablespaces()
if (uint32_t space= trx_sysf_rseg_get_space(sys_header, rseg_id))
space_ids.insert(space);
mtr.commit();
- return space_ids.size();
+ return static_cast<uint32_t>(space_ids.size());
}
/** Open an undo tablespace.
@@ -483,11 +483,12 @@ static ulint trx_rseg_get_n_undo_tablespaces()
@param[in] i undo tablespace count
@return undo tablespace identifier
@retval 0 on failure */
-static ulint srv_undo_tablespace_open(bool create, const char* name, ulint i)
+static uint32_t srv_undo_tablespace_open(bool create, const char *name,
+ uint32_t i)
{
bool success;
- ulint space_id= 0;
- ulint fsp_flags= 0;
+ uint32_t space_id= 0;
+ uint32_t fsp_flags= 0;
if (create)
{
@@ -644,20 +645,21 @@ srv_check_undo_redo_logs_exists()
return(DB_SUCCESS);
}
-static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
+static dberr_t srv_all_undo_tablespaces_open(bool create_new_db,
+ uint32_t n_undo)
{
/* Open all the undo tablespaces that are currently in use. If we
fail to open any of these it is a fatal error. The tablespace ids
should be contiguous. It is a fatal error because they are required
for recovery and are referenced by the UNDO logs (a.k.a RBS). */
- ulint prev_id= create_new_db ? srv_undo_space_id_start - 1 : 0;
+ uint32_t prev_id= create_new_db ? srv_undo_space_id_start - 1 : 0;
- for (ulint i= 0; i < n_undo; ++i)
+ for (uint32_t i= 0; i < n_undo; ++i)
{
char name[OS_FILE_MAX_PATH];
- snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dir, i + 1);
- ulint space_id= srv_undo_tablespace_open(create_new_db, name, i);
+ snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i + 1);
+ uint32_t space_id= srv_undo_tablespace_open(create_new_db, name, i);
if (!space_id)
{
if (!create_new_db)
@@ -682,11 +684,11 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
not in use and therefore not required by recovery. We only check
that there are no gaps. */
- for (ulint i= prev_id + 1; i < srv_undo_space_id_start + TRX_SYS_N_RSEGS;
+ for (uint32_t i= prev_id + 1; i < srv_undo_space_id_start + TRX_SYS_N_RSEGS;
++i)
{
char name[OS_FILE_MAX_PATH];
- snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dir, i);
+ snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i);
if (!srv_undo_tablespace_open(create_new_db, name, i))
break;
++srv_undo_tablespaces_open;
@@ -698,8 +700,7 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
/** Open the configured number of dedicated undo tablespaces.
@param[in] create_new_db whether the database is being initialized
@return DB_SUCCESS or error code */
-dberr_t
-srv_undo_tablespaces_init(bool create_new_db)
+dberr_t srv_undo_tablespaces_init(bool create_new_db)
{
srv_undo_tablespaces_open= 0;
@@ -735,8 +736,8 @@ srv_undo_tablespaces_init(bool create_new_db)
already exist. */
srv_undo_tablespaces_active= srv_undo_tablespaces;
- ulint n_undo= (create_new_db || srv_operation == SRV_OPERATION_BACKUP ||
- srv_operation == SRV_OPERATION_RESTORE_DELTA)
+ uint32_t n_undo= (create_new_db || srv_operation == SRV_OPERATION_BACKUP ||
+ srv_operation == SRV_OPERATION_RESTORE_DELTA)
? srv_undo_tablespaces : TRX_SYS_N_RSEGS;
if (dberr_t err= srv_all_undo_tablespaces_open(create_new_db, n_undo))
@@ -750,7 +751,7 @@ srv_undo_tablespaces_init(bool create_new_db)
if (create_new_db)
{
mtr_t mtr;
- for (ulint i= 0; i < srv_undo_tablespaces; ++i)
+ for (uint32_t i= 0; i < srv_undo_tablespaces; ++i)
{
mtr.start();
dberr_t err= fsp_header_init(fil_space_get(srv_undo_space_id_start + i),
@@ -1516,8 +1517,9 @@ file_checked:
fil_system.space_id_reuse_warned = false;
if (!srv_read_only_mode) {
- const ulint flags = FSP_FLAGS_PAGE_SSIZE();
- for (ulint id = 0; id <= srv_undo_tablespaces; id++) {
+ const uint32_t flags = FSP_FLAGS_PAGE_SSIZE();
+ for (uint32_t id = 0; id <= srv_undo_tablespaces;
+ id++) {
if (fil_space_t* space = fil_space_get(id)) {
fsp_flags_try_adjust(space, flags);
}
@@ -2065,6 +2067,10 @@ void innodb_shutdown()
}
srv_tmp_space.shutdown();
+ if (srv_stats.pages_page_compression_error)
+ ib::warn() << "Page compression errors: "
+ << srv_stats.pages_page_compression_error;
+
if (srv_was_started && srv_print_verbose_log) {
ib::info() << "Shutdown completed; log sequence number "
<< srv_shutdown_lsn
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 625d3223bdc..7d52894051d 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -653,11 +653,11 @@ TRANSACTIONAL_TARGET static void trx_purge_truncate_history()
{
const ulint threshold=
ulint(srv_max_undo_log_size >> srv_page_size_shift);
- for (ulint i= purge_sys.truncate.last
+ for (uint32_t i= purge_sys.truncate.last
? purge_sys.truncate.last->id - srv_undo_space_id_start : 0,
j= i;; )
{
- const auto space_id= srv_undo_space_id_start + i;
+ const uint32_t space_id= srv_undo_space_id_start + i;
ut_ad(srv_is_undo_tablespace(space_id));
fil_space_t *space= fil_space_get(space_id);
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index dc24f083d05..e70516a2d2d 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1758,8 +1758,7 @@ TRANSACTIONAL_TARGET ATTRIBUTE_NOINLINE
/** @return whether the transaction holds an exclusive lock on a table */
static bool trx_has_lock_x(const trx_t &trx, dict_table_t& table)
{
- if (table.is_temporary())
- return true;
+ ut_ad(!table.is_temporary());
uint32_t n;
@@ -1860,9 +1859,17 @@ trx_undo_report_row_operation(
ut_ad(que_node_get_type(thr->run_node) == QUE_NODE_INSERT);
ut_ad(trx->bulk_insert);
return DB_SUCCESS;
- } else if (m.second && trx->bulk_insert
- && trx_has_lock_x(*trx, *index->table)) {
- m.first->second.start_bulk_insert();
+ } else if (!m.second || !trx->bulk_insert) {
+ bulk = false;
+ } else if (index->table->is_temporary()) {
+ } else if (trx_has_lock_x(*trx, *index->table)
+ && index->table->bulk_trx_id == trx->id) {
+ m.first->second.start_bulk_insert(index->table);
+
+ if (dberr_t err = m.first->second.bulk_insert_buffered(
+ *clust_entry, *index, trx)) {
+ return err;
+ }
} else {
bulk = false;
}
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 59c9a319330..45dc78b4440 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -59,7 +59,6 @@ const trx_t* trx_roll_crash_recv_trx;
@retval false if the rollback was aborted by shutdown */
inline bool trx_t::rollback_finish()
{
- mod_tables.clear();
apply_online_log= false;
if (UNIV_LIKELY(error_state == DB_SUCCESS))
{
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index d344f3a0c83..ee27e8f51c1 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -212,7 +212,7 @@ TPOOL_SUPPRESS_TSAN size_t trx_sys_t::history_size_approx() const
@param space_id system or undo tablespace id
@return pointer to new rollback segment
@retval nullptr on failure */
-static trx_rseg_t *trx_rseg_create(ulint space_id)
+static trx_rseg_t *trx_rseg_create(uint32_t space_id)
{
trx_rseg_t *rseg= nullptr;
mtr_t mtr;
@@ -273,11 +273,11 @@ bool trx_sys_create_rsegs()
in the system tablespace. */
ut_a(srv_available_undo_logs > 0);
- for (ulint i = 0; srv_available_undo_logs < TRX_SYS_N_RSEGS;
+ for (uint32_t 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
+ uint32_t space = srv_undo_tablespaces > 0
? (i % srv_undo_tablespaces)
+ srv_undo_space_id_start
: TRX_SYS_SPACE;
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 45292fc1d0b..b15741d88ff 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1393,6 +1393,10 @@ void trx_t::commit_cleanup()
ut_ad(!dict_operation);
ut_ad(!was_dict_operation);
+ if (is_bulk_insert())
+ for (auto &t : mod_tables)
+ delete t.second.bulk_store;
+
mutex.wr_lock();
state= TRX_STATE_NOT_STARTED;
mod_tables.clear();
@@ -1484,8 +1488,11 @@ void trx_t::commit()
ut_d(was_dict_operation= dict_operation);
dict_operation= false;
commit_persist();
+#ifdef UNIV_DEBUG
+ if (!was_dict_operation)
+ for (const auto &p : mod_tables) ut_ad(!p.second.is_dropped());
+#endif /* UNIV_DEBUG */
ut_d(was_dict_operation= false);
- ut_d(for (const auto &p : mod_tables) ut_ad(!p.second.is_dropped()));
commit_cleanup();
}
@@ -1653,6 +1660,9 @@ trx_mark_sql_stat_end(
}
if (trx->is_bulk_insert()) {
+ /* MDEV-25036 FIXME: we support buffered
+ insert only for the first insert statement */
+ trx->error_state = trx->bulk_insert_apply();
/* Allow a subsequent INSERT into an empty table
if !unique_checks && !foreign_key_checks. */
return;
@@ -1864,8 +1874,6 @@ trx_prepare(
lsn_t lsn = trx_prepare_low(trx);
- DBUG_EXECUTE_IF("ib_trx_crash_during_xa_prepare_step", DBUG_SUICIDE(););
-
ut_a(trx->state == TRX_STATE_ACTIVE);
{
TMTrxGuard tg{*trx};
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 9c214e65bbd..545c54fde66 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -446,7 +446,7 @@ ut_strerr(
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
case DB_DECRYPTION_FAILED:
- return("Table is encrypted but decrypt failed.");
+ return("Table is compressed or encrypted but uncompress or decrypt failed.");
case DB_IO_PARTIAL_FAILED:
return("Partial IO failed");
case DB_COMPUTE_VALUE_FAILED:
diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c
index 266b11d99f5..7d5598f06b5 100644
--- a/storage/maria/aria_chk.c
+++ b/storage/maria/aria_chk.c
@@ -1592,7 +1592,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
}
compile_time_assert((MY_UUID_STRING_LENGTH + 1) <= sizeof(buff));
buff[MY_UUID_STRING_LENGTH]= 0;
- my_uuid2str(share->base.uuid, buff);
+ my_uuid2str(share->base.uuid, buff, 1);
printf("UUID: %s\n", buff);
if (ma_control_file_inited() &&
memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE))
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 23135ff00a9..61fe4f9d080 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -661,7 +661,7 @@ static void _ma_bitmap_unpin_all(MARIA_SHARE *share)
dynamic_array_ptr(&bitmap->pinned_pages, 0));
MARIA_PINNED_PAGE *pinned_page= page_link + bitmap->pinned_pages.elements;
DBUG_ENTER("_ma_bitmap_unpin_all");
- DBUG_PRINT("info", ("pinned: %u", bitmap->pinned_pages.elements));
+ DBUG_PRINT("info", ("pinned: %zu", bitmap->pinned_pages.elements));
while (pinned_page-- != page_link)
pagecache_unlock_by_link(share->pagecache, pinned_page->link,
pinned_page->unlock, PAGECACHE_UNPIN,
@@ -1735,7 +1735,7 @@ static my_bool find_head(MARIA_HA *info, uint length, uint position)
1 error
*/
-static my_bool find_tail(MARIA_HA *info, uint length, uint position)
+static my_bool find_tail(MARIA_HA *info, uint length, size_t position)
{
MARIA_FILE_BITMAP *bitmap= &info->s->bitmap;
MARIA_BITMAP_BLOCK *block;
@@ -1816,7 +1816,7 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
uint full_page_size= FULL_PAGE_SIZE(info->s);
ulong pages;
uint rest_length, used;
- uint UNINIT_VAR(first_block_pos);
+ size_t UNINIT_VAR(first_block_pos);
MARIA_BITMAP_BLOCK *first_block= 0;
DBUG_ENTER("find_blob");
DBUG_PRINT("enter", ("length: %lu", length));
@@ -1866,7 +1866,8 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
DBUG_RETURN(1);
first_block= dynamic_element(&info->bitmap_blocks, first_block_pos,
MARIA_BITMAP_BLOCK*);
- first_block->sub_blocks= info->bitmap_blocks.elements - first_block_pos;
+ first_block->sub_blocks= (uint)(info->bitmap_blocks.elements
+ - first_block_pos);
DBUG_RETURN(0);
}
@@ -1887,7 +1888,7 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
static my_bool allocate_blobs(MARIA_HA *info, MARIA_ROW *row)
{
ulong *length, *end;
- uint elements;
+ size_t elements;
/*
Reserve size for:
head block
@@ -1901,7 +1902,7 @@ static my_bool allocate_blobs(MARIA_HA *info, MARIA_ROW *row)
if (*length && find_blob(info, *length))
return 1;
}
- row->extents_count= (info->bitmap_blocks.elements - elements);
+ row->extents_count= (uint)(info->bitmap_blocks.elements - elements);
return 0;
}
@@ -2174,7 +2175,7 @@ end:
MARIA_BITMAP_BLOCK*);
blocks->block->sub_blocks= ELEMENTS_RESERVED_FOR_MAIN_PART - position;
/* First block's page_count is for all blocks */
- blocks->count= info->bitmap_blocks.elements - position;
+ blocks->count= (uint)(info->bitmap_blocks.elements - position);
res= 0;
abort:
@@ -2275,7 +2276,7 @@ end:
MARIA_BITMAP_BLOCK*);
blocks->block->sub_blocks= ELEMENTS_RESERVED_FOR_MAIN_PART - position;
/* First block's page_count is for all blocks */
- blocks->count= info->bitmap_blocks.elements - position;
+ blocks->count= (uint)(info->bitmap_blocks.elements - position);
res= 0;
abort:
diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c
index a6daa8bef24..21befb70bd9 100644
--- a/storage/maria/ma_control_file.c
+++ b/storage/maria/ma_control_file.c
@@ -705,7 +705,7 @@ my_bool print_aria_log_control()
checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size +
CF_LSN_OFFSET);
logno= uint4korr(buffer + new_cf_create_time_size + CF_FILENO_OFFSET);
- my_uuid2str(buffer + CF_UUID_OFFSET, uuid_str);
+ my_uuid2str(buffer + CF_UUID_OFFSET, uuid_str, 1);
uuid_str[MY_UUID_STRING_LENGTH]= 0;
printf("Block size: %u\n", uint2korr(buffer + CF_BLOCKSIZE_OFFSET));
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index 8e1bf397c86..b048a8a2c5a 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -320,7 +320,7 @@ my_bool _ma_ft_convert_to_ft2(MARIA_HA *info, MARIA_KEY *key)
/* we'll generate one pageful at once, and insert the rest one-by-one */
/* calculating the length of this page ...*/
length=(keyinfo->block_length-2) / keyinfo->keylength;
- set_if_smaller(length, da->elements);
+ set_if_smaller(length, (uint)da->elements);
length=length * keyinfo->keylength;
get_key_full_length_rdonly(key_length, key->data);
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 029ce4b9128..14c4c9963f1 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -140,7 +140,7 @@ my_bool maria_upgrade()
We start by renaming all log files, so that if we get a crash
we will continue from where we left.
*/
- uint i;
+ size_t i;
MY_DIR *dir= my_dir(maria_data_root, MYF(MY_WME));
if (!dir)
DBUG_RETURN(1);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 4f6193a05a7..6572ff8e140 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1342,7 +1342,7 @@ struct st_file_counter
static void translog_mark_file_unfinished(uint32 file)
{
- int place, i;
+ ssize_t place, i;
struct st_file_counter fc, *fc_ptr;
DBUG_ENTER("translog_mark_file_unfinished");
@@ -1375,7 +1375,7 @@ static void translog_mark_file_unfinished(uint32 file)
goto end;
}
- if (place == (int)log_descriptor.unfinished_files.elements)
+ if (place == (ssize_t)log_descriptor.unfinished_files.elements)
{
insert_dynamic(&log_descriptor.unfinished_files, (uchar*) &fc);
DBUG_PRINT("info", ("The last element inserted"));
@@ -3502,7 +3502,7 @@ my_bool translog_walk_filenames(const char *directory,
const char *))
{
MY_DIR *dirp;
- uint i;
+ size_t i;
my_bool rc= FALSE;
/* Finds and removes transaction log files */
@@ -5625,8 +5625,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
TRANSLOG_ADDRESS horizon;
struct st_buffer_cursor cursor;
int rc= 0;
- uint i, chunk2_page, full_pages;
- uint curr_group= 0;
+ size_t i, curr_group= 0;
+ uint chunk2_page, full_pages;
translog_size_t record_rest, first_page, chunk3_pages, chunk0_pages= 1;
translog_size_t done= 0;
struct st_translog_group_descriptor group;
@@ -5892,11 +5892,11 @@ translog_write_variable_record_mgroup(LSN *lsn,
DBUG_ASSERT(cursor.buffs.unlck_ptr == cursor.buffs.wrt_ptr);
rc= translog_advance_pointer(pages_to_skip + (int)(chunk0_pages - 1),
- record_rest + header_fixed_part +
- (groups.elements -
+ (uint16)(record_rest + header_fixed_part +
+ ((uint)groups.elements -
((page_capacity -
header_fixed_part) / (7 + 1)) *
- (chunk0_pages - 1)) * (7 + 1),
+ (chunk0_pages - 1)) * (7 + 1)),
&cursor.buffs);
buffer_of_last_lsn= log_descriptor.bc.buffer;
translog_unlock();
@@ -5984,7 +5984,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
header_length);
do
{
- int limit;
+ size_t limit;
if (new_page_before_chunk0 &&
translog_chaser_page_next(&horizon, &cursor))
{
@@ -6026,9 +6026,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
*/
limit= (groups_per_page < groups.elements - curr_group ?
groups_per_page : groups.elements - curr_group);
- DBUG_PRINT("info", ("Groups: %u curr: %u limit: %u",
- (uint) groups.elements, (uint) curr_group,
- (uint) limit));
+ DBUG_PRINT("info", ("Groups: %zu curr: %zu limit: %zu",
+ groups.elements, curr_group, limit));
if (chunk0_pages == 1)
{
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index d642f1a7194..2d9174b4380 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -156,8 +156,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
info.lock_type= F_WRLCK;
_ma_set_data_pagecache_callbacks(&info.dfile, share);
- my_bitmap_init(&info.changed_fields, changed_fields_bitmap,
- share->base.fields, 0);
+ my_bitmap_init(&info.changed_fields, changed_fields_bitmap, share->base.fields);
if ((*share->init)(&info))
goto err;
@@ -1026,7 +1025,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
MARIA_STATE_HISTORY_CLOSED *history;
if ((history= (MARIA_STATE_HISTORY_CLOSED *)
my_hash_search(&maria_stored_state,
- (uchar*) &share->state.create_rename_lsn, 0)))
+ (uchar*) &share->state.create_rename_lsn,
+ sizeof(share->state.create_rename_lsn))))
{
/*
Move history from hash to share. This is safe to do as we
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index 25db0e8acec..5881456a69a 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -119,7 +119,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
PAGECACHE_LOCK_READ_UNLOCK);
page_link.changed= 0;
push_dynamic(&info->pinned_pages, (void*) &page_link);
- page->link_offset= info->pinned_pages.elements-1;
+ page->link_offset= (uint)info->pinned_pages.elements-1;
}
if (tmp == info->buff)
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index b9d6fffda86..f02a7a81020 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -50,7 +50,7 @@ extern void print_error(const char *fmt,...);
static ha_rows find_all_keys(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- DYNAMIC_ARRAY *buffpek,uint *maxbuffer,
+ DYNAMIC_ARRAY *buffpek,size_t *maxbuffer,
IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions);
static int write_keys(MARIA_SORT_PARAM *info,uchar **sort_keys,
@@ -61,7 +61,7 @@ static int write_index(MARIA_SORT_PARAM *info, uchar **sort_keys,
ha_keys count);
static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- BUFFPEK *buffpek, uint *maxbuffer,
+ BUFFPEK *buffpek, size_t *maxbuffer,
IO_CACHE *t_file);
static my_off_t read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
@@ -69,7 +69,7 @@ static int merge_buffers(MARIA_SORT_PARAM *info, ha_keys keys,
IO_CACHE *from_file, IO_CACHE *to_file,
uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb);
-static int merge_index(MARIA_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, uint,
+static int merge_index(MARIA_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, size_t,
IO_CACHE *);
static int flush_maria_ft_buf(MARIA_SORT_PARAM *info);
@@ -126,8 +126,8 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
size_t sortbuff_size)
{
int error;
- uint sort_length, maxbuffer;
- size_t memavl, old_memavl;
+ uint sort_length;
+ size_t memavl, old_memavl, maxbuffer;
DYNAMIC_ARRAY buffpek;
ha_rows records, UNINIT_VAR(keys);
uchar **sort_keys;
@@ -165,7 +165,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (records / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (records / keys)+1);
}
else
{
@@ -173,7 +173,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
All keys can't fit in memory.
Calculate how many keys + buffers we can keep in memory
*/
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -190,7 +190,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
goto err;
}
}
- while ((maxbuffer= (uint) (records/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (records/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= ((uchar**)
@@ -310,7 +310,7 @@ err:
static ha_rows find_all_keys(MARIA_SORT_PARAM *info, ha_rows keys,
uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
- uint *maxbuffer, IO_CACHE *tempfile,
+ size_t *maxbuffer, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions)
{
int error;
@@ -371,7 +371,7 @@ static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
longlong sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
- uint maxbuffer;
+ size_t maxbuffer;
uchar **sort_keys= NULL;
DBUG_ENTER("_ma_thr_find_all_keys_exec");
DBUG_PRINT("enter", ("master: %d", sort_param->master));
@@ -406,11 +406,11 @@ static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -622,7 +622,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
if (sinfo->buffpek.elements)
{
- uint maxbuffer=sinfo->buffpek.elements-1;
+ size_t maxbuffer=sinfo->buffpek.elements-1;
if (!mergebuf)
{
length=(size_t)param->sort_buffer_length;
@@ -838,9 +838,9 @@ static int write_index(MARIA_SORT_PARAM *info, register uchar **sort_keys,
static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys, BUFFPEK *buffpek,
- uint *maxbuffer, IO_CACHE *t_file)
+ size_t *maxbuffer, IO_CACHE *t_file)
{
- uint tmp, merges, max_merges;
+ size_t tmp, merges, max_merges;
IO_CACHE t_file2, *from_file, *to_file, *temp;
BUFFPEK *lastbuff;
DBUG_ENTER("merge_many_buff");
@@ -866,7 +866,7 @@ static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
from_file= t_file ; to_file= &t_file2;
while (*maxbuffer >= MERGEBUFF2)
{
- uint i;
+ size_t i;
reinit_io_cache(from_file,READ_CACHE,0L,0,0);
reinit_io_cache(to_file,WRITE_CACHE,0L,0,0);
lastbuff=buffpek;
@@ -884,7 +884,7 @@ static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
- *maxbuffer= (uint) (lastbuff-buffpek)-1;
+ *maxbuffer= (size_t) (lastbuff-buffpek)-1;
if (info->sort_info->param->max_stage != 1) /* If not parallel */
_ma_report_progress(info->sort_info->param, merges++, max_merges);
}
@@ -1140,7 +1140,7 @@ err:
static int
merge_index(MARIA_SORT_PARAM *info, ha_keys keys, uchar **sort_keys,
- BUFFPEK *buffpek, uint maxbuffer, IO_CACHE *tempfile)
+ BUFFPEK *buffpek, size_t maxbuffer, IO_CACHE *tempfile)
{
DBUG_ENTER("merge_index");
if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c
index 0d75fdbf95c..a4d0609f686 100644
--- a/storage/maria/unittest/ma_maria_log_cleanup.c
+++ b/storage/maria/unittest/ma_maria_log_cleanup.c
@@ -21,7 +21,7 @@
my_bool maria_log_remove(const char *testdir)
{
MY_DIR *dirp;
- uint i;
+ size_t i;
MY_STAT stat_buff;
char file_name[FN_REFLEN];
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index c048b214658..bea0eecc8b7 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -110,19 +110,9 @@ if(MRN_GROONGA_BUNDLED)
set(GROONGA_NORMALIZER_MYSQL_EMBED ON)
endif()
- file(READ "${MRN_BUNDLED_GROONGA_DIR}/bundled_lz4_version"
- MRN_BUNDLED_LZ4_VERSION)
- string(STRIP
- "${MRN_BUNDLED_LZ4_VERSION}"
- MRN_BUNDLED_LZ4_VERSION)
- set(MRN_BUNDLED_LZ4_DIR
- "${MRN_BUNDLED_GROONGA_DIR}/vendor/lz4-${MRN_BUNDLED_LZ4_VERSION}")
- if(EXISTS ${MRN_BUNDLED_LZ4_DIR})
- set(GRN_WITH_BUNDLED_LZ4 ON)
- set(GRN_WITH_LZ4 "yes")
- else()
- set(GRN_WITH_LZ4 "no")
- endif()
+ set(GRN_WITH_LZ4 "yes")
+ set(LIBLZ4_FOUND TRUE)
+ set(LZ4_LIBS "" CACHE STRING "" FORCE)
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index baf6de6c302..f7cb81fee66 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -4926,7 +4926,7 @@ int ha_mroonga::open(const char *name,
DBUG_RETURN(error);
thr_lock_data_init(&share->lock,&thr_lock_data,NULL);
- if (bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields, false))
+ if (my_bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields))
{
mrn_free_share(share);
share = NULL;
@@ -4942,7 +4942,7 @@ int ha_mroonga::open(const char *name,
if (error)
{
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
mrn_free_share(share);
share = NULL;
}
@@ -5009,7 +5009,7 @@ int ha_mroonga::close()
{
error = add_wrap_hton(share->table_name, share->hton);
}
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
if (share->use_count == 1) {
mrn_free_long_term_share(share->long_term_share);
}
diff --git a/storage/mroonga/lib/mrn_smart_bitmap.cpp b/storage/mroonga/lib/mrn_smart_bitmap.cpp
index f8fd4f727bb..cdedeb677cd 100644
--- a/storage/mroonga/lib/mrn_smart_bitmap.cpp
+++ b/storage/mroonga/lib/mrn_smart_bitmap.cpp
@@ -26,7 +26,7 @@ namespace mrn {
SmartBitmap::~SmartBitmap() {
if (bitmap_) {
- bitmap_free(bitmap_);
+ my_bitmap_free(bitmap_);
}
}
diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c
index 0c97a926746..157e5423168 100644
--- a/storage/myisam/ft_update.c
+++ b/storage/myisam/ft_update.c
@@ -301,7 +301,8 @@ uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key)
DYNAMIC_ARRAY *da=info->ft1_to_ft2;
MI_KEYDEF *keyinfo=&info->s->ft2_keyinfo;
uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
- uint length, key_length;
+ size_t length;
+ uint key_length;
DBUG_ENTER("_mi_ft_convert_to_ft2");
/* we'll generate one pageful at once, and insert the rest one-by-one */
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index fe0c0f8f02e..198e669bbb4 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -47,7 +47,7 @@ extern void print_error(const char *fmt,...);
static ha_rows find_all_keys(MI_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- DYNAMIC_ARRAY *buffpek,uint *maxbuffer,
+ DYNAMIC_ARRAY *buffpek, size_t *maxbuffer,
IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions);
static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys,
@@ -58,7 +58,7 @@ static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys,
ha_keys count);
static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
uchar * *sort_keys,
- BUFFPEK *buffpek, uint *maxbuffer,
+ BUFFPEK *buffpek, size_t *maxbuffer,
IO_CACHE *t_file);
static my_off_t read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
@@ -66,7 +66,7 @@ static int merge_buffers(MI_SORT_PARAM *info, ha_keys keys,
IO_CACHE *from_file, IO_CACHE *to_file,
uchar * *sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb);
-static int merge_index(MI_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, uint,
+static int merge_index(MI_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, size_t,
IO_CACHE *);
static int flush_ft_buf(MI_SORT_PARAM *info);
@@ -124,7 +124,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
ulonglong sortbuff_size)
{
int error;
- uint sort_length, maxbuffer;
+ uint sort_length;
+ size_t maxbuffer;
ulonglong memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records, UNINIT_VAR(keys);
@@ -161,7 +162,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (records / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (records / keys)+1);
}
else
{
@@ -169,7 +170,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
All keys can't fit in memory.
Calculate how many keys + buffers we can keep in memory
*/
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -186,7 +187,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
goto err;
}
}
- while ((maxbuffer= (uint) (records/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (records/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= ((uchar **)
@@ -298,7 +299,7 @@ err:
static ha_rows find_all_keys(MI_SORT_PARAM *info, ha_rows keys,
uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
- uint *maxbuffer, IO_CACHE *tempfile,
+ size_t *maxbuffer, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions)
{
int error;
@@ -349,7 +350,7 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
ulonglong memavl, old_memavl, sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
- uint maxbuffer;
+ size_t maxbuffer;
uchar **sort_keys= NULL;
int error= 0;
DBUG_ENTER("thr_find_all_keys");
@@ -386,18 +387,18 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
- keys < (uint) maxbuffer)
+ keys < maxbuffer)
{
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
@@ -405,7 +406,7 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
DBUG_RETURN(TRUE);
}
}
- while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar**) my_malloc(PSI_INSTRUMENT_ME,
(size_t)(keys * (sort_length + sizeof(char*)) +
@@ -604,7 +605,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (sinfo->buffpek.elements)
{
- uint maxbuffer=sinfo->buffpek.elements-1;
+ size_t maxbuffer=sinfo->buffpek.elements-1;
if (!mergebuf)
{
length=param->sort_buffer_length;
@@ -806,9 +807,9 @@ static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys, BUFFPEK *buffpek,
- uint *maxbuffer, IO_CACHE *t_file)
+ size_t *maxbuffer, IO_CACHE *t_file)
{
- register uint i;
+ register size_t i;
IO_CACHE t_file2, *from_file, *to_file, *temp;
BUFFPEK *lastbuff;
DBUG_ENTER("merge_many_buff");
@@ -838,7 +839,7 @@ static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
- *maxbuffer= (uint) (lastbuff-buffpek)-1;
+ *maxbuffer= (size_t) (lastbuff-buffpek)-1;
}
cleanup:
close_cached_file(to_file); /* This holds old result */
@@ -1099,7 +1100,7 @@ err:
static int
merge_index(MI_SORT_PARAM *info, ha_keys keys, uchar **sort_keys,
- BUFFPEK *buffpek, uint maxbuffer, IO_CACHE *tempfile)
+ BUFFPEK *buffpek, size_t maxbuffer, IO_CACHE *tempfile)
{
DBUG_ENTER("merge_index");
if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 70a4d6aa284..d37636abab7 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -121,7 +121,7 @@ ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0), is_cloned(0)
{
init_sql_alloc(rg_key_memory_children, &children_mem_root,
- FN_REFLEN + ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(0));
+ FN_REFLEN, 0, MYF(0));
}
diff --git a/storage/oqgraph/cmake/FindJudy.cmake b/storage/oqgraph/cmake/FindJudy.cmake
index d9ecfdc4a4f..37aed8b631c 100644
--- a/storage/oqgraph/cmake/FindJudy.cmake
+++ b/storage/oqgraph/cmake/FindJudy.cmake
@@ -16,7 +16,7 @@
# Once done this will define
#
# Judy_FOUND - system has Judy
-# Judy_INCLUDE_DIR - the Judy include directory
+# Judy_INCLUDE_DIRS - the Judy include directory
# Judy_LIBRARIES - Link these to use Judy
# Judy_DEFINITIONS - Compiler switches required for using Judy
@@ -24,21 +24,21 @@ IF(MSVC)
# For now, assume Judy built according to the above instructions
if (NOT "$ENV{JUDY_ROOT}" STREQUAL "")
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" Judy_INCLUDE_DIR_search $ENV{JUDY_ROOT}/src)
+ string(REPLACE "\\" "/" Judy_INCLUDE_DIRS_search $ENV{JUDY_ROOT}/src)
string(REPLACE "\\" "/" Judy_LIBRARIES_search $ENV{JUDY_ROOT}/src)
endif()
ELSE(MSVC)
- IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FIND_QUIETLY TRUE)
- ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
ENDIF(MSVC)
-FIND_PATH(Judy_INCLUDE_DIR Judy.h PATHS ${Judy_INCLUDE_DIR_search})
+FIND_PATH(Judy_INCLUDE_DIRS Judy.h PATHS ${Judy_INCLUDE_DIRS_search})
FIND_LIBRARY(Judy_LIBRARIES Judy PATHS ${Judy_LIBRARIES_search})
-IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FOUND TRUE)
-ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ELSE (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FOUND FALSE)
if (MSVC)
MESSAGE(STATUS "How to build Judy on Windows:")
@@ -51,7 +51,7 @@ ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
MESSAGE(STATUS "3. Execute the command: 'build'")
MESSAGE(STATUS "4. Rerun this cmake with the environment variable: 'set JUDY_ROOT=x:\\path\\to\\judy'")
endif(MSVC)
-ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
IF (Judy_FOUND)
IF (NOT Judy_FIND_QUIETLY)
@@ -63,5 +63,5 @@ ELSE (Judy_FOUND)
ENDIF (Judy_FIND_REQUIRED)
ENDIF (Judy_FOUND)
-MARK_AS_ADVANCED(Judy_INCLUDE_DIR Judy_LIBRARIES)
+MARK_AS_ADVANCED(Judy_INCLUDE_DIRS Judy_LIBRARIES)
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 9d1c13e11cd..d3f7ca90889 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -141,8 +141,12 @@ else()
SET(ATOMIC_EXTRA_LIBS)
endif()
+# don't use compression providers, there are standalone executables below
+GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} MODULE_ONLY STORAGE_ENGINE
- MODULE_OUTPUT_NAME ha_rocksdb
LINK_LIBRARIES ${ATOMIC_EXTRA_LIBS}
COMPONENT rocksdb-engine)
@@ -151,8 +155,6 @@ IF(NOT TARGET rocksdb)
RETURN()
ENDIF()
-
-
CHECK_CXX_SOURCE_COMPILES("
#if defined(_MSC_VER) && !defined(__thread)
#define __thread __declspec(thread)
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index fd23b7ba470..29b2d83a759 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -35,48 +35,48 @@ endif()
# Optional compression libraries.
include(CheckFunctionExists)
-macro(check_lib package var)
- STRING(TOUPPER ${package} PACKAGE_NAME)
+macro(check_lib package)
SET(WITH_ROCKSDB_${package} AUTO CACHE STRING
"Build RocksDB with ${package} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
+ STRING(TOUPPER ${package} var)
IF (NOT ${WITH_ROCKSDB_${package}} STREQUAL "OFF")
FIND_PACKAGE(${package} QUIET)
- SET(HAVE_ROCKSDB_${PACKAGE_NAME} TRUE)
- IF (${${PACKAGE_NAME}_FOUND})
- IF(${ARGC} GREATER 2)
+ SET(HAVE_ROCKSDB_${package} TRUE)
+ IF (${${package}_FOUND})
+ IF(${ARGC} GREATER 1)
SET(CMAKE_REQUIRED_LIBRARIES ${${var}_LIBRARIES})
- CHECK_FUNCTION_EXISTS(${ARGV2} ${var}_VALID)
+ CHECK_FUNCTION_EXISTS(${ARGV1} ${package}_VALID)
UNSET(CMAKE_REQUIRED_LIBRARIES)
ELSE()
- SET(${var}_VALID TRUE)
+ SET(${package}_VALID TRUE)
ENDIF()
ENDIF()
ENDIF()
- ADD_FEATURE_INFO(ROCKSDB_${PACKAGE_NAME} HAVE_ROCKSDB_${PACKAGE_NAME} "${package} Compression in the RocksDB storage engine")
+ ADD_FEATURE_INFO(ROCKSDB_${package} HAVE_ROCKSDB_${package} "${package} Compression in the RocksDB storage engine")
- IF(${${var}_VALID})
- MESSAGE_ONCE(rocksdb_${var} "Found ${package}: ${${var}_LIBRARIES}")
- add_definitions(-D${PACKAGE_NAME})
+ IF(${${package}_VALID})
+ MESSAGE_ONCE(rocksdb_${package} "Found ${package}: ${${var}_LIBRARIES}")
+ add_definitions(-D${var})
include_directories(${${var}_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${${var}_LIBRARIES})
- ELSEIF(${${PACKAGE_NAME}_FOUND})
- MESSAGE_ONCE(rocksdb_${var} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV2}]")
+ ELSEIF(${${package}_FOUND})
+ MESSAGE_ONCE(rocksdb_${package} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV1}]")
ELSE()
- MESSAGE_ONCE(rocksdb_${var} "Could NOT find ${package}")
+ MESSAGE_ONCE(rocksdb_${package} "Could NOT find ${package}")
ENDIF()
- IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${PACKAGE_NAME}_FOUND})
+ IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${package}_FOUND})
MESSAGE(FATAL_ERROR
"${package} library was not found, but WITH_ROCKSDB_${package} option is ON.\
Either set WITH_ROCKSDB_${package} to OFF, or make sure ${package} is installed")
endif()
endmacro()
-check_lib(LZ4 LZ4)
-check_lib(BZip2 BZIP2)
-check_lib(snappy snappy) # rocksdb/cmake/modules/Findsnappy.cmake violates the convention
-check_lib(ZSTD ZSTD ZDICT_trainFromBuffer)
+check_lib(LZ4)
+check_lib(BZip2)
+check_lib(Snappy)
+check_lib(ZSTD ZDICT_trainFromBuffer)
add_definitions(-DZLIB)
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index d11e9a5f681..1168427a458 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -704,7 +704,7 @@ static int rmdir_force(const char *dir) {
if (!dir_info)
return 1;
- for (uint i = 0; i < dir_info->number_of_files; i++) {
+ for (size_t i = 0; i < dir_info->number_of_files; i++) {
FILEINFO *file = dir_info->dir_entry + i;
strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
@@ -5216,9 +5216,6 @@ static rocksdb::Status check_rocksdb_options_compatibility(
return status;
}
-bool prevent_myrocks_loading= false;
-
-
static int rocksdb_check_version(handlerton *hton,
const char *path,
const LEX_CUSTRING *version,
@@ -5239,14 +5236,6 @@ static int rocksdb_init_func(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- {
- my_error(ER_INTERNAL_ERROR, MYF(0),
- "Loading MyRocks plugin after it has been unloaded is not "
- "supported. Please restart mariadbd");
- DBUG_RETURN(1);
- }
-
if (rocksdb_ignore_datadic_errors)
{
sql_print_information(
@@ -5821,8 +5810,6 @@ static int rocksdb_init_func(void *const p) {
static int rocksdb_done_func(void *const p) {
DBUG_ENTER_FUNC();
- int error = 0;
-
// signal the drop index thread to stop
rdb_drop_idx_thread.signal(true);
@@ -5866,12 +5853,6 @@ static int rocksdb_done_func(void *const p) {
"RocksDB: Couldn't stop the manual compaction thread: (errno=%d)", err);
}
- if (rdb_open_tables.count()) {
- // Looks like we are getting unloaded and yet we have some open tables
- // left behind.
- error = 1;
- }
-
rdb_open_tables.free();
/*
destructors for static objects can be called at _exit(),
@@ -5923,7 +5904,7 @@ static int rocksdb_done_func(void *const p) {
MariaDB: don't clear rocksdb_db_options and rocksdb_tbl_options.
MyRocks' plugin variables refer to them.
- The plugin cannot be loaded again (see prevent_myrocks_loading) but plugin
+ The plugin cannot be loaded again but plugin
variables are processed before myrocks::rocksdb_init_func is invoked, so
they must point to valid memory.
*/
@@ -5938,12 +5919,12 @@ static int rocksdb_done_func(void *const p) {
my_error_unregister(HA_ERR_ROCKSDB_FIRST, HA_ERR_ROCKSDB_LAST);
/*
- Prevent loading the plugin after it has been loaded and then unloaded. This
- doesn't work currently.
+ returning non-zero status from the plugin deinit function will prevent
+ the server from unloading the plugin. it will only be marked unusable.
+ This is needed here, because RocksDB cannot be fully unloaded
+ and reloaded (see sql_plugin.cc near STB_GNU_UNIQUE).
*/
- prevent_myrocks_loading= true;
-
- DBUG_RETURN(error);
+ DBUG_RETURN(1);
}
static inline void rocksdb_smart_seek(bool seek_backward,
@@ -10833,7 +10814,7 @@ int ha_rocksdb::index_end() {
release_scan_iterator();
- bitmap_free(&m_lookup_bitmap);
+ my_bitmap_free(&m_lookup_bitmap);
active_index = MAX_KEY;
in_range_check_pushed_down = FALSE;
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 63279bc1b62..63bf7ffd602 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -397,7 +397,7 @@ class ha_rocksdb : public my_core::handler {
current lookup to be covered. If the bitmap field is null, that means this
index does not cover the current lookup for any record.
*/
- MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, nullptr, 0, 0};
+ MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, 0, 0};
int alloc_key_buffers(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
@@ -1062,8 +1062,6 @@ std::string rdb_corruption_marker_file_name();
const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_STABLE;
-extern bool prevent_myrocks_loading;
-
extern uint32_t rocksdb_ignore_datadic_errors;
void sql_print_verbose_info(const char *format, ...);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
index b3df869a0a7..a3a138555ee 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
@@ -1455,7 +1455,7 @@ pk INT AUTO_INCREMENT PRIMARY KEY,
c DECIMAL NOT NULL DEFAULT 1.1
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c' at row 1
+Note 1265 Data truncated for column 'c' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
pk int(11) NO PRI NULL auto_increment
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
index f0cd1a7e8b3..f0d377890c5 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
@@ -1246,7 +1246,7 @@ c2 DECIMAL NULL DEFAULT 1.1,
pk INT AUTO_INCREMENT PRIMARY KEY
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c2' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c decimal(10,0) YES NULL
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
index 6d6cb1db54e..a8e42a4e2b2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
@@ -10,26 +10,35 @@ connection default;
UNINSTALL SONAME 'ha_rocksdb';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ROCKSDB';
ENGINE SUPPORT
ROCKSDB NO
disconnect con1;
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
#
# MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
#
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
-#
-# There are two possible scenarios:
-# ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
-# global variables are in the state that doesn't allow it to be
-# initialized back (this is what MDEV-15686 is about). This is handled
-# by intentionally returning an error from rocksdb_init_func.
-#
-# The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
-# and so it will be now loaded as if it happens for the first time.
-INSTALL SONAME 'ha_rocksdb';
-# Whatever happened on the previous step, restore things to the way they
-# were at testcase start.
-UNINSTALL SONAME 'ha_rocksdb';
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+ERROR HY000: Plugin 'rocksdb' already installed
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
index 0cf56c0cbd5..8f30d7c42b6 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
@@ -31,29 +31,15 @@ disconnect con1;
let $wait_condition= SELECT VARIABLE_VALUE=1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Threads_cached';
--source include/wait_condition.inc
---echo #
---echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
---echo #
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
--echo #
---echo # There are two possible scenarios:
-
---echo # ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
---echo # global variables are in the state that doesn't allow it to be
---echo # initialized back (this is what MDEV-15686 is about). This is handled
---echo # by intentionally returning an error from rocksdb_init_func.
+--echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
--echo #
---echo # The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
---echo # and so it will be now loaded as if it happens for the first time.
-
---error 0,ER_INTERNAL_ERROR
-INSTALL SONAME 'ha_rocksdb';
---echo # Whatever happened on the previous step, restore things to the way they
---echo # were at testcase start.
---error 0,ER_SP_DOES_NOT_EXIST
-UNINSTALL SONAME 'ha_rocksdb';
+--error ER_PLUGIN_INSTALLED
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index 939fb085c4f..9e7983dc634 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -1102,12 +1102,12 @@ size_t Rdb_key_def::get_unpack_header_size(char tag) {
*/
void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
DBUG_ASSERT(map->bitmap == nullptr);
- bitmap_init(map, nullptr, MAX_REF_PARTS, false);
+ my_bitmap_init(map, nullptr, MAX_REF_PARTS);
uint curr_bitmap_pos = 0;
// Indicates which columns in the read set might be covered.
MY_BITMAP maybe_covered_bitmap;
- bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits, false);
+ my_bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits);
for (uint i = 0; i < m_key_parts; i++) {
if (table_has_hidden_pk(table) && i + 1 == m_key_parts) {
@@ -1135,8 +1135,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
}
curr_bitmap_pos++;
} else {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1144,8 +1144,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// know this lookup will never be covered.
default:
if (bitmap_is_set(table->read_set, field->field_index)) {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1155,9 +1155,9 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// If there are columns which are not covered in the read set, the lookup
// can't be covered.
if (!bitmap_cmp(table->read_set, &maybe_covered_bitmap)) {
- bitmap_free(map);
+ my_bitmap_free(map);
}
- bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(&maybe_covered_bitmap);
}
/*
@@ -1187,7 +1187,7 @@ bool Rdb_key_def::covers_lookup(const rocksdb::Slice *const unpack_info,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -1356,7 +1356,7 @@ uint Rdb_key_def::pack_record(const TABLE *const tbl, uchar *const pack_buffer,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
uint curr_bitmap_pos = 0;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
for (uint i = 0; i < n_key_parts; i++) {
// Fill hidden pk id into the last key part for secondary keys for tables
@@ -1661,7 +1661,7 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf,
bool has_covered_bitmap =
has_unpack_info && (unpack_header[0] == RDB_UNPACK_COVERED_DATA_TAG);
if (has_covered_bitmap) {
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -3852,7 +3852,7 @@ bool Rdb_validate_tbls::scan_for_frms(const std::string &datadir,
/* Scan through the files in the directory */
struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Find .frm files that are not temp files (those that contain '#sql') */
const char *ext = strrchr(file_info->name, '.');
if (ext != nullptr && strstr(file_info->name, tmp_file_prefix) == nullptr &&
@@ -3897,7 +3897,7 @@ bool Rdb_validate_tbls::compare_to_actual_tables(const std::string &datadir,
}
file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Ignore files/dirs starting with '.' */
if (file_info->name[0] == '.') continue;
diff --git a/storage/rocksdb/rdb_i_s.cc b/storage/rocksdb/rdb_i_s.cc
index 5350ec3bce9..a3d284dfa64 100644
--- a/storage/rocksdb/rdb_i_s.cc
+++ b/storage/rocksdb/rdb_i_s.cc
@@ -145,9 +145,6 @@ static int rdb_i_s_cfstats_fill_table(
static int rdb_i_s_cfstats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -241,9 +238,6 @@ static int rdb_i_s_dbstats_fill_table(
static int rdb_i_s_dbstats_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -344,8 +338,6 @@ static int rdb_i_s_perf_context_fill_table(
static int rdb_i_s_perf_context_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -413,9 +405,6 @@ static int rdb_i_s_perf_context_global_fill_table(
static int rdb_i_s_perf_context_global_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1045,9 +1034,6 @@ static int rdb_i_s_ddl_fill_table(my_core::THD *const thd,
static int rdb_i_s_ddl_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
my_core::ST_SCHEMA_TABLE *schema;
DBUG_ASSERT(p != nullptr);
@@ -1063,9 +1049,6 @@ static int rdb_i_s_ddl_init(void *const p) {
static int rdb_i_s_cfoptions_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1081,9 +1064,6 @@ static int rdb_i_s_cfoptions_init(void *const p) {
static int rdb_i_s_global_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1101,9 +1081,6 @@ static int rdb_i_s_compact_stats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
schema = reinterpret_cast<my_core::ST_SCHEMA_TABLE *>(p);
@@ -1438,9 +1415,6 @@ static int rdb_i_s_index_file_map_fill_table(
static int rdb_i_s_index_file_map_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1523,9 +1497,6 @@ static int rdb_i_s_lock_info_fill_table(
static int rdb_i_s_lock_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1651,9 +1622,6 @@ static int rdb_i_s_trx_info_fill_table(
static int rdb_i_s_trx_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1781,7 +1749,8 @@ static int rdb_i_s_deadlock_info_init(void *const p) {
static int rdb_i_s_deinit(void *p MY_ATTRIBUTE((__unused__))) {
DBUG_ENTER_FUNC();
- DBUG_RETURN(0);
+ /* see the comment at the end of rocksdb_done_func() */
+ DBUG_RETURN(1);
}
static struct st_mysql_information_schema rdb_i_s_info = {
@@ -1955,7 +1924,7 @@ struct st_maria_plugin rdb_i_s_lock_info = {
"RocksDB lock information",
PLUGIN_LICENSE_GPL,
rdb_i_s_lock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1971,7 +1940,7 @@ struct st_maria_plugin rdb_i_s_trx_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_trx_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1987,7 +1956,7 @@ struct st_maria_plugin rdb_i_s_deadlock_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_deadlock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc
index 45ae89c1bd4..ae3938c3918 100644
--- a/storage/rocksdb/rdb_sst_info.cc
+++ b/storage/rocksdb/rdb_sst_info.cc
@@ -542,7 +542,7 @@ void Rdb_sst_info::init(const rocksdb::DB *const db) {
// Scan through the files in the directory
const struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
// find any files ending with m_suffix ...
const std::string name = file_info->name;
const size_t pos = name.find(m_suffix);
diff --git a/storage/spider/mysql-test/spider/bg/r/ha.result b/storage/spider/mysql-test/spider/bg/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/bg/r/ha.result
+++ b/storage/spider/mysql-test/spider/bg/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/bg/r/ha_part.result b/storage/spider/mysql-test/spider/bg/r/ha_part.result
index 315f37298bc..39fa2655892 100644
--- a/storage/spider/mysql-test/spider/bg/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/bg/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
index aa734573a1a..484ef1a00bd 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -190,6 +194,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
index b793346df4b..d4b05f75660 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -188,6 +192,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
index 1db31ca9f95..a6a7588b014 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
@@ -297,10 +297,16 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
@@ -413,6 +419,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +451,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +485,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
index 9f7ada052ed..b222f494ba1 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/handler/r/ha.result b/storage/spider/mysql-test/spider/handler/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/handler/r/ha.result
+++ b/storage/spider/mysql-test/spider/handler/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/handler/r/ha_part.result b/storage/spider/mysql-test/spider/handler/r/ha_part.result
index 315f37298bc..39fa2655892 100644
--- a/storage/spider/mysql-test/spider/handler/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
index 9a8a59153f0..abe543fe193 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -206,6 +210,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
46
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
index f8747cff5ea..6c3a1802f1d 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -204,6 +208,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
index c171167a1b7..aa7d2ea40c1 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
@@ -297,15 +297,25 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -399,6 +409,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
42
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
@@ -417,6 +428,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -445,10 +460,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -470,6 +494,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
index c99c02071b6..249f39520c2 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
@@ -109,6 +109,10 @@ a b c
2.26
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -202,6 +206,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
index 9f7ada052ed..5a3c1d1c893 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
@@ -1049,6 +1049,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1120,6 +1122,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1172,6 +1175,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1202,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1216,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1237,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
index e6c4456edcb..22ba6102405 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
@@ -485,6 +485,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -556,6 +558,7 @@ if ($HAVE_PARTITION)
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc
index 6a22ffcc1fd..b3fb4df239b 100644
--- a/storage/spider/mysql-test/spider/include/init_spider.inc
+++ b/storage/spider/mysql-test/spider/include/init_spider.inc
@@ -149,13 +149,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
-let $SERVER_NAME=
- `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 2), '-', -1)`;
-if (`SELECT IF('$SERVER_NAME' REGEXP '^[0-9]+\$', 1, 0)`)
-{
- let $SERVER_NAME=
- `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 3), '-', -1)`;
-}
+let $SERVER_NAME=MariaDB;
let $SERVER_MAJOR_VERSION=
`SELECT SUBSTRING_INDEX(version(), '.', 1)`;
let $SERVER_MINOR_VERSION=
diff --git a/storage/spider/mysql-test/spider/r/error_row_number.result b/storage/spider/mysql-test/spider/r/error_row_number.result
new file mode 100644
index 00000000000..cc2b54878a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/error_row_number.result
@@ -0,0 +1,45 @@
+#
+# MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection child2_1;
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+connection master_1;
+create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+insert into spd values (1),(2),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+update spd set id = id + 10;
+ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+drop table spd;
+connection child2_1;
+drop database auto_test_remote;
+connection master_1;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/r/ha.result b/storage/spider/mysql-test/spider/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/r/ha.result
+++ b/storage/spider/mysql-test/spider/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/r/ha_part.result b/storage/spider/mysql-test/spider/r/ha_part.result
index d70d62404c0..d191cab37cd 100644
--- a/storage/spider/mysql-test/spider/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result
index b2a2fad5238..3b9d939393a 100644
--- a/storage/spider/mysql-test/spider/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/r/spider_fixes.result
@@ -297,10 +297,16 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
@@ -413,6 +419,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +451,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +485,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result
new file mode 100644
index 00000000000..cc267f7d363
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result
@@ -0,0 +1,267 @@
+#
+# MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+# MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler = 3;
+Warnings:
+Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_use_handler";
+Variable_name Value
+spider_use_handler 3
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='uhd "3"';
+Warnings:
+Warning 1287 The table parameter 'uhd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='use_handler "3"';
+Warnings:
+Warning 1287 The table parameter 'use_handler' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+Warnings:
+Warning 1287 '@@spider_internal_offset' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_offset";
+Variable_name Value
+spider_internal_offset 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ios "1"';
+Warnings:
+Warning 1287 The table parameter 'ios' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_offset "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_offset' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28005 Deprecate Spider plugin variables regarding UDFs
+SET GLOBAL spider_udf_ds_bulk_insert_rows = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_bulk_insert_rows' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_bulk_insert_rows";
+Variable_name Value
+spider_udf_ds_bulk_insert_rows -1
+SET spider_udf_ds_table_loop_mode = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_table_loop_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_table_loop_mode";
+Variable_name Value
+spider_udf_ds_table_loop_mode 1
+SET spider_udf_ds_use_real_table = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_use_real_table' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_use_real_table";
+Variable_name Value
+spider_udf_ds_use_real_table 1
+SET GLOBAL spider_udf_ct_bulk_insert_interval = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ct_bulk_insert_interval' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_interval";
+Variable_name Value
+spider_udf_ct_bulk_insert_interval 1
+SET GLOBAL spider_udf_ct_bulk_insert_rows = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ct_bulk_insert_rows' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows";
+Variable_name Value
+spider_udf_ct_bulk_insert_rows 1
+# MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+Warnings:
+Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_limit";
+Variable_name Value
+spider_internal_limit 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"';
+Warnings:
+Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_limit "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_limit' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+Warnings:
+Warning 1287 '@@spider_xa_register_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+Variable_name Value
+spider_xa_register_mode 0
+# MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_sts' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_sts";
+Variable_name Value
+spider_store_last_sts 0
+SET GLOBAL spider_store_last_crd = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_crd' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_crd";
+Variable_name Value
+spider_store_last_crd 0
+SET GLOBAL spider_load_sts_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_sts_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+Variable_name Value
+spider_load_sts_at_startup 0
+SET GLOBAL spider_load_crd_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_crd_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+Variable_name Value
+spider_load_crd_at_startup 0
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+Warnings:
+Warning 1287 '@@spider_crd_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_mode";
+Variable_name Value
+spider_crd_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cmd "3"';
+Warnings:
+Warning 1287 The table parameter 'cmd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'crd_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_sts_mode = 1;
+Warnings:
+Warning 1287 '@@spider_sts_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_sts_mode";
+Variable_name Value
+spider_sts_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='smd "3"';
+Warnings:
+Warning 1287 The table parameter 'smd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='sts_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'sts_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+Warnings:
+Warning 1287 '@@spider_crd_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_type";
+Variable_name Value
+spider_crd_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ctp "1"';
+Warnings:
+Warning 1287 The table parameter 'ctp' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_type "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_crd_weight = 1;
+Warnings:
+Warning 1287 '@@spider_crd_weight' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_weight";
+Variable_name Value
+spider_crd_weight 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cwg "1"';
+Warnings:
+Warning 1287 The table parameter 'cwg' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_weight "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_weight' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+Warnings:
+Warning 1287 '@@spider_buffer_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_buffer_size";
+Variable_name Value
+spider_buffer_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='bfz "1"';
+Warnings:
+Warning 1287 The table parameter 'bfz' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='buffer_size "1"';
+Warnings:
+Warning 1287 The table parameter 'buffer_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+Warnings:
+Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+Variable_name Value
+spider_init_sql_alloc_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='isa "1"';
+Warnings:
+Warning 1287 The table parameter 'isa' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='init_sql_alloc_size "1"';
+Warnings:
+Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+Variable_name Value
+spider_semi_table_lock 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stl "1"';
+Warnings:
+Warning 1287 The table parameter 'stl' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock "1"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_semi_table_lock_connection = 0;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock_connection' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+Variable_name Value
+spider_semi_table_lock_connection 0
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stc "0"';
+Warnings:
+Warning 1287 The table parameter 'stc' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock_connection "0"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock_connection' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+Warnings:
+Warning 1287 '@@spider_bka_table_name_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+Variable_name Value
+spider_bka_table_name_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='btt "1"';
+Warnings:
+Warning 1287 The table parameter 'btt' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='bka_table_name_type "1"';
+Warnings:
+Warning 1287 The table parameter 'bka_table_name_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/t/error_row_number.test b/storage/spider/mysql-test/spider/t/error_row_number.test
new file mode 100644
index 00000000000..408e739656a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/error_row_number.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+
+--connection master_1
+evalp create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+
+--error ER_DUP_ENTRY
+insert into spd values (1),(2),(1);
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+--error ER_DUP_ENTRY
+update spd set id = id + 10;
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+drop table spd;
+--connection child2_1
+drop database auto_test_remote;
+--connection master_1
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test
index 56e143060e6..47bc225d614 100644
--- a/storage/spider/mysql-test/spider/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test
new file mode 100644
index 00000000000..1521a60b7cb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test
@@ -0,0 +1,161 @@
+--echo #
+--echo # MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--echo # MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler = 3;
+SHOW VARIABLES LIKE "spider_use_handler";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='uhd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='use_handler "3"';
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+SHOW VARIABLES LIKE "spider_internal_offset";
+
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ios "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_offset "1"';
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28005 Deprecate Spider plugin variables regarding UDFs
+SET GLOBAL spider_udf_ds_bulk_insert_rows = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_bulk_insert_rows";
+
+SET spider_udf_ds_table_loop_mode = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_table_loop_mode";
+
+SET spider_udf_ds_use_real_table = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_use_real_table";
+
+SET GLOBAL spider_udf_ct_bulk_insert_interval = 1;
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_interval";
+
+SET GLOBAL spider_udf_ct_bulk_insert_rows = 1;
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows";
+
+--echo # MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+SHOW VARIABLES LIKE "spider_internal_limit";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ilm "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_limit "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+
+--echo # MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+SHOW VARIABLES LIKE "spider_store_last_sts";
+
+SET GLOBAL spider_store_last_crd = 0;
+SHOW VARIABLES LIKE "spider_store_last_crd";
+
+SET GLOBAL spider_load_sts_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+
+SET GLOBAL spider_load_crd_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+SHOW VARIABLES LIKE "spider_crd_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cmd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_sts_mode = 1;
+SHOW VARIABLES LIKE "spider_sts_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='smd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='sts_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+SHOW VARIABLES LIKE "spider_crd_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ctp "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_crd_weight = 1;
+SHOW VARIABLES LIKE "spider_crd_weight";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cwg "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_weight "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+SHOW VARIABLES LIKE "spider_buffer_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='bfz "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stl "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_semi_table_lock_connection = 0;
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stc "0"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock_connection "0"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='btt "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='bka_table_name_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index f16b1584d58..8d426f85118 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -1968,8 +1968,11 @@ int spider_db_mbase::connect(
conn->tgt_ssl_cert_length |
conn->tgt_ssl_key_length
) {
- mysql_ssl_set(db_conn, conn->tgt_ssl_key, conn->tgt_ssl_cert,
- conn->tgt_ssl_ca, conn->tgt_ssl_capath, conn->tgt_ssl_cipher);
+ mysql_options(db_conn, MYSQL_OPT_SSL_KEY, conn->tgt_ssl_key);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CERT, conn->tgt_ssl_cert);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CA, conn->tgt_ssl_ca);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CAPATH, conn->tgt_ssl_capath);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CIPHER, conn->tgt_ssl_cipher);
if (conn->tgt_ssl_vsc)
{
my_bool verify_flg = TRUE;
diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h
index 19b04d50b82..0dcbcd50230 100644
--- a/storage/spider/spd_init_query.h
+++ b/storage/spider/spd_init_query.h
@@ -224,12 +224,7 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN(
"create procedure mysql.spider_fix_system_tables()"
"begin"
- " select substring_index(substring_index(version(), '-', 2), '-', -1)"
- " into @server_name;"
- " if @server_name regexp '^[0-9]+$' then"
- " select substring_index(substring_index(version(), '-', 3), '-', -1)"
- " into @server_name;"
- " end if;"
+ " select 'MariaDB' into @server_name;"
" select substring_index(version(), '.', 1)"
" into @server_major_version;"
" select substring_index(substring_index(version(), '.', 2), '.', -1)"
@@ -548,7 +543,7 @@ static LEX_STRING spider_init_queries[] = {
" @server_major_version > 10 or"
" ("
" @server_major_version = 10 and"
- " @server_minor_version >= 7"
+ " @server_minor_version >= 8"
" )"
" )"
" then"
@@ -808,7 +803,7 @@ static LEX_STRING spider_init_queries[] = {
" @server_major_version > 10 or"
" ("
" @server_major_version = 10 and"
- " @server_minor_version >= 7"
+ " @server_minor_version >= 8"
" )"
" )"
" then"
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index b23877ca92a..1c9bc10d9c3 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -174,6 +174,34 @@ static MYSQL_SYSVAR_BOOL(
TRUE
);
+static void spider_var_deprecated_int(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ int val= *static_cast<const int *>(save);
+ *static_cast<int *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
+static void spider_var_deprecated_longlong(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ longlong val= *static_cast<const longlong *>(save);
+ *static_cast<longlong *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
my_bool spider_param_support_xa()
{
DBUG_ENTER("spider_param_support_xa");
@@ -255,8 +283,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Use table charset for remote access",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -432,7 +460,7 @@ uint spider_param_force_commit(
*/
static MYSQL_THDVAR_UINT(
xa_register_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of XA transaction register into system table", /* comment */
NULL, /* check */
NULL, /* update */
@@ -455,11 +483,11 @@ uint spider_param_xa_register_mode(
*/
static MYSQL_THDVAR_LONGLONG(
internal_offset, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal offset", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -480,11 +508,11 @@ longlong spider_param_internal_offset(
*/
static MYSQL_THDVAR_LONGLONG(
internal_limit, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal limit", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -508,8 +536,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of rows at a select", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -534,8 +562,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use offset and limit parameter in SQL for split_read parameter.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -559,8 +587,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limit value for semi_split_read", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -582,11 +610,11 @@ longlong spider_param_semi_split_read_limit(
*/
static MYSQL_THDVAR_INT(
init_sql_alloc_size, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Initial sql string alloc size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1024, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -611,8 +639,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Reset sql string alloc after execute", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -664,8 +692,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Sprit read mode for multi range", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 100, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -689,8 +717,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Max columns for order by", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 32767, /* def */
-1, /* min */
32767, /* max */
0 /* blk */
@@ -777,11 +805,11 @@ static int spider_param_semi_table_lock_check(
*/
static MYSQL_THDVAR_INT(
semi_table_lock, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Table lock during execute a sql", /* comment */
&spider_param_semi_table_lock_check, /* check */
NULL, /* update */
- 1, /* def */
+ 0, /* def */
0, /* min */
1, /* max */
0 /* blk */
@@ -842,11 +870,11 @@ static int spider_param_semi_table_lock_connection_check(
*/
static MYSQL_THDVAR_INT(
semi_table_lock_connection, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use different connection if semi_table_lock is enabled", /* comment */
&spider_param_semi_table_lock_connection_check, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -894,8 +922,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Lock for select with update", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -983,8 +1011,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk insert size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1012,8 +1040,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of bulk updating and deleting", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1037,8 +1065,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk update size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1059,11 +1087,11 @@ int spider_param_bulk_update_size(
*/
static MYSQL_THDVAR_INT(
buffer_size, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Buffer size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1088,8 +1116,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1114,8 +1142,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server with local", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1263,8 +1291,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of connecting to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 6, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1290,8 +1318,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of receiving data from remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1317,8 +1345,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of sending data to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1348,8 +1376,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The retrieval result from a remote server is acquired by acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 3, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1373,8 +1401,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of records in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1024, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1398,8 +1426,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limitation of memory size in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 10485760, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1424,8 +1452,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use low memory mode when SQL(SELECT) internally issued to a remote server is executed and get a result list", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1451,8 +1479,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of using columns at select clause", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1480,8 +1508,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of background search", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1506,8 +1534,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1532,8 +1560,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 100, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1559,8 +1587,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1585,8 +1613,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1611,8 +1639,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of cardinality confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 51, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1636,11 +1664,11 @@ double spider_param_crd_interval(
*/
static MYSQL_THDVAR_INT(
crd_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of cardinality confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1668,8 +1696,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Cardinality synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1693,11 +1721,11 @@ int spider_param_crd_sync(
*/
static MYSQL_THDVAR_INT(
crd_type, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Type of cardinality calculation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1718,11 +1746,11 @@ int spider_param_crd_type(
*/
static MYSQL_THDVAR_INT(
crd_weight, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Weight coefficient to calculate effectiveness of index from cardinality of column.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1749,8 +1777,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of cardinality confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1776,8 +1804,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of table state confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 10, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1800,11 +1828,11 @@ double spider_param_sts_interval(
*/
static MYSQL_THDVAR_INT(
sts_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of table state confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1832,8 +1860,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Table state synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1861,8 +1889,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of table state confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1937,8 +1965,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of auto increment.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2030,8 +2058,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute \"REPLACE\" and \"INSERT IGNORE\" on remote server and avoid duplicate check on local server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2097,7 +2125,7 @@ uint spider_param_udf_table_mon_mutex_count()
*/
static MYSQL_THDVAR_LONGLONG(
udf_ds_bulk_insert_rows, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Number of rows for bulk inserting", /* comment */
NULL, /* check */
NULL, /* update */
@@ -2124,7 +2152,7 @@ longlong spider_param_udf_ds_bulk_insert_rows(
*/
static MYSQL_THDVAR_INT(
udf_ds_table_loop_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Table loop mode if the number of tables in table list are less than the number of result sets", /* comment */
NULL, /* check */
NULL, /* update */
@@ -2457,8 +2485,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of BKA for Spider", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -2481,7 +2509,7 @@ static int spider_udf_ct_bulk_insert_interval;
static MYSQL_SYSVAR_INT(
udf_ct_bulk_insert_interval,
spider_udf_ct_bulk_insert_interval,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"The interval time between bulk insert and next bulk insert at coping",
NULL,
NULL,
@@ -2507,7 +2535,7 @@ static longlong spider_udf_ct_bulk_insert_rows;
static MYSQL_SYSVAR_LONGLONG(
udf_ct_bulk_insert_rows,
spider_udf_ct_bulk_insert_rows,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"The number of rows inserted with bulk insert of one time at coping",
NULL,
NULL,
@@ -2680,11 +2708,11 @@ int spider_param_use_hs_write(
*/
static MYSQL_THDVAR_INT(
use_handler, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use handler for reading", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2709,8 +2737,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2735,8 +2763,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Write error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2761,8 +2789,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip generating internal default condition", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2789,8 +2817,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip parallel search by specific conditions", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2815,8 +2843,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Send 'ORDER BY' and 'LIMIT' to remote server directly", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -2841,8 +2869,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read only", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2895,7 +2923,7 @@ int spider_param_bulk_access_free(
*/
static MYSQL_THDVAR_INT(
udf_ds_use_real_table, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use real table for temporary table list", /* comment */
NULL, /* check */
NULL, /* update */
@@ -3090,8 +3118,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read casually if it is possible", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
63, /* max */
0 /* blk */
@@ -3133,8 +3161,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of delete_all_rows", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -3156,11 +3184,11 @@ int spider_param_delete_all_rows_type(
*/
static MYSQL_THDVAR_INT(
bka_table_name_type, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"The type of temporary table name for bka", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -3208,11 +3236,11 @@ static int spider_store_last_sts;
static MYSQL_SYSVAR_INT(
store_last_sts,
spider_store_last_sts,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last sts result into system table",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3235,11 +3263,11 @@ static int spider_store_last_crd;
static MYSQL_SYSVAR_INT(
store_last_crd,
spider_store_last_crd,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last crd result into system table",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3262,11 +3290,11 @@ static int spider_load_sts_at_startup;
static MYSQL_SYSVAR_INT(
load_sts_at_startup,
spider_load_sts_at_startup,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load sts from system table at startup",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3289,11 +3317,11 @@ static int spider_load_crd_at_startup;
static MYSQL_SYSVAR_INT(
load_crd_at_startup,
spider_load_crd_at_startup,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load crd from system table at startup",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3462,8 +3490,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use columns in select clause strictly for group by clause",
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 4265494a63c..4fb3b6c1e40 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1833,30 +1833,41 @@ int st_spider_param_string_parse::print_param_error()
}
#define SPIDER_PARAM_STR_LENS(name) name ## _lengths
#define SPIDER_PARAM_STR_CHARLEN(name) name ## _charlen
-#define SPIDER_PARAM_STR_LIST(title_name, param_name) \
- if (!strncasecmp(tmp_ptr, title_name, title_length)) \
- { \
- DBUG_PRINT("info",("spider " title_name " start")); \
- if (!share->param_name) \
- { \
- if ((tmp_ptr2 = spider_get_string_between_quote( \
- start_ptr, FALSE))) \
- { \
- share->SPIDER_PARAM_STR_CHARLEN(param_name) = strlen(tmp_ptr2); \
- if ((error_num = spider_create_string_list( \
- &share->param_name, \
- &share->SPIDER_PARAM_STR_LENS(param_name), \
- &share->SPIDER_PARAM_STR_LEN(param_name), \
- tmp_ptr2, \
- share->SPIDER_PARAM_STR_CHARLEN(param_name), \
- &connect_string_parse))) \
- goto error; \
- } else { \
- error_num = connect_string_parse.print_param_error(); \
- goto error; \
- } \
- } \
- break; \
+#define SPIDER_PARAM_STR_LIST(title_name, param_name) \
+ if (!strncasecmp(tmp_ptr, title_name, title_length)) \
+ { \
+ DBUG_PRINT("info", ("spider " title_name " start")); \
+ if (!share->param_name) \
+ { \
+ if ((tmp_ptr2= spider_get_string_between_quote(start_ptr, FALSE))) \
+ { \
+ share->SPIDER_PARAM_STR_CHARLEN(param_name)= strlen(tmp_ptr2); \
+ if ((error_num= spider_create_string_list( \
+ &share->param_name, \
+ &share->SPIDER_PARAM_STR_LENS(param_name), \
+ &share->SPIDER_PARAM_STR_LEN(param_name), tmp_ptr2, \
+ share->SPIDER_PARAM_STR_CHARLEN(param_name), \
+ &connect_string_parse))) \
+ { \
+ goto error; \
+ } \
+ THD *thd= current_thd; \
+ if (share->SPIDER_PARAM_STR_LEN(param_name) > 1 && create_table) \
+ { \
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
+ HA_ERR_UNSUPPORTED, \
+ "The high availability feature of Spider " \
+ "has been deprecated " \
+ "and will be removed in a future release"); \
+ } \
+ } \
+ else \
+ { \
+ error_num= connect_string_parse.print_param_error(); \
+ goto error; \
+ } \
+ } \
+ break; \
}
#define SPIDER_PARAM_HINT(title_name, param_name, check_length, max_size, append_method) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
@@ -2060,6 +2071,16 @@ int st_spider_param_string_parse::print_param_error()
} \
break; \
}
+#define SPIDER_PARAM_DEPRECATED_WARNING(title_name) \
+ if (!strncasecmp(tmp_ptr, title_name, title_length) && create_table) \
+ { \
+ THD *thd= current_thd; \
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX, \
+ "The table parameter '%s' is deprecated and will be " \
+ "removed in a future release", \
+ title_name); \
+ }
int spider_parse_connect_info(
SPIDER_SHARE *share,
@@ -2308,6 +2329,7 @@ int spider_parse_connect_info(
#ifdef HA_CAN_BULK_ACCESS
SPIDER_PARAM_INT_WITH_MAX("baf", bulk_access_free, 0, 1);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("bfz");
SPIDER_PARAM_INT("bfz", buffer_size, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bfr", bgs_first_read, 0);
@@ -2317,6 +2339,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_STR("bke", bka_engine);
SPIDER_PARAM_INT_WITH_MAX("bkm", bka_mode, 0, 2);
SPIDER_PARAM_INT("bsz", bulk_size, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("btt");
SPIDER_PARAM_LONG_LIST_WITH_MAX("btt", bka_table_name_types,
0, 1);
SPIDER_PARAM_INT_WITH_MAX("bum", bulk_update_mode, 0, 2);
@@ -2325,6 +2348,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("cbm", crd_bg_mode, 0, 2);
#endif
SPIDER_PARAM_DOUBLE("civ", crd_interval, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("cmd");
SPIDER_PARAM_INT_WITH_MAX("cmd", crd_mode, 0, 3);
SPIDER_PARAM_INT_WITH_MAX("csr", casual_read, 0, 63);
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -2332,7 +2356,9 @@ int spider_parse_connect_info(
#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("cto", connect_timeouts, 0,
2147483647);
+ SPIDER_PARAM_DEPRECATED_WARNING("ctp");
SPIDER_PARAM_INT_WITH_MAX("ctp", crd_type, 0, 2);
+ SPIDER_PARAM_DEPRECATED_WARNING("cwg");
SPIDER_PARAM_DOUBLE("cwg", crd_weight, 1);
SPIDER_PARAM_INT_WITH_MAX("dat", delete_all_rows_type, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("ddi", direct_dup_insert, 0, 1);
@@ -2362,8 +2388,11 @@ int spider_parse_connect_info(
"hwr", hs_write_to_reads, 0, 1);
SPIDER_PARAM_STR_LIST("hws", hs_write_socks);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("isa");
SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("ilm");
SPIDER_PARAM_LONGLONG("ilm", internal_limit, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("ios");
SPIDER_PARAM_LONGLONG("ios", internal_offset, 0);
SPIDER_PARAM_INT_WITH_MAX("iom", internal_optimize, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("iol", internal_optimize_local, 0, 1);
@@ -2416,6 +2445,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("slc", store_last_crd, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("slm", selupd_lock_mode, 0, 2);
SPIDER_PARAM_INT_WITH_MAX("sls", store_last_sts, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("smd");
SPIDER_PARAM_INT_WITH_MAX("smd", sts_mode, 1, 2);
SPIDER_PARAM_LONGLONG("smr", static_mean_rec_length, 0);
SPIDER_PARAM_LONGLONG("spr", split_read, 0);
@@ -2429,12 +2459,15 @@ int spider_parse_connect_info(
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("ssy", sts_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("stc");
SPIDER_PARAM_INT_WITH_MAX("stc", semi_table_lock_conn, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("stl");
SPIDER_PARAM_INT_WITH_MAX("stl", semi_table_lock, 0, 1);
SPIDER_PARAM_LONGLONG("srs", static_records_for_status, 0);
SPIDER_PARAM_LONG_LIST_WITH_MAX("svc", tgt_ssl_vscs, 0, 1);
SPIDER_PARAM_STR_LIST("tbl", tgt_table_names);
SPIDER_PARAM_INT_WITH_MAX("tcm", table_count_mode, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("uhd");
SPIDER_PARAM_LONG_LIST_WITH_MAX("uhd", use_handlers, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONG_LIST_WITH_MAX(
@@ -2477,14 +2510,17 @@ int spider_parse_connect_info(
case 8:
SPIDER_PARAM_STR_LIST("database", tgt_dbs);
SPIDER_PARAM_STR_LIST("password", tgt_passwords);
+ SPIDER_PARAM_DEPRECATED_WARNING("sts_mode");
SPIDER_PARAM_INT_WITH_MAX("sts_mode", sts_mode, 1, 2);
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("sts_sync", sts_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_mode");
SPIDER_PARAM_INT_WITH_MAX("crd_mode", crd_mode, 0, 3);
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("crd_sync", crd_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_type");
SPIDER_PARAM_INT_WITH_MAX("crd_type", crd_type, 0, 2);
SPIDER_PARAM_LONGLONG("priority", priority, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -2502,6 +2538,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 10:
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_weight");
SPIDER_PARAM_DOUBLE("crd_weight", crd_weight, 1);
SPIDER_PARAM_LONGLONG("split_read", split_read, 0);
SPIDER_PARAM_INT_WITH_MAX("quick_mode", quick_mode, 0, 3);
@@ -2518,11 +2555,13 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("sts_bg_mode", sts_bg_mode, 0, 2);
#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("link_status", link_statuses, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("use_handler");
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_handler", use_handlers, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_hs_read", use_hs_reads, 0, 1);
#endif
SPIDER_PARAM_INT_WITH_MAX("casual_read", casual_read, 0, 63);
+ SPIDER_PARAM_DEPRECATED_WARNING("buffer_size");
SPIDER_PARAM_INT("buffer_size", buffer_size, 0);
error_num = connect_string_parse.print_param_error();
goto error;
@@ -2549,6 +2588,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 14:
+ SPIDER_PARAM_DEPRECATED_WARNING("internal_limit");
SPIDER_PARAM_LONGLONG("internal_limit", internal_limit, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bgs_first_read", bgs_first_read, 0);
@@ -2566,8 +2606,10 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 15:
+ SPIDER_PARAM_DEPRECATED_WARNING("internal_offset");
SPIDER_PARAM_LONGLONG("internal_offset", internal_offset, 0);
SPIDER_PARAM_INT_WITH_MAX("reset_sql_alloc", reset_sql_alloc, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock");
SPIDER_PARAM_INT_WITH_MAX("semi_table_lock", semi_table_lock, 0, 1);
SPIDER_PARAM_LONGLONG("quick_page_byte", quick_page_byte, 0);
SPIDER_PARAM_LONGLONG("quick_page_size", quick_page_size, 0);
@@ -2652,12 +2694,14 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 19:
+ SPIDER_PARAM_DEPRECATED_WARNING("init_sql_alloc_size");
SPIDER_PARAM_INT("init_sql_alloc_size", init_sql_alloc_size, 0);
SPIDER_PARAM_INT_WITH_MAX(
"auto_increment_mode", auto_increment_mode, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONGLONG("hs_result_free_size", hs_result_free_size, 0);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("bka_table_name_type");
SPIDER_PARAM_LONG_LIST_WITH_MAX("bka_table_name_type",
bka_table_name_types, 0, 1);
SPIDER_PARAM_INT_WITH_MAX(
@@ -2706,6 +2750,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 26:
+ SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock_connection");
SPIDER_PARAM_INT_WITH_MAX(
"semi_table_lock_connection", semi_table_lock_conn, 0, 1);
error_num = connect_string_parse.print_param_error();
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
index 0e62f9e34ad..54612256adc 100644
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -23,7 +23,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
str2int.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
strxmov.c strxnmov.c xml.c
strmov_overlapp.c
- my_strchr.c strcont.c strappend.c json_lib.c)
+ my_strchr.c strcont.c strappend.c json_lib.c json_normalize.c)
IF(NOT HAVE_STRNLEN)
# OSX below 10.7 did not have strnlen
diff --git a/strings/ctype-ascii.h b/strings/ctype-ascii.h
new file mode 100644
index 00000000000..540d01b1a0d
--- /dev/null
+++ b/strings/ctype-ascii.h
@@ -0,0 +1,189 @@
+#ifndef CTYPE_ASCII_INCLUDED
+#define CTYPE_ASCII_INCLUDED
+
+#include "myisampack.h"
+
+/*
+ Magic expression. It uses the fact that for any byte value X in
+ the range 0..31 (0x00..0x1F) the expression (X+31)*5 returns
+ the 7th bit (0x80) set only for the following six (out of 32) values:
+ 0x00, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F.
+ These values correspond to offsets of non-letter characters
+ in the ASCII table:
+
+ The following macro sets the bit 0x20 for the following characters:
+ ---------------- --------------------------------
+ Magic bit 10000000000000000000000000011111
+ ASCII 0x00..0x1F ................................ Control
+ ASCII 0x20..0x3F ................................ Punctuation, digits
+ ASCII 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
+ ASCII 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~.
+ ---------------- --------------------------------
+ We shift the magic bit 0x80 right twice to make it 0x20.
+ So on the ranges [40..5F] and [60..7F] the expression
+ has the bit 0x20 set for all non-letter characters.
+ Note, other bits contain garbage.
+
+ Requirements:
+ All bytes must be in the range [00..7F],
+ to avoid overflow and carry to the next byte.
+*/
+#define MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC(i) \
+ (((((i)+0x1F1F1F1F1F1F1F1FULL) & 0x1F1F1F1F1F1F1F1F) * 5) >> 2)
+
+
+/*
+ The following macro returns the bit 0x20 set to:
+ - 1 for input bytes in the ranges [60..7F] or [E0..FF]
+ - 0 otherwise
+ Bytes in the ranges [40..7F] and [C0..FF] have the bit 0x40 set.
+ Bytes in the ranges [60..7F] and [E0..FF] have the bit 0x20 set.
+ Hex BinHi BinLo
+ ---- -1-- ----
+ 0x[4C]X .10. ....
+ 0x[5D]X .10. ....
+ 0x[6E]X .11. ....
+ 0x[7F]X .11. ....
+*/
+#define MY_ASCII_20_IS_SET_IF_RANGE_60_7F_OR_E0_FF(i) (((i) >> 1) & ((i)))
+
+
+/*
+ The following macro evaluates to exactly 0x20 for all
+ lower case ASCII letters [a-z], and to 0x00 otherwise:
+
+ Value Range Character range Subrange
+ -------- -------- -------------------------------- -------
+ 00000000 0x00..0x3F Control, punctuation, digits
+ 00100000 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ letters A-Z
+ 00000000 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ non-letters
+ 00100000 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~. letters a-z
+ 00000000 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~. non-letters
+
+ Requirements:
+ All bytes must be in the range [00..7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC().
+*/
+
+#define MY_ASCII_20_IF_IS_LOWER_LETTER(i) \
+ (MY_ASCII_20_IS_SET_IF_RANGE_60_7F_OR_E0_FF(i) & \
+ ~MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC(i) & \
+ 0x2020202020202020)
+
+/*
+ Convert lower case ASCII letters to upper case by unsetting
+ the bit 0x20 with help of the magic expression.
+
+ Requirements:
+ All bytes must be in the range [00..7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC()
+*/
+#define MY_ASCII_TOUPPER_MAGIC(i) \
+ (i ^ MY_ASCII_20_IF_IS_LOWER_LETTER(i))
+
+
+/*
+ Convert a string (consisting of 8 bytes stored in uint64)
+ to upper case algorithmically.
+
+ Requirements:
+ All bytes must be in the range [00..0x7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC().
+ The result on 8bit data is unpredictable!!!
+ The caller should make sure not to pass 8bit data.
+*/
+static inline ulonglong my_ascii_to_upper_magic_uint64(ulonglong i)
+{
+ return MY_ASCII_TOUPPER_MAGIC(i);
+}
+
+
+/*
+ Check if:
+ - both strings "a" and "b" have at least 4 bytes, and
+ - both strings have only 7bit data.
+*/
+static inline int
+my_strcoll_ascii_4bytes_found(const uchar *a, const uchar *ae,
+ const uchar *b, const uchar *be)
+{
+ return a + 4 <= ae && b + 4 <= be &&
+ (uint4korr(b) & 0x80808080) == 0 &&
+ (uint4korr(a) & 0x80808080) == 0;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings case insensitively
+ by converting letters [a-z] to upper case [A-Z].
+
+ Requirements:
+ - The input strings must have at least four bytes, and
+ - The leading four bytes in both strings must be 7bit ASCII.
+ The caller must make sure to provide only strings that meet
+ these requirements. The result on 8-bit data is unpredictable
+ as 8-bit bytes may cause overflow in my_ascii_to_upper_magic_uint64().
+ See comments above.
+*/
+static inline int
+my_strcoll_ascii_toupper_4bytes(const uchar *a, const uchar *b)
+{
+ ulonglong abn= (((ulonglong) mi_uint4korr(a)) << 32) | mi_uint4korr(b);
+ abn= my_ascii_to_upper_magic_uint64(abn);
+ if ((uint32) (abn >> 32) == (uint32) abn)
+ return 0;
+ return ((uint32) (abn >> 32)) < ((uint32) abn) ? -1 : + 1;
+}
+
+
+/*
+ Compare the leading eight 7bit ASCII bytes in two strings case insensitively
+ by converting letters [a-z] to upper case [A-Z].
+
+ Requirements:
+ - The input strings must have at least eight bytes, and
+ - The leading eight bytes in both strings must be 7bit ASCII.
+ See comments in my_strcoll_ascii_toupper_4bytes().
+*/
+static inline int
+my_strcoll_ascii_toupper_8bytes(const uchar *a, const uchar *b)
+{
+ /*
+ TODO:
+ Try to get advantage of SIMD instructions by massive comparison
+ (16 bytes at a time) of characters against (x>='a' && x<='z') using:
+ - either explicit intrinsics
+ - or a loop that can get vectorized automatically by some compilers.
+ */
+ ulonglong an= mi_uint8korr(a);
+ ulonglong bn= mi_uint8korr(b);
+ an= my_ascii_to_upper_magic_uint64(an);
+ bn= my_ascii_to_upper_magic_uint64(bn);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings in binary style.
+*/
+static inline int
+my_strcoll_mb7_bin_4bytes(const uchar *a, const uchar *b)
+{
+ uint32 an= mi_uint4korr(a);
+ uint32 bn= mi_uint4korr(b);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings in binary style.
+*/
+static inline int
+my_strcoll_mb7_bin_8bytes(const uchar *a, const uchar *b)
+{
+ ulonglong an= mi_uint8korr(a);
+ ulonglong bn= mi_uint8korr(b);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+#endif /* CTYPE_ASCII_INCLUDED */
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index d66a2bf8593..2491a5ff7ed 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6691,6 +6691,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (big5code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -6707,6 +6708,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (big5code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 9971750ca1c..af3de05509d 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -34639,6 +34639,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)])
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -34646,6 +34647,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -34654,6 +34656,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)])
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -34662,6 +34665,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 4d159b29494..1f62ebaf636 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -9932,12 +9932,14 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_ci
#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)])
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -9945,6 +9947,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_nopad_ci
#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)])
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -9952,6 +9955,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 72b18b5ec76..ed48917e333 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -212,6 +212,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -221,6 +222,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -231,6 +233,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -241,6 +244,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 7b6b0b080f0..dd3581366fe 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -6344,6 +6344,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -6358,6 +6359,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 2501c293fb2..2e72d5bd7a4 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -10625,6 +10625,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gbkcode(x,y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -10640,6 +10641,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gbkcode(x,y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 313dfaa8f90..c3e64ce0d11 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -34027,6 +34027,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)])
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -34034,6 +34035,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -34042,6 +34044,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)])
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -34050,6 +34053,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index fb0ab7be6a6..adcd4825d88 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -211,6 +211,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -220,6 +221,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -230,6 +232,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -240,6 +243,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 742eeb912e3..40a01d4cba6 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1036,6 +1036,268 @@ static MY_UNICASE_CHARACTER plane05[]={
{0x05FE,0x05FE,0x05FE}, {0x05FF,0x05FF,0x05FF}
};
+static MY_UNICASE_CHARACTER plane06[]={ /* This page is dummy */
+ {0x0600,0x0600,0x0600}, {0x0601,0x0601,0x0601}, /* 0600 */
+ {0x0602,0x0602,0x0602}, {0x0603,0x0603,0x0603}, /* 0602 */
+ {0x0604,0x0604,0x0604}, {0x0605,0x0605,0x0605}, /* 0604 */
+ {0x0606,0x0606,0x0606}, {0x0607,0x0607,0x0607}, /* 0606 */
+ {0x0608,0x0608,0x0608}, {0x0609,0x0609,0x0609}, /* 0608 */
+ {0x060A,0x060A,0x060A}, {0x060B,0x060B,0x060B}, /* 060A */
+ {0x060C,0x060C,0x060C}, {0x060D,0x060D,0x060D}, /* 060C */
+ {0x060E,0x060E,0x060E}, {0x060F,0x060F,0x060F}, /* 060E */
+ {0x0610,0x0610,0x0610}, {0x0611,0x0611,0x0611}, /* 0610 */
+ {0x0612,0x0612,0x0612}, {0x0613,0x0613,0x0613}, /* 0612 */
+ {0x0614,0x0614,0x0614}, {0x0615,0x0615,0x0615}, /* 0614 */
+ {0x0616,0x0616,0x0616}, {0x0617,0x0617,0x0617}, /* 0616 */
+ {0x0618,0x0618,0x0618}, {0x0619,0x0619,0x0619}, /* 0618 */
+ {0x061A,0x061A,0x061A}, {0x061B,0x061B,0x061B}, /* 061A */
+ {0x061C,0x061C,0x061C}, {0x061D,0x061D,0x061D}, /* 061C */
+ {0x061E,0x061E,0x061E}, {0x061F,0x061F,0x061F}, /* 061E */
+ {0x0620,0x0620,0x0620}, {0x0621,0x0621,0x0621}, /* 0620 */
+ {0x0622,0x0622,0x0622}, {0x0623,0x0623,0x0623}, /* 0622 */
+ {0x0624,0x0624,0x0624}, {0x0625,0x0625,0x0625}, /* 0624 */
+ {0x0626,0x0626,0x0626}, {0x0627,0x0627,0x0627}, /* 0626 */
+ {0x0628,0x0628,0x0628}, {0x0629,0x0629,0x0629}, /* 0628 */
+ {0x062A,0x062A,0x062A}, {0x062B,0x062B,0x062B}, /* 062A */
+ {0x062C,0x062C,0x062C}, {0x062D,0x062D,0x062D}, /* 062C */
+ {0x062E,0x062E,0x062E}, {0x062F,0x062F,0x062F}, /* 062E */
+ {0x0630,0x0630,0x0630}, {0x0631,0x0631,0x0631}, /* 0630 */
+ {0x0632,0x0632,0x0632}, {0x0633,0x0633,0x0633}, /* 0632 */
+ {0x0634,0x0634,0x0634}, {0x0635,0x0635,0x0635}, /* 0634 */
+ {0x0636,0x0636,0x0636}, {0x0637,0x0637,0x0637}, /* 0636 */
+ {0x0638,0x0638,0x0638}, {0x0639,0x0639,0x0639}, /* 0638 */
+ {0x063A,0x063A,0x063A}, {0x063B,0x063B,0x063B}, /* 063A */
+ {0x063C,0x063C,0x063C}, {0x063D,0x063D,0x063D}, /* 063C */
+ {0x063E,0x063E,0x063E}, {0x063F,0x063F,0x063F}, /* 063E */
+ {0x0640,0x0640,0x0640}, {0x0641,0x0641,0x0641}, /* 0640 */
+ {0x0642,0x0642,0x0642}, {0x0643,0x0643,0x0643}, /* 0642 */
+ {0x0644,0x0644,0x0644}, {0x0645,0x0645,0x0645}, /* 0644 */
+ {0x0646,0x0646,0x0646}, {0x0647,0x0647,0x0647}, /* 0646 */
+ {0x0648,0x0648,0x0648}, {0x0649,0x0649,0x0649}, /* 0648 */
+ {0x064A,0x064A,0x064A}, {0x064B,0x064B,0x064B}, /* 064A */
+ {0x064C,0x064C,0x064C}, {0x064D,0x064D,0x064D}, /* 064C */
+ {0x064E,0x064E,0x064E}, {0x064F,0x064F,0x064F}, /* 064E */
+ {0x0650,0x0650,0x0650}, {0x0651,0x0651,0x0651}, /* 0650 */
+ {0x0652,0x0652,0x0652}, {0x0653,0x0653,0x0653}, /* 0652 */
+ {0x0654,0x0654,0x0654}, {0x0655,0x0655,0x0655}, /* 0654 */
+ {0x0656,0x0656,0x0656}, {0x0657,0x0657,0x0657}, /* 0656 */
+ {0x0658,0x0658,0x0658}, {0x0659,0x0659,0x0659}, /* 0658 */
+ {0x065A,0x065A,0x065A}, {0x065B,0x065B,0x065B}, /* 065A */
+ {0x065C,0x065C,0x065C}, {0x065D,0x065D,0x065D}, /* 065C */
+ {0x065E,0x065E,0x065E}, {0x065F,0x065F,0x065F}, /* 065E */
+ {0x0660,0x0660,0x0660}, {0x0661,0x0661,0x0661}, /* 0660 */
+ {0x0662,0x0662,0x0662}, {0x0663,0x0663,0x0663}, /* 0662 */
+ {0x0664,0x0664,0x0664}, {0x0665,0x0665,0x0665}, /* 0664 */
+ {0x0666,0x0666,0x0666}, {0x0667,0x0667,0x0667}, /* 0666 */
+ {0x0668,0x0668,0x0668}, {0x0669,0x0669,0x0669}, /* 0668 */
+ {0x066A,0x066A,0x066A}, {0x066B,0x066B,0x066B}, /* 066A */
+ {0x066C,0x066C,0x066C}, {0x066D,0x066D,0x066D}, /* 066C */
+ {0x066E,0x066E,0x066E}, {0x066F,0x066F,0x066F}, /* 066E */
+ {0x0670,0x0670,0x0670}, {0x0671,0x0671,0x0671}, /* 0670 */
+ {0x0672,0x0672,0x0672}, {0x0673,0x0673,0x0673}, /* 0672 */
+ {0x0674,0x0674,0x0674}, {0x0675,0x0675,0x0675}, /* 0674 */
+ {0x0676,0x0676,0x0676}, {0x0677,0x0677,0x0677}, /* 0676 */
+ {0x0678,0x0678,0x0678}, {0x0679,0x0679,0x0679}, /* 0678 */
+ {0x067A,0x067A,0x067A}, {0x067B,0x067B,0x067B}, /* 067A */
+ {0x067C,0x067C,0x067C}, {0x067D,0x067D,0x067D}, /* 067C */
+ {0x067E,0x067E,0x067E}, {0x067F,0x067F,0x067F}, /* 067E */
+ {0x0680,0x0680,0x0680}, {0x0681,0x0681,0x0681}, /* 0680 */
+ {0x0682,0x0682,0x0682}, {0x0683,0x0683,0x0683}, /* 0682 */
+ {0x0684,0x0684,0x0684}, {0x0685,0x0685,0x0685}, /* 0684 */
+ {0x0686,0x0686,0x0686}, {0x0687,0x0687,0x0687}, /* 0686 */
+ {0x0688,0x0688,0x0688}, {0x0689,0x0689,0x0689}, /* 0688 */
+ {0x068A,0x068A,0x068A}, {0x068B,0x068B,0x068B}, /* 068A */
+ {0x068C,0x068C,0x068C}, {0x068D,0x068D,0x068D}, /* 068C */
+ {0x068E,0x068E,0x068E}, {0x068F,0x068F,0x068F}, /* 068E */
+ {0x0690,0x0690,0x0690}, {0x0691,0x0691,0x0691}, /* 0690 */
+ {0x0692,0x0692,0x0692}, {0x0693,0x0693,0x0693}, /* 0692 */
+ {0x0694,0x0694,0x0694}, {0x0695,0x0695,0x0695}, /* 0694 */
+ {0x0696,0x0696,0x0696}, {0x0697,0x0697,0x0697}, /* 0696 */
+ {0x0698,0x0698,0x0698}, {0x0699,0x0699,0x0699}, /* 0698 */
+ {0x069A,0x069A,0x069A}, {0x069B,0x069B,0x069B}, /* 069A */
+ {0x069C,0x069C,0x069C}, {0x069D,0x069D,0x069D}, /* 069C */
+ {0x069E,0x069E,0x069E}, {0x069F,0x069F,0x069F}, /* 069E */
+ {0x06A0,0x06A0,0x06A0}, {0x06A1,0x06A1,0x06A1}, /* 06A0 */
+ {0x06A2,0x06A2,0x06A2}, {0x06A3,0x06A3,0x06A3}, /* 06A2 */
+ {0x06A4,0x06A4,0x06A4}, {0x06A5,0x06A5,0x06A5}, /* 06A4 */
+ {0x06A6,0x06A6,0x06A6}, {0x06A7,0x06A7,0x06A7}, /* 06A6 */
+ {0x06A8,0x06A8,0x06A8}, {0x06A9,0x06A9,0x06A9}, /* 06A8 */
+ {0x06AA,0x06AA,0x06AA}, {0x06AB,0x06AB,0x06AB}, /* 06AA */
+ {0x06AC,0x06AC,0x06AC}, {0x06AD,0x06AD,0x06AD}, /* 06AC */
+ {0x06AE,0x06AE,0x06AE}, {0x06AF,0x06AF,0x06AF}, /* 06AE */
+ {0x06B0,0x06B0,0x06B0}, {0x06B1,0x06B1,0x06B1}, /* 06B0 */
+ {0x06B2,0x06B2,0x06B2}, {0x06B3,0x06B3,0x06B3}, /* 06B2 */
+ {0x06B4,0x06B4,0x06B4}, {0x06B5,0x06B5,0x06B5}, /* 06B4 */
+ {0x06B6,0x06B6,0x06B6}, {0x06B7,0x06B7,0x06B7}, /* 06B6 */
+ {0x06B8,0x06B8,0x06B8}, {0x06B9,0x06B9,0x06B9}, /* 06B8 */
+ {0x06BA,0x06BA,0x06BA}, {0x06BB,0x06BB,0x06BB}, /* 06BA */
+ {0x06BC,0x06BC,0x06BC}, {0x06BD,0x06BD,0x06BD}, /* 06BC */
+ {0x06BE,0x06BE,0x06BE}, {0x06BF,0x06BF,0x06BF}, /* 06BE */
+ {0x06C0,0x06C0,0x06C0}, {0x06C1,0x06C1,0x06C1}, /* 06C0 */
+ {0x06C2,0x06C2,0x06C2}, {0x06C3,0x06C3,0x06C3}, /* 06C2 */
+ {0x06C4,0x06C4,0x06C4}, {0x06C5,0x06C5,0x06C5}, /* 06C4 */
+ {0x06C6,0x06C6,0x06C6}, {0x06C7,0x06C7,0x06C7}, /* 06C6 */
+ {0x06C8,0x06C8,0x06C8}, {0x06C9,0x06C9,0x06C9}, /* 06C8 */
+ {0x06CA,0x06CA,0x06CA}, {0x06CB,0x06CB,0x06CB}, /* 06CA */
+ {0x06CC,0x06CC,0x06CC}, {0x06CD,0x06CD,0x06CD}, /* 06CC */
+ {0x06CE,0x06CE,0x06CE}, {0x06CF,0x06CF,0x06CF}, /* 06CE */
+ {0x06D0,0x06D0,0x06D0}, {0x06D1,0x06D1,0x06D1}, /* 06D0 */
+ {0x06D2,0x06D2,0x06D2}, {0x06D3,0x06D3,0x06D3}, /* 06D2 */
+ {0x06D4,0x06D4,0x06D4}, {0x06D5,0x06D5,0x06D5}, /* 06D4 */
+ {0x06D6,0x06D6,0x06D6}, {0x06D7,0x06D7,0x06D7}, /* 06D6 */
+ {0x06D8,0x06D8,0x06D8}, {0x06D9,0x06D9,0x06D9}, /* 06D8 */
+ {0x06DA,0x06DA,0x06DA}, {0x06DB,0x06DB,0x06DB}, /* 06DA */
+ {0x06DC,0x06DC,0x06DC}, {0x06DD,0x06DD,0x06DD}, /* 06DC */
+ {0x06DE,0x06DE,0x06DE}, {0x06DF,0x06DF,0x06DF}, /* 06DE */
+ {0x06E0,0x06E0,0x06E0}, {0x06E1,0x06E1,0x06E1}, /* 06E0 */
+ {0x06E2,0x06E2,0x06E2}, {0x06E3,0x06E3,0x06E3}, /* 06E2 */
+ {0x06E4,0x06E4,0x06E4}, {0x06E5,0x06E5,0x06E5}, /* 06E4 */
+ {0x06E6,0x06E6,0x06E6}, {0x06E7,0x06E7,0x06E7}, /* 06E6 */
+ {0x06E8,0x06E8,0x06E8}, {0x06E9,0x06E9,0x06E9}, /* 06E8 */
+ {0x06EA,0x06EA,0x06EA}, {0x06EB,0x06EB,0x06EB}, /* 06EA */
+ {0x06EC,0x06EC,0x06EC}, {0x06ED,0x06ED,0x06ED}, /* 06EC */
+ {0x06EE,0x06EE,0x06EE}, {0x06EF,0x06EF,0x06EF}, /* 06EE */
+ {0x06F0,0x06F0,0x06F0}, {0x06F1,0x06F1,0x06F1}, /* 06F0 */
+ {0x06F2,0x06F2,0x06F2}, {0x06F3,0x06F3,0x06F3}, /* 06F2 */
+ {0x06F4,0x06F4,0x06F4}, {0x06F5,0x06F5,0x06F5}, /* 06F4 */
+ {0x06F6,0x06F6,0x06F6}, {0x06F7,0x06F7,0x06F7}, /* 06F6 */
+ {0x06F8,0x06F8,0x06F8}, {0x06F9,0x06F9,0x06F9}, /* 06F8 */
+ {0x06FA,0x06FA,0x06FA}, {0x06FB,0x06FB,0x06FB}, /* 06FA */
+ {0x06FC,0x06FC,0x06FC}, {0x06FD,0x06FD,0x06FD}, /* 06FC */
+ {0x06FE,0x06FE,0x06FE}, {0x06FF,0x06FF,0x06FF} /* 06FE */
+};
+
+static MY_UNICASE_CHARACTER plane07[]={ /* This page is dummy */
+ {0x0700,0x0700,0x0700}, {0x0701,0x0701,0x0701}, /* 0700 */
+ {0x0702,0x0702,0x0702}, {0x0703,0x0703,0x0703}, /* 0702 */
+ {0x0704,0x0704,0x0704}, {0x0705,0x0705,0x0705}, /* 0704 */
+ {0x0706,0x0706,0x0706}, {0x0707,0x0707,0x0707}, /* 0706 */
+ {0x0708,0x0708,0x0708}, {0x0709,0x0709,0x0709}, /* 0708 */
+ {0x070A,0x070A,0x070A}, {0x070B,0x070B,0x070B}, /* 070A */
+ {0x070C,0x070C,0x070C}, {0x070D,0x070D,0x070D}, /* 070C */
+ {0x070E,0x070E,0x070E}, {0x070F,0x070F,0x070F}, /* 070E */
+ {0x0710,0x0710,0x0710}, {0x0711,0x0711,0x0711}, /* 0710 */
+ {0x0712,0x0712,0x0712}, {0x0713,0x0713,0x0713}, /* 0712 */
+ {0x0714,0x0714,0x0714}, {0x0715,0x0715,0x0715}, /* 0714 */
+ {0x0716,0x0716,0x0716}, {0x0717,0x0717,0x0717}, /* 0716 */
+ {0x0718,0x0718,0x0718}, {0x0719,0x0719,0x0719}, /* 0718 */
+ {0x071A,0x071A,0x071A}, {0x071B,0x071B,0x071B}, /* 071A */
+ {0x071C,0x071C,0x071C}, {0x071D,0x071D,0x071D}, /* 071C */
+ {0x071E,0x071E,0x071E}, {0x071F,0x071F,0x071F}, /* 071E */
+ {0x0720,0x0720,0x0720}, {0x0721,0x0721,0x0721}, /* 0720 */
+ {0x0722,0x0722,0x0722}, {0x0723,0x0723,0x0723}, /* 0722 */
+ {0x0724,0x0724,0x0724}, {0x0725,0x0725,0x0725}, /* 0724 */
+ {0x0726,0x0726,0x0726}, {0x0727,0x0727,0x0727}, /* 0726 */
+ {0x0728,0x0728,0x0728}, {0x0729,0x0729,0x0729}, /* 0728 */
+ {0x072A,0x072A,0x072A}, {0x072B,0x072B,0x072B}, /* 072A */
+ {0x072C,0x072C,0x072C}, {0x072D,0x072D,0x072D}, /* 072C */
+ {0x072E,0x072E,0x072E}, {0x072F,0x072F,0x072F}, /* 072E */
+ {0x0730,0x0730,0x0730}, {0x0731,0x0731,0x0731}, /* 0730 */
+ {0x0732,0x0732,0x0732}, {0x0733,0x0733,0x0733}, /* 0732 */
+ {0x0734,0x0734,0x0734}, {0x0735,0x0735,0x0735}, /* 0734 */
+ {0x0736,0x0736,0x0736}, {0x0737,0x0737,0x0737}, /* 0736 */
+ {0x0738,0x0738,0x0738}, {0x0739,0x0739,0x0739}, /* 0738 */
+ {0x073A,0x073A,0x073A}, {0x073B,0x073B,0x073B}, /* 073A */
+ {0x073C,0x073C,0x073C}, {0x073D,0x073D,0x073D}, /* 073C */
+ {0x073E,0x073E,0x073E}, {0x073F,0x073F,0x073F}, /* 073E */
+ {0x0740,0x0740,0x0740}, {0x0741,0x0741,0x0741}, /* 0740 */
+ {0x0742,0x0742,0x0742}, {0x0743,0x0743,0x0743}, /* 0742 */
+ {0x0744,0x0744,0x0744}, {0x0745,0x0745,0x0745}, /* 0744 */
+ {0x0746,0x0746,0x0746}, {0x0747,0x0747,0x0747}, /* 0746 */
+ {0x0748,0x0748,0x0748}, {0x0749,0x0749,0x0749}, /* 0748 */
+ {0x074A,0x074A,0x074A}, {0x074B,0x074B,0x074B}, /* 074A */
+ {0x074C,0x074C,0x074C}, {0x074D,0x074D,0x074D}, /* 074C */
+ {0x074E,0x074E,0x074E}, {0x074F,0x074F,0x074F}, /* 074E */
+ {0x0750,0x0750,0x0750}, {0x0751,0x0751,0x0751}, /* 0750 */
+ {0x0752,0x0752,0x0752}, {0x0753,0x0753,0x0753}, /* 0752 */
+ {0x0754,0x0754,0x0754}, {0x0755,0x0755,0x0755}, /* 0754 */
+ {0x0756,0x0756,0x0756}, {0x0757,0x0757,0x0757}, /* 0756 */
+ {0x0758,0x0758,0x0758}, {0x0759,0x0759,0x0759}, /* 0758 */
+ {0x075A,0x075A,0x075A}, {0x075B,0x075B,0x075B}, /* 075A */
+ {0x075C,0x075C,0x075C}, {0x075D,0x075D,0x075D}, /* 075C */
+ {0x075E,0x075E,0x075E}, {0x075F,0x075F,0x075F}, /* 075E */
+ {0x0760,0x0760,0x0760}, {0x0761,0x0761,0x0761}, /* 0760 */
+ {0x0762,0x0762,0x0762}, {0x0763,0x0763,0x0763}, /* 0762 */
+ {0x0764,0x0764,0x0764}, {0x0765,0x0765,0x0765}, /* 0764 */
+ {0x0766,0x0766,0x0766}, {0x0767,0x0767,0x0767}, /* 0766 */
+ {0x0768,0x0768,0x0768}, {0x0769,0x0769,0x0769}, /* 0768 */
+ {0x076A,0x076A,0x076A}, {0x076B,0x076B,0x076B}, /* 076A */
+ {0x076C,0x076C,0x076C}, {0x076D,0x076D,0x076D}, /* 076C */
+ {0x076E,0x076E,0x076E}, {0x076F,0x076F,0x076F}, /* 076E */
+ {0x0770,0x0770,0x0770}, {0x0771,0x0771,0x0771}, /* 0770 */
+ {0x0772,0x0772,0x0772}, {0x0773,0x0773,0x0773}, /* 0772 */
+ {0x0774,0x0774,0x0774}, {0x0775,0x0775,0x0775}, /* 0774 */
+ {0x0776,0x0776,0x0776}, {0x0777,0x0777,0x0777}, /* 0776 */
+ {0x0778,0x0778,0x0778}, {0x0779,0x0779,0x0779}, /* 0778 */
+ {0x077A,0x077A,0x077A}, {0x077B,0x077B,0x077B}, /* 077A */
+ {0x077C,0x077C,0x077C}, {0x077D,0x077D,0x077D}, /* 077C */
+ {0x077E,0x077E,0x077E}, {0x077F,0x077F,0x077F}, /* 077E */
+ {0x0780,0x0780,0x0780}, {0x0781,0x0781,0x0781}, /* 0780 */
+ {0x0782,0x0782,0x0782}, {0x0783,0x0783,0x0783}, /* 0782 */
+ {0x0784,0x0784,0x0784}, {0x0785,0x0785,0x0785}, /* 0784 */
+ {0x0786,0x0786,0x0786}, {0x0787,0x0787,0x0787}, /* 0786 */
+ {0x0788,0x0788,0x0788}, {0x0789,0x0789,0x0789}, /* 0788 */
+ {0x078A,0x078A,0x078A}, {0x078B,0x078B,0x078B}, /* 078A */
+ {0x078C,0x078C,0x078C}, {0x078D,0x078D,0x078D}, /* 078C */
+ {0x078E,0x078E,0x078E}, {0x078F,0x078F,0x078F}, /* 078E */
+ {0x0790,0x0790,0x0790}, {0x0791,0x0791,0x0791}, /* 0790 */
+ {0x0792,0x0792,0x0792}, {0x0793,0x0793,0x0793}, /* 0792 */
+ {0x0794,0x0794,0x0794}, {0x0795,0x0795,0x0795}, /* 0794 */
+ {0x0796,0x0796,0x0796}, {0x0797,0x0797,0x0797}, /* 0796 */
+ {0x0798,0x0798,0x0798}, {0x0799,0x0799,0x0799}, /* 0798 */
+ {0x079A,0x079A,0x079A}, {0x079B,0x079B,0x079B}, /* 079A */
+ {0x079C,0x079C,0x079C}, {0x079D,0x079D,0x079D}, /* 079C */
+ {0x079E,0x079E,0x079E}, {0x079F,0x079F,0x079F}, /* 079E */
+ {0x07A0,0x07A0,0x07A0}, {0x07A1,0x07A1,0x07A1}, /* 07A0 */
+ {0x07A2,0x07A2,0x07A2}, {0x07A3,0x07A3,0x07A3}, /* 07A2 */
+ {0x07A4,0x07A4,0x07A4}, {0x07A5,0x07A5,0x07A5}, /* 07A4 */
+ {0x07A6,0x07A6,0x07A6}, {0x07A7,0x07A7,0x07A7}, /* 07A6 */
+ {0x07A8,0x07A8,0x07A8}, {0x07A9,0x07A9,0x07A9}, /* 07A8 */
+ {0x07AA,0x07AA,0x07AA}, {0x07AB,0x07AB,0x07AB}, /* 07AA */
+ {0x07AC,0x07AC,0x07AC}, {0x07AD,0x07AD,0x07AD}, /* 07AC */
+ {0x07AE,0x07AE,0x07AE}, {0x07AF,0x07AF,0x07AF}, /* 07AE */
+ {0x07B0,0x07B0,0x07B0}, {0x07B1,0x07B1,0x07B1}, /* 07B0 */
+ {0x07B2,0x07B2,0x07B2}, {0x07B3,0x07B3,0x07B3}, /* 07B2 */
+ {0x07B4,0x07B4,0x07B4}, {0x07B5,0x07B5,0x07B5}, /* 07B4 */
+ {0x07B6,0x07B6,0x07B6}, {0x07B7,0x07B7,0x07B7}, /* 07B6 */
+ {0x07B8,0x07B8,0x07B8}, {0x07B9,0x07B9,0x07B9}, /* 07B8 */
+ {0x07BA,0x07BA,0x07BA}, {0x07BB,0x07BB,0x07BB}, /* 07BA */
+ {0x07BC,0x07BC,0x07BC}, {0x07BD,0x07BD,0x07BD}, /* 07BC */
+ {0x07BE,0x07BE,0x07BE}, {0x07BF,0x07BF,0x07BF}, /* 07BE */
+ {0x07C0,0x07C0,0x07C0}, {0x07C1,0x07C1,0x07C1}, /* 07C0 */
+ {0x07C2,0x07C2,0x07C2}, {0x07C3,0x07C3,0x07C3}, /* 07C2 */
+ {0x07C4,0x07C4,0x07C4}, {0x07C5,0x07C5,0x07C5}, /* 07C4 */
+ {0x07C6,0x07C6,0x07C6}, {0x07C7,0x07C7,0x07C7}, /* 07C6 */
+ {0x07C8,0x07C8,0x07C8}, {0x07C9,0x07C9,0x07C9}, /* 07C8 */
+ {0x07CA,0x07CA,0x07CA}, {0x07CB,0x07CB,0x07CB}, /* 07CA */
+ {0x07CC,0x07CC,0x07CC}, {0x07CD,0x07CD,0x07CD}, /* 07CC */
+ {0x07CE,0x07CE,0x07CE}, {0x07CF,0x07CF,0x07CF}, /* 07CE */
+ {0x07D0,0x07D0,0x07D0}, {0x07D1,0x07D1,0x07D1}, /* 07D0 */
+ {0x07D2,0x07D2,0x07D2}, {0x07D3,0x07D3,0x07D3}, /* 07D2 */
+ {0x07D4,0x07D4,0x07D4}, {0x07D5,0x07D5,0x07D5}, /* 07D4 */
+ {0x07D6,0x07D6,0x07D6}, {0x07D7,0x07D7,0x07D7}, /* 07D6 */
+ {0x07D8,0x07D8,0x07D8}, {0x07D9,0x07D9,0x07D9}, /* 07D8 */
+ {0x07DA,0x07DA,0x07DA}, {0x07DB,0x07DB,0x07DB}, /* 07DA */
+ {0x07DC,0x07DC,0x07DC}, {0x07DD,0x07DD,0x07DD}, /* 07DC */
+ {0x07DE,0x07DE,0x07DE}, {0x07DF,0x07DF,0x07DF}, /* 07DE */
+ {0x07E0,0x07E0,0x07E0}, {0x07E1,0x07E1,0x07E1}, /* 07E0 */
+ {0x07E2,0x07E2,0x07E2}, {0x07E3,0x07E3,0x07E3}, /* 07E2 */
+ {0x07E4,0x07E4,0x07E4}, {0x07E5,0x07E5,0x07E5}, /* 07E4 */
+ {0x07E6,0x07E6,0x07E6}, {0x07E7,0x07E7,0x07E7}, /* 07E6 */
+ {0x07E8,0x07E8,0x07E8}, {0x07E9,0x07E9,0x07E9}, /* 07E8 */
+ {0x07EA,0x07EA,0x07EA}, {0x07EB,0x07EB,0x07EB}, /* 07EA */
+ {0x07EC,0x07EC,0x07EC}, {0x07ED,0x07ED,0x07ED}, /* 07EC */
+ {0x07EE,0x07EE,0x07EE}, {0x07EF,0x07EF,0x07EF}, /* 07EE */
+ {0x07F0,0x07F0,0x07F0}, {0x07F1,0x07F1,0x07F1}, /* 07F0 */
+ {0x07F2,0x07F2,0x07F2}, {0x07F3,0x07F3,0x07F3}, /* 07F2 */
+ {0x07F4,0x07F4,0x07F4}, {0x07F5,0x07F5,0x07F5}, /* 07F4 */
+ {0x07F6,0x07F6,0x07F6}, {0x07F7,0x07F7,0x07F7}, /* 07F6 */
+ {0x07F8,0x07F8,0x07F8}, {0x07F9,0x07F9,0x07F9}, /* 07F8 */
+ {0x07FA,0x07FA,0x07FA}, {0x07FB,0x07FB,0x07FB}, /* 07FA */
+ {0x07FC,0x07FC,0x07FC}, {0x07FD,0x07FD,0x07FD}, /* 07FC */
+ {0x07FE,0x07FE,0x07FE}, {0x07FF,0x07FF,0x07FF} /* 07FE */
+};
+
static MY_UNICASE_CHARACTER plane1E[]={
{0x1E00,0x1E01,0x0041}, {0x1E00,0x1E01,0x0041},
{0x1E02,0x1E03,0x0042}, {0x1E02,0x1E03,0x0042},
@@ -1695,7 +1957,7 @@ static MY_UNICASE_CHARACTER planeFF[]={
MY_UNICASE_CHARACTER *my_unicase_default_pages[256]=
{
my_unicase_default_page00,
- plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -1742,7 +2004,7 @@ MY_UNICASE_INFO my_unicase_default=
*/
MY_UNICASE_CHARACTER *my_unicase_pages_mysql500[256]={
plane00_mysql500,
- plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -1929,7 +2191,7 @@ static MY_UNICASE_CHARACTER turk00[]=
static MY_UNICASE_CHARACTER *my_unicase_pages_turkish[256]=
{
- turk00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ turk00, plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -4333,7 +4595,7 @@ static MY_UNICASE_CHARACTER u520p104[]={
MY_UNICASE_CHARACTER *my_unicase_pages_unicode520[4352]=
{
- u520p00, u520p01, u520p02, u520p03, u520p04, u520p05, NULL, NULL,
+ u520p00, u520p01, u520p02, u520p03, u520p04, u520p05, plane06, plane06,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
u520p10, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, u520p1D, u520p1E, u520p1F,
@@ -5231,7 +5493,17 @@ 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];
- return (int) (page ? page[wc & 0xFF].sort : wc);
+ /*
+ 2-byte utf8 sequences encode Unicode characters up to U+07FF.
+ my_unicase_default_pages[N] has non-NULL page pointers
+ for all N in the range [0..7].
+ - my_unicase_default_pages[0..5] point to real translation data
+ - my_unicase_default_pages[6..7] point to dummy pages
+ (without real translation).
+ By adding these dummy pages we can avoid testing 'page' against NULL.
+ This gives up to 20% performance improvement.
+ */
+ return (int) page[wc & 0xFF].sort;
}
@@ -5255,6 +5527,7 @@ static inline int my_weight_mb3_utf8mb3_general_ci(uchar b0, uchar b1, uchar b2)
#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)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -5264,6 +5537,7 @@ static inline int my_weight_mb3_utf8mb3_general_ci(uchar b0, uchar b1, uchar b2)
#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)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -5277,7 +5551,11 @@ 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];
- return (int) (page ? page[wc & 0xFF].sort : wc);
+ /*
+ `page` should never be NULL for 2-byte utf8 characters.
+ See comments in my_weight_mb2_utf8mb3_general_ci().
+ */
+ return (int) page[wc & 0xFF].sort;
}
@@ -5301,6 +5579,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#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)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -5312,6 +5591,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) ((int) (uchar) (x))
#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y))
#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -5321,6 +5601,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) ((int) (uchar) (x))
#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y))
#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
/*
@@ -7692,6 +7973,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
All non-BMP characters have the same weight.
*/
#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -7701,6 +7983,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1))
#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2))
#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
@@ -7715,6 +7998,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
All non-BMP characters have the same weight.
*/
#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.inl"
@@ -7725,6 +8009,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1))
#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2))
#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3))
+#define STRCOLL_MB7_BIN
#include "strcoll.inl"
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 19af1a6ede6..f451b12aa61 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -844,7 +844,7 @@ static int skip_key(json_engine_t *j)
{
int t_next, c_len;
- if (json_instr_chr_map[j->s.c_next] == S_BKSL &&
+ if (j->s.c_next< 128 && json_instr_chr_map[j->s.c_next] == S_BKSL &&
json_handle_esc(&j->s))
return 1;
@@ -951,7 +951,7 @@ int json_read_value(json_engine_t *j)
{
int t_next, c_len, res;
- j->value_type= JSON_VALUE_UNINITALIZED;
+ j->value_type= JSON_VALUE_UNINITIALIZED;
if (j->state == JST_KEY)
{
while (json_read_keyname_chr(j) == 0) {}
diff --git a/strings/json_normalize.c b/strings/json_normalize.c
new file mode 100644
index 00000000000..0b7f172dae6
--- /dev/null
+++ b/strings/json_normalize.c
@@ -0,0 +1,852 @@
+/* Copyright (c) 2021 Eric Herman and 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 <my_global.h>
+#include <json_lib.h>
+
+#ifndef PSI_JSON
+#define PSI_JSON PSI_NOT_INSTRUMENTED
+#endif
+
+#ifndef JSON_MALLOC_FLAGS
+#define JSON_MALLOC_FLAGS MYF(MY_THREAD_SPECIFIC|MY_WME)
+#endif
+
+/*
+From the EXPIRED DRAFT JSON Canonical Form
+https://datatracker.ietf.org/doc/html/draft-staykov-hu-json-canonical-form-00
+
+2. JSON canonical form
+
+ The canonical form is defined by the following rules:
+ * The document MUST be encoded in UTF-8 [UTF-8]
+ * Non-significant(1) whitespace characters MUST NOT be used
+ * Non-significant(1) line endings MUST NOT be used
+ * Entries (set of name/value pairs) in JSON objects MUST be sorted
+ lexicographically(2) by their names
+ * Arrays MUST preserve their initial ordering
+
+ (1)As defined in JSON data-interchange format [JSON], JSON objects
+ consists of multiple "name"/"value" pairs and JSON arrays consists
+ of multiple "value" fields. Non-significant means not part of
+ "name" or "value".
+
+
+ (2)Lexicographic comparison, which orders strings from least to
+ greatest alphabetically based on the UCS (Unicode Character Set)
+ codepoint values.
+*/
+
+
+struct json_norm_array {
+ DYNAMIC_ARRAY values;
+};
+
+
+struct json_norm_object {
+ DYNAMIC_ARRAY kv_pairs;
+};
+
+
+struct json_norm_value {
+ enum json_value_types type;
+ union {
+ DYNAMIC_STRING number;
+ LEX_STRING string;
+ struct json_norm_array array;
+ struct json_norm_object object;
+ } value;
+};
+
+
+struct json_norm_kv {
+ LEX_STRING key;
+ struct json_norm_value value;
+};
+
+
+static void *
+json_norm_malloc(size_t size)
+{
+ return my_malloc(PSI_JSON, size, JSON_MALLOC_FLAGS);
+}
+
+
+int
+json_norm_string_init(LEX_STRING *string, const char *str, size_t len)
+{
+ string->length= len + 1;
+ string->str= json_norm_malloc(string->length);
+ if (!string->str)
+ {
+ string->length= 0;
+ return 1;
+ }
+ strncpy(string->str, str, len);
+ string->str[len]= 0;
+ return 0;
+}
+
+
+void
+json_norm_string_free(LEX_STRING *string)
+{
+ my_free(string->str);
+ string->str= NULL;
+ string->length= 0;
+}
+
+
+void
+json_norm_number_free(DYNAMIC_STRING *number)
+{
+ dynstr_free(number);
+ number->length= 0;
+}
+
+
+int
+json_normalize_number(DYNAMIC_STRING *out, const char *str, size_t str_len)
+{
+ int err= 0;
+ long int magnitude= 0;
+ int negative= 0;
+ size_t i= 0;
+ size_t j= 0;
+ size_t k= 0;
+ char *buf= NULL;
+ size_t buf_size = str_len + 1;
+
+ buf= json_norm_malloc(buf_size);
+ if (!buf)
+ return 1;
+
+ memset(buf, 0x00, buf_size);
+
+ if (str[0] == '-')
+ {
+ negative= 1;
+ ++i;
+ }
+
+ /* grab digits preceding the decimal */
+ for (; i < str_len && str[i] != '.' && str[i] != 'e' && str[i] != 'E'; ++i)
+ buf[j++] = str[i];
+
+ magnitude = (long)(j - 1);
+
+ /* skip the . */
+ if (str[i] == '.')
+ ++i;
+
+ /* grab rest of digits before the E */
+ for (; i < str_len && str[i] != 'e' && str[i] != 'E'; ++i)
+ buf[j++] = str[i];
+
+ /* trim trailing zeros */
+ for (k = j - 1; k && buf[k] == '0'; --k, --j)
+ buf[k] = '\0';
+
+ /* trim the leading zeros */
+ for (k = 0; buf[k] && buf[k] == '0'; ++k);
+ if (k)
+ {
+ memmove(buf, buf + k, j - k);
+ j = j - k;
+ buf[j] = '\0';
+ magnitude -= (long)k;
+ }
+
+ if (!j)
+ {
+ err= dynstr_append_mem(out, STRING_WITH_LEN("0.0E0"));
+ my_free(buf);
+ return err;
+ }
+
+ if (negative)
+ err|= dynstr_append_mem(out, STRING_WITH_LEN("-"));
+ err|= dynstr_append_mem(out, buf, 1);
+ err|= dynstr_append_mem(out, STRING_WITH_LEN("."));
+ if (j == 1)
+ err|= dynstr_append_mem(out, STRING_WITH_LEN("0"));
+ else
+ err|= dynstr_append(out, buf + 1);
+
+ err|= dynstr_append_mem(out, STRING_WITH_LEN("E"));
+
+ if (str[i] == 'e' || str[i] == 'E')
+ {
+ char *endptr = NULL;
+ /* skip the [eE] */
+ ++i;
+ /* combine the exponent with current magnitude */
+ magnitude += strtol(str + i, &endptr, 10);
+ }
+ snprintf(buf, buf_size, "%ld", magnitude);
+ err|= dynstr_append(out, buf);
+
+ my_free(buf);
+ return err ? 1 : 0;
+}
+
+
+static int
+json_norm_object_append_key_value(struct json_norm_object *obj,
+ DYNAMIC_STRING *key,
+ struct json_norm_value *val)
+{
+ struct json_norm_kv pair;
+ int err= json_norm_string_init(&pair.key, key->str, key->length);
+
+ if (err)
+ return 1;
+
+ pair.value= *val;
+
+ err|= insert_dynamic(&obj->kv_pairs, &pair);
+ if (err)
+ {
+ json_norm_string_free(&pair.key);
+ return 1;
+ }
+
+ return 0;
+}
+
+
+static struct json_norm_kv*
+json_norm_object_get_last_element(struct json_norm_object *obj)
+{
+ struct json_norm_kv *kv;
+
+ DBUG_ASSERT(obj->kv_pairs.elements > 0);
+ kv= dynamic_element(&obj->kv_pairs,
+ obj->kv_pairs.elements - 1,
+ struct json_norm_kv*);
+ return kv;
+}
+
+
+static struct json_norm_value*
+json_norm_array_get_last_element(struct json_norm_array *arr)
+{
+ struct json_norm_value *val;
+
+ DBUG_ASSERT(arr->values.elements > 0);
+ val= dynamic_element(&arr->values,
+ arr->values.elements - 1,
+ struct json_norm_value*);
+ return val;
+}
+
+
+static int
+json_norm_array_append_value(struct json_norm_array *arr,
+ struct json_norm_value *val)
+{
+ return insert_dynamic(&arr->values, val);
+}
+
+
+int
+json_norm_init_dynamic_array(size_t element_size, void *where)
+{
+ const size_t init_alloc= 20;
+ const size_t alloc_increment= 20;
+ return my_init_dynamic_array(PSI_JSON, where, element_size,
+ init_alloc, alloc_increment,
+ JSON_MALLOC_FLAGS);
+}
+
+
+int
+json_norm_value_object_init(struct json_norm_value *val)
+{
+ const size_t element_size= sizeof(struct json_norm_kv);
+ struct json_norm_object *obj= &val->value.object;
+
+ val->type= JSON_VALUE_OBJECT;
+
+ return json_norm_init_dynamic_array(element_size, &obj->kv_pairs);
+}
+
+
+int
+json_norm_value_array_init(struct json_norm_value *val)
+{
+ const size_t element_size= sizeof(struct json_norm_value);
+ struct json_norm_array *array= &val->value.array;
+
+ val->type= JSON_VALUE_ARRAY;
+
+ return json_norm_init_dynamic_array(element_size, &array->values);
+}
+
+
+static int
+json_norm_value_string_init(struct json_norm_value *val,
+ const char *str, size_t len)
+{
+ val->type= JSON_VALUE_STRING;
+ return json_norm_string_init(&val->value.string, str, len);
+}
+
+
+static int
+json_norm_kv_comp(const struct json_norm_kv *a,
+ const struct json_norm_kv *b)
+{
+ return my_strnncoll(&my_charset_utf8mb4_bin,
+ (const uchar *)a->key.str, a->key.length,
+ (const uchar *)b->key.str, b->key.length);
+}
+
+
+static void
+json_normalize_sort(struct json_norm_value *val)
+{
+ switch (val->type) {
+ case JSON_VALUE_OBJECT:
+ {
+ size_t i;
+ DYNAMIC_ARRAY *pairs= &val->value.object.kv_pairs;
+ for (i= 0; i < pairs->elements; ++i)
+ {
+ struct json_norm_kv *kv= dynamic_element(pairs, i, struct json_norm_kv*);
+ json_normalize_sort(&kv->value);
+ }
+
+ my_qsort(dynamic_element(pairs, 0, struct json_norm_kv*),
+ pairs->elements, sizeof(struct json_norm_kv),
+ (qsort_cmp) json_norm_kv_comp);
+ break;
+ }
+ case JSON_VALUE_ARRAY:
+ {
+ /* Arrays in JSON must keep the order. Just recursively sort values. */
+ size_t i;
+ DYNAMIC_ARRAY *values= &val->value.array.values;
+ for (i= 0; i < values->elements; ++i)
+ {
+ struct json_norm_value *value;
+ value= dynamic_element(values, i, struct json_norm_value*);
+ json_normalize_sort(value);
+ }
+
+ break;
+ }
+ case JSON_VALUE_UNINITIALIZED:
+ DBUG_ASSERT(0);
+ break;
+ default: /* Nothing to do for other types. */
+ break;
+ }
+}
+
+
+static void
+json_norm_value_free(struct json_norm_value *val)
+{
+ size_t i;
+ switch (val->type) {
+ case JSON_VALUE_OBJECT:
+ {
+ struct json_norm_object *obj= &val->value.object;
+
+ DYNAMIC_ARRAY *pairs_arr= &obj->kv_pairs;
+ for (i= 0; i < pairs_arr->elements; ++i)
+ {
+ struct json_norm_kv *kv;
+ kv= dynamic_element(pairs_arr, i, struct json_norm_kv *);
+ json_norm_string_free(&kv->key);
+ json_norm_value_free(&kv->value);
+ }
+ delete_dynamic(pairs_arr);
+ break;
+ }
+ case JSON_VALUE_ARRAY:
+ {
+ struct json_norm_array *arr= &val->value.array;
+
+ DYNAMIC_ARRAY *values_arr= &arr->values;
+ for (i= 0; i < arr->values.elements; ++i)
+ {
+ struct json_norm_value *jt_value;
+ jt_value= dynamic_element(values_arr, i, struct json_norm_value *);
+ json_norm_value_free(jt_value);
+ }
+ delete_dynamic(values_arr);
+ break;
+ }
+ case JSON_VALUE_STRING:
+ {
+ json_norm_string_free(&val->value.string);
+ break;
+ }
+ case JSON_VALUE_NUMBER:
+ json_norm_number_free(&val->value.number);
+ break;
+ case JSON_VALUE_NULL:
+ case JSON_VALUE_TRUE:
+ case JSON_VALUE_FALSE:
+ case JSON_VALUE_UNINITIALIZED:
+ break;
+ }
+ val->type= JSON_VALUE_UNINITIALIZED;
+}
+
+
+static int
+json_norm_to_string(DYNAMIC_STRING *buf, struct json_norm_value *val)
+{
+ switch (val->type)
+ {
+ case JSON_VALUE_OBJECT:
+ {
+ size_t i;
+ struct json_norm_object *obj= &val->value.object;
+ DYNAMIC_ARRAY *pairs_arr= &obj->kv_pairs;
+
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("{")))
+ return 1;
+
+ for (i= 0; i < pairs_arr->elements; ++i)
+ {
+ struct json_norm_kv *kv;
+ kv= dynamic_element(pairs_arr, i, struct json_norm_kv *);
+
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("\"")) ||
+ dynstr_append(buf, kv->key.str) ||
+ dynstr_append_mem(buf, STRING_WITH_LEN("\":")) ||
+ json_norm_to_string(buf, &kv->value))
+ return 1;
+
+ if (i != (pairs_arr->elements - 1))
+ if (dynstr_append_mem(buf, STRING_WITH_LEN(",")))
+ return 1;
+ }
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("}")))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_ARRAY:
+ {
+ size_t i;
+ struct json_norm_array *arr= &val->value.array;
+ DYNAMIC_ARRAY *values_arr= &arr->values;
+
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("[")))
+ return 1;
+ for (i= 0; i < values_arr->elements; ++i)
+ {
+ struct json_norm_value *jt_value;
+ jt_value= dynamic_element(values_arr, i, struct json_norm_value *);
+
+ if (json_norm_to_string(buf, jt_value))
+ return 1;
+ if (i != (values_arr->elements - 1))
+ if (dynstr_append_mem(buf, STRING_WITH_LEN(",")))
+ return 1;
+ }
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("]")))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_STRING:
+ {
+ if (dynstr_append(buf, val->value.string.str))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_NULL:
+ {
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("null")))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_TRUE:
+ {
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("true")))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_FALSE:
+ {
+ if (dynstr_append_mem(buf, STRING_WITH_LEN("false")))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_NUMBER:
+ {
+ if (dynstr_append(buf, val->value.number.str))
+ return 1;
+ break;
+ }
+ case JSON_VALUE_UNINITIALIZED:
+ {
+ DBUG_ASSERT(0);
+ break;
+ }
+ }
+ return 0;
+}
+
+
+static int
+json_norm_value_number_init(struct json_norm_value *val,
+ const char *number, size_t num_len)
+{
+ int err;
+ val->type= JSON_VALUE_NUMBER;
+ err= init_dynamic_string(&val->value.number, NULL, 0, 0);
+ if (err)
+ return 1;
+ err= json_normalize_number(&val->value.number, number, num_len);
+ if (err)
+ dynstr_free(&val->value.number);
+ return err;
+}
+
+
+static void
+json_norm_value_null_init(struct json_norm_value *val)
+{
+ val->type= JSON_VALUE_NULL;
+}
+
+
+static void
+json_norm_value_false_init(struct json_norm_value *val)
+{
+ val->type= JSON_VALUE_FALSE;
+}
+
+
+static void
+json_norm_value_true_init(struct json_norm_value *val)
+{
+ val->type= JSON_VALUE_TRUE;
+}
+
+
+static int
+json_norm_value_init(struct json_norm_value *val, json_engine_t *je)
+{
+ int err= 0;
+ switch (je->value_type) {
+ case JSON_VALUE_STRING:
+ {
+ const char *je_value_begin= (const char *)je->value_begin;
+ size_t je_value_len= (je->value_end - je->value_begin);
+ err= json_norm_value_string_init(val, je_value_begin, je_value_len);
+ break;
+ }
+ case JSON_VALUE_NULL:
+ {
+ json_norm_value_null_init(val);
+ break;
+ }
+ case JSON_VALUE_TRUE:
+ {
+ json_norm_value_true_init(val);
+ break;
+ }
+ case JSON_VALUE_FALSE:
+ {
+ json_norm_value_false_init(val);
+ break;
+ }
+ case JSON_VALUE_ARRAY:
+ {
+ err= json_norm_value_array_init(val);
+ break;
+ }
+ case JSON_VALUE_OBJECT:
+ {
+ err= json_norm_value_object_init(val);
+ break;
+ }
+ case JSON_VALUE_NUMBER:
+ {
+ const char *je_number_begin= (const char *)je->value_begin;
+ size_t je_number_len= (je->value_end - je->value_begin);
+ err= json_norm_value_number_init(val, je_number_begin, je_number_len);
+ break;
+ }
+ default:
+ DBUG_ASSERT(0);
+ return 1;
+ }
+ return err;
+}
+
+
+static int
+json_norm_append_to_array(struct json_norm_value *val,
+ json_engine_t *je)
+{
+ int err= 0;
+ struct json_norm_value tmp;
+
+ DBUG_ASSERT(val->type == JSON_VALUE_ARRAY);
+ DBUG_ASSERT(je->value_type != JSON_VALUE_UNINITIALIZED);
+
+ err= json_norm_value_init(&tmp, je);
+
+ if (err)
+ return 1;
+
+ err= json_norm_array_append_value(&val->value.array, &tmp);
+
+ if (err)
+ json_norm_value_free(&tmp);
+
+ return err;
+}
+
+
+static int
+json_norm_append_to_object(struct json_norm_value *val,
+ DYNAMIC_STRING *key, json_engine_t *je)
+{
+ int err= 0;
+ struct json_norm_value tmp;
+
+ DBUG_ASSERT(val->type == JSON_VALUE_OBJECT);
+ DBUG_ASSERT(je->value_type != JSON_VALUE_UNINITIALIZED);
+
+ err= json_norm_value_init(&tmp, je);
+
+ if (err)
+ return 1;
+
+ err= json_norm_object_append_key_value(&val->value.object, key, &tmp);
+
+ if (err)
+ json_norm_value_free(&tmp);
+
+ return err;
+}
+
+
+static int
+json_norm_parse(struct json_norm_value *root, json_engine_t *je)
+{
+ size_t current;
+ struct json_norm_value *stack[JSON_DEPTH_LIMIT];
+ int err= 0;
+ DYNAMIC_STRING key;
+
+ err= init_dynamic_string(&key, NULL, 0, 0);
+ if (err)
+ goto json_norm_parse_end;
+
+ memset(stack, 0x00, sizeof(stack));
+ current= 0;
+ stack[current]= root;
+
+ do {
+ switch (je->state)
+ {
+ case JST_KEY:
+ {
+ const uchar *key_start= je->s.c_str;
+ const uchar *key_end;
+
+ DBUG_ASSERT(stack[current]->type == JSON_VALUE_OBJECT);
+ do
+ {
+ key_end= je->s.c_str;
+ } while (json_read_keyname_chr(je) == 0);
+
+ /* we have the key name */
+ /* reset the dynstr: */
+ dynstr_trunc(&key, key.length);
+ dynstr_append_mem(&key, (char *)key_start, (key_end - key_start));
+
+ /* After reading the key, we have a follow-up value. */
+ err= json_read_value(je);
+ if (err)
+ goto json_norm_parse_end;
+
+ err= json_norm_append_to_object(stack[current], &key, je);
+ if (err)
+ goto json_norm_parse_end;
+
+ if (je->value_type == JSON_VALUE_ARRAY ||
+ je->value_type == JSON_VALUE_OBJECT)
+ {
+ struct json_norm_kv *kv;
+
+ err= ((current + 1) == JSON_DEPTH_LIMIT);
+ if (err)
+ goto json_norm_parse_end;
+
+ kv= json_norm_object_get_last_element(&stack[current]->value.object);
+ stack[++current]= &kv->value;
+ }
+ break;
+ }
+ case JST_VALUE:
+ {
+ struct json_norm_array *current_arr= &stack[current]->value.array;
+ err= json_read_value(je);
+ if (err)
+ goto json_norm_parse_end;
+
+ DBUG_ASSERT(stack[current]->type == JSON_VALUE_ARRAY);
+
+ err= json_norm_append_to_array(stack[current], je);
+ if (err)
+ goto json_norm_parse_end;
+
+ if (je->value_type == JSON_VALUE_ARRAY ||
+ je->value_type == JSON_VALUE_OBJECT)
+ {
+
+ err= ((current + 1) == JSON_DEPTH_LIMIT);
+ if (err)
+ goto json_norm_parse_end;
+
+ stack[++current]= json_norm_array_get_last_element(current_arr);
+ }
+
+ break;
+ }
+ case JST_OBJ_START:
+ /* parser found an object (the '{' in JSON) */
+ break;
+ case JST_OBJ_END:
+ /* parser found the end of the object (the '}' in JSON) */
+ /* pop stack */
+ --current;
+ break;
+ case JST_ARRAY_START:
+ /* parser found an array (the '[' in JSON) */
+ break;
+ case JST_ARRAY_END:
+ /* parser found the end of the array (the ']' in JSON) */
+ /* pop stack */
+ --current;
+ break;
+ };
+ } while (json_scan_next(je) == 0);
+
+json_norm_parse_end:
+ dynstr_free(&key);
+ return err;
+}
+
+
+static int
+json_norm_build(struct json_norm_value *root,
+ const char *s, size_t size, CHARSET_INFO *cs)
+{
+ int err= 0;
+ json_engine_t je;
+
+ DBUG_ASSERT(s);
+ memset(&je, 0x00, sizeof(je));
+
+ memset(root, 0x00, sizeof(struct json_norm_value));
+ root->type= JSON_VALUE_UNINITIALIZED;
+
+ err= json_scan_start(&je, cs, (const uchar *)s, (const uchar *)(s + size));
+ if (json_read_value(&je))
+ return err;
+
+ err= json_norm_value_init(root, &je);
+
+ if (root->type == JSON_VALUE_OBJECT ||
+ root->type == JSON_VALUE_ARRAY)
+ {
+ err= json_norm_parse(root, &je);
+ if (err)
+ return err;
+ }
+ return err;
+}
+
+
+int
+json_normalize(DYNAMIC_STRING *result,
+ const char *s, size_t size, CHARSET_INFO *cs)
+{
+ int err= 0;
+ uint convert_err= 0;
+ struct json_norm_value root;
+ char *s_utf8= NULL;
+ size_t in_size;
+ const char *in;
+
+ DBUG_ASSERT(result);
+
+ memset(&root, 0x00, sizeof(root));
+ root.type = JSON_VALUE_UNINITIALIZED;
+
+ /*
+ Convert the incoming string to utf8mb4_bin before doing any other work.
+ According to JSON RFC 8259, between systems JSON must be UTF-8
+ https://datatracker.ietf.org/doc/html/rfc8259#section-8.1
+ */
+ if (cs == &my_charset_utf8mb4_bin)
+ {
+ in= s;
+ in_size= size;
+ }
+ else
+ {
+ in_size= (size * my_charset_utf8mb4_bin.mbmaxlen) + 1;
+ s_utf8= json_norm_malloc(in_size);
+ if (!s_utf8)
+ return 1;
+ memset(s_utf8, 0x00, in_size);
+ my_convert(s_utf8, (uint32)in_size, &my_charset_utf8mb4_bin,
+ s, (uint32)size, cs, &convert_err);
+ if (convert_err)
+ {
+ my_free(s_utf8);
+ return 1;
+ }
+ in= s_utf8;
+ in_size= strlen(s_utf8);
+ }
+
+
+ if (!json_valid(in, in_size, &my_charset_utf8mb4_bin))
+ {
+ err= 1;
+ goto json_normalize_end;
+ }
+
+ err= json_norm_build(&root, in, in_size, &my_charset_utf8mb4_bin);
+ if (err)
+ goto json_normalize_end;
+
+ json_normalize_sort(&root);
+
+ err= json_norm_to_string(result, &root);
+
+json_normalize_end:
+ json_norm_value_free(&root);
+ if (err)
+ dynstr_free(result);
+ if (s_utf8)
+ my_free(s_utf8);
+ return err;
+}
+
+
diff --git a/strings/strcoll.inl b/strings/strcoll.inl
index 50849c06e7d..eb5c6e3c717 100644
--- a/strings/strcoll.inl
+++ b/strings/strcoll.inl
@@ -16,6 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
+#include "ctype-ascii.h"
+
#ifndef MY_FUNCTION_NAME
#error MY_FUNCTION_NAME is not defined
#endif
@@ -40,6 +42,42 @@
/*
+ For binary collations:
+ - on 32bit platforms perform only 4 byte optimization
+ - on 64bit platforms perform both 4 byte and 8 byte optimization
+*/
+#if defined(STRCOLL_MB7_BIN)
+#define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_mb7_bin_4bytes((a),(b))
+#if SIZEOF_VOIDP == 8
+#define STRCOLL_MB7_8BYTES
+#define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_mb7_bin_8bytes((a),(b))
+#endif /* Architecture test */
+#endif /* STRCOLL_MB7_BIN */
+
+
+/*
+ For case insensitive collations with trivial mapping from [a-z] to [A-Z]
+ perform optimization only on 64 bit platforms.
+ There is no sense to perform my_ascii_to_upper_magic_uint64() based
+ optimization on 32bit platforms. The idea of this optimization
+ is that it handles 8bytes at a time, using 64bit CPU registers.
+ Enabling this optimization on 32bit platform may only slow things down.
+*/
+#if defined(STRCOLL_MB7_TOUPPER)
+#if SIZEOF_VOIDP == 8
+#define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_ascii_toupper_4bytes((a),(b))
+#define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_ascii_toupper_8bytes((a),(b))
+#endif /* Architecture test */
+#endif /* STRCOLL_MB7_TOUPPER */
+
+
+/*
+ A helper macro to shift two pointers forward, to the given amount.
+*/
+#define MY_STRING_SHIFT_PTR_PTR(a,b,len) do { a+= len; b+= len; } while(0)
+
+
+/*
Weight of an illegal byte, must follow these rules:
1. Must be greater than weight of any normal character in the collation.
2. Two different bad bytes must have different weights and must be
@@ -182,7 +220,31 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),
{
int a_weight, b_weight, res;
uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
- uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ uint b_wlen;
+
+#ifdef MY_STRCOLL_MB7_4BYTES
+ if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))
+ {
+ int res;
+#ifdef MY_STRCOLL_MB7_8BYTES
+ /*TODO: a a loop here >='a' <='z' here, for automatic vectorization*/
+ if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))
+ {
+ if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 8);
+ continue;
+ }
+#endif
+ if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 4);
+ continue;
+ }
+#endif /* MY_STRCOLL_MB7_4BYTES */
+
+ b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+
/*
a_wlen b_wlen Comment
------ ------ -------
@@ -253,7 +315,30 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
{
int a_weight, b_weight, res;
uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
- uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ uint b_wlen;
+
+#ifdef MY_STRCOLL_MB7_4BYTES
+ if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))
+ {
+ int res;
+#ifdef MY_STRCOLL_MB7_8BYTES
+ if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))
+ {
+ if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 8);
+ continue;
+ }
+#endif
+ if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 4);
+ continue;
+ }
+#endif /* MY_STRCOLL_MB7_4BYTES */
+
+ b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+
if ((res= (a_weight - b_weight)))
{
/*
@@ -286,7 +371,7 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
DBUG_ASSERT(0);
return 0;
}
-#endif
+#endif /* DEFINE_STRNNCOLLSP_NOPAD */
/**
@@ -652,3 +737,8 @@ MY_FUNCTION_NAME(strnxfrm_nopad)(CHARSET_INFO *cs,
#undef DEFINE_STRNXFRM_UNICODE_BIN2
#undef DEFINE_STRNNCOLL
#undef DEFINE_STRNNCOLLSP_NOPAD
+
+#undef STRCOLL_MB7_TOUPPER
+#undef STRCOLL_MB7_BIN
+#undef MY_STRCOLL_MB7_4BYTES
+#undef MY_STRCOLL_MB7_8BYTES
diff --git a/support-files/rpm/server.cnf b/support-files/rpm/server.cnf
index 589a185fb3d..9b384c9c6ee 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.6 servers.
+# This group is only read by MariaDB-10.7 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.6]
+[mariadb-10.7]
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 3e41f8b70b0..528eece56b8 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -21712,6 +21712,95 @@ static void test_cache_metadata()
mysql_stmt_close(stmt);
}
+void test_mdev_10075()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ MYSQL_RES *result;
+ MYSQL_BIND my_bind[1];
+ MYSQL_BIND my_bind2[1];
+
+ struct st_data {
+ unsigned long id;
+ char id_ind;
+ };
+
+ struct st_data data[]= {
+ {0, STMT_INDICATOR_NONE},
+ {1, STMT_INDICATOR_NONE},
+ {2, STMT_INDICATOR_NONE}
+ };
+
+ struct st_data data2[]= {
+ {3, STMT_INDICATOR_NONE},
+ {2, STMT_INDICATOR_NONE},
+ {4, STMT_INDICATOR_NONE}
+ };
+
+ myheader("test_mdev_10075");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1(id INT PRIMARY KEY)");
+ myquery(rc);
+
+ /* insert by prepare */
+ stmt= mysql_simple_prepare(mysql,
+ "INSERT INTO t1 VALUES(?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ /* bzero bind structure */
+ bzero((char*) my_bind, sizeof(my_bind));
+ my_bind[0].buffer_type= MYSQL_TYPE_LONG;
+ my_bind[0].buffer= (void *)&data[0].id;
+
+ rc= mysql_stmt_bind_param(stmt, my_bind);
+ check_execute(stmt, rc);
+
+ /* Set array size, row size and bind the parameter */
+ mysql_stmt_bind_param(stmt, my_bind);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ stmt= mysql_simple_prepare(mysql,
+ "INSERT IGNORE INTO t1 VALUES(?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ /* bzero bind structure */
+ bzero((char*) my_bind2, sizeof(my_bind2));
+ my_bind2[0].buffer_type= MYSQL_TYPE_LONG;
+ my_bind2[0].buffer= (void *)&data2[0].id;
+
+ rc= mysql_stmt_bind_param(stmt, my_bind2);
+ check_execute(stmt, rc);
+
+ mysql_stmt_bind_param(stmt, my_bind2);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "GET DIAGNOSTICS CONDITION 1 @var1 = ROW_NUMBER");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "SELECT @var1");
+ myquery(rc);
+
+ result= mysql_store_result(mysql);
+ mytest(result);
+
+ rc= my_process_result_set(result);
+ DIE_UNLESS(rc == 1);
+
+ mysql_free_result(result);
+}
static struct my_tests_st my_tests[]= {
{ "test_mdev_20516", test_mdev_20516 },
@@ -22019,6 +22108,7 @@ static struct my_tests_st my_tests[]= {
{ "test_mdev20261", test_mdev20261 },
{ "test_execute_direct", test_execute_direct },
{ "test_cache_metadata", test_cache_metadata},
+ { "test_mdev_10075", test_mdev_10075},
{ 0, 0 }
};
diff --git a/tpool/CMakeLists.txt b/tpool/CMakeLists.txt
index 3a49ea22837..115e3d58634 100644
--- a/tpool/CMakeLists.txt
+++ b/tpool/CMakeLists.txt
@@ -15,11 +15,11 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
ADD_DEFINITIONS(-DHAVE_URING)
LINK_LIBRARIES(${URING_LIBRARIES})
- INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${URING_INCLUDE_DIRS})
SET(EXTRA_SOURCES aio_liburing.cc)
SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
- SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR})
+ SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIRS})
SET(CMAKE_REQUIRED_LIBRARIES ${URING_LIBRARIES})
CHECK_SYMBOL_EXISTS(io_uring_mlock_size "liburing.h" HAVE_IO_URING_MLOCK_SIZE)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
@@ -32,7 +32,7 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(LIBAIO_FOUND)
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
- INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIRS})
LINK_LIBRARIES(${LIBAIO_LIBRARIES})
SET(EXTRA_SOURCES aio_linux.cc)
ENDIF()
diff --git a/unittest/json_lib/CMakeLists.txt b/unittest/json_lib/CMakeLists.txt
index 1b2a89b28cd..157f37291e9 100644
--- a/unittest/json_lib/CMakeLists.txt
+++ b/unittest/json_lib/CMakeLists.txt
@@ -19,4 +19,4 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/unittest/mytap)
#
-MY_ADD_TESTS(json_lib LINK_LIBRARIES strings dbug)
+MY_ADD_TESTS(json_lib json_normalize LINK_LIBRARIES strings dbug)
diff --git a/unittest/json_lib/json_normalize-t.c b/unittest/json_lib/json_normalize-t.c
new file mode 100644
index 00000000000..f72e90175e2
--- /dev/null
+++ b/unittest/json_lib/json_normalize-t.c
@@ -0,0 +1,280 @@
+/* Copyright (c) 2021 Eric Herman and MariaDB Foundation.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include "my_config.h"
+#include "config.h"
+#include <tap.h>
+#include <my_global.h>
+#include <json_lib.h>
+
+
+static void
+check_json_normalize(const char *in, const char *expected)
+{
+ int err;
+ DYNAMIC_STRING result;
+
+ CHARSET_INFO *cs= &my_charset_utf8mb4_general_ci;
+
+ init_dynamic_string(&result, NULL, 0, 0);
+
+ err= json_normalize(&result, in, strlen(in), cs);
+
+ ok(err == 0, "normalize err?");
+
+ ok(strcmp(expected, result.str) == 0,
+ "expected '%s' from '%s' but was '%s'",
+ expected, in, result.str);
+
+ dynstr_free(&result);
+}
+
+
+static void
+test_json_normalize_invalid(void)
+{
+ DYNAMIC_STRING result;
+
+ CHARSET_INFO *cs= &my_charset_utf8mb4_general_ci;
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ ok(json_normalize(&result, STRING_WITH_LEN(""), cs) != 0,
+ "expected normalized error");
+ dynstr_free(&result);
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ ok(json_normalize(&result, STRING_WITH_LEN("["), cs) != 0,
+ "expected normalized error");
+ dynstr_free(&result);
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ ok(json_normalize(&result, STRING_WITH_LEN("}"), cs) != 0,
+ "expected normalized error");
+ dynstr_free(&result);
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ ok(json_normalize(&result, NULL, 0, cs) != 0,
+ "expected normalized error");
+ dynstr_free(&result);
+}
+
+
+static void
+test_json_normalize_single_kv(void)
+{
+ const char *in= ""
+ "{\n"
+ " \"foo\": \"value\"\n"
+ "}\n";
+
+ const char *expected= "{\"foo\":\"value\"}";
+ check_json_normalize(in, expected);
+}
+
+
+static void
+test_json_normalize_multi_kv(void)
+{
+ const char *in= ""
+ "{\n"
+ " \"bar\": \"baz\",\n"
+ " \"foo\": \"value\"\n"
+ "}\n";
+
+ const char *expected= "{\"bar\":\"baz\",\"foo\":\"value\"}";
+ check_json_normalize(in, expected);
+}
+
+
+static void
+test_json_normalize_array(void)
+{
+ const char *in= "[ \"a\", \"b\", true, false, null ]";
+ const char *expected= "[\"a\",\"b\",true,false,null]";
+ check_json_normalize(in, expected);
+}
+
+
+static void
+test_json_normalize_values(void)
+{
+ check_json_normalize("\"foo\"", "\"foo\"");
+ check_json_normalize("true", "true");
+ check_json_normalize("false", "false");
+ check_json_normalize("null", "null");
+ check_json_normalize("\"\"", "\"\"");
+ check_json_normalize("{}", "{}");
+ check_json_normalize("[]", "[]");
+ check_json_normalize("5", "5.0E0");
+ check_json_normalize("5.1", "5.1E0");
+ check_json_normalize("-5.1", "-5.1E0");
+ check_json_normalize("12345.67890", "1.23456789E4");
+ check_json_normalize("2.99792458e8", "2.99792458E8");
+ check_json_normalize("6.02214076e23", "6.02214076E23");
+ check_json_normalize("6.62607015e-34", "6.62607015E-34");
+ check_json_normalize("-6.62607015e-34", "-6.62607015E-34");
+}
+
+
+static void
+test_json_normalize_nested_objects(void)
+{
+ const char *in = ""
+ "{\n"
+ " \"wiz\": {\n"
+ "\t\t\"bang\": \"a\",\n\t\t\"alpha\": false\n\t},\n"
+ " \"foo\": {\"value\":true}\n"
+ "}";
+
+ const char *expected= "{\"foo\":{\"value\":true},"
+ "\"wiz\":{\"alpha\":false,\"bang\":\"a\"}}";
+ check_json_normalize(in, expected);
+}
+
+
+static void
+test_json_normalize_nested_arrays(void)
+{
+ const char *in = ""
+ "[\n"
+ " \"wiz\",\n"
+ " [\"bang\", \t\t\"alpha\"\t]\n"
+ "]";
+
+ const char *expected= "[\"wiz\",[\"bang\",\"alpha\"]]";
+ check_json_normalize(in, expected);
+}
+
+
+static void
+test_json_normalize_nested_deep(void)
+{
+ const char *in = ""
+ "{\n"
+ " \"foo\": \"value\",\n"
+ " \"wiz\": [true, false, {\n"
+ "\t\t\"bang\": \"a\",\n\t\t\"alpha\": 12345.67890\n\t},\n \"string\",\n"
+ "\t{ \"b\": \"one\", \"a\": \"two\", \"c\": \"three\"}, false,\n"
+ "\t\t[-1.20, \"w\", \"x\"]],\n"
+ " \"bar\": \"value2\"\n"
+ "}\n";
+
+ const char *expected= ""
+ "{"
+ "\"bar\":\"value2\","
+ "\"foo\":\"value\","
+ "\"wiz\":["
+ "true,false,"
+ "{\"alpha\":1.23456789E4,\"bang\":\"a\"},"
+ "\"string\","
+ "{\"a\":\"two\",\"b\":\"one\",\"c\":\"three\"},"
+ "false,"
+ "[-1.2E0,\"w\",\"x\"]"
+ "]"
+ "}";
+ check_json_normalize(in, expected);
+}
+
+
+/* a "friend" function */
+int
+json_normalize_number(DYNAMIC_STRING *out, const char *str, size_t str_len);
+
+
+static void
+test_json_normalize_non_utf8(void)
+{
+ int err;
+ const char utf8[]= { 0x22, 0xC3, 0x8A, 0x22, 0x00 };
+ const char latin[] = { 0x22, 0xCA, 0x22, 0x00 };
+ DYNAMIC_STRING result;
+ CHARSET_INFO *cs_utf8= &my_charset_utf8mb4_bin;
+ CHARSET_INFO *cs_latin= &my_charset_latin1;
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ err= json_normalize(&result, utf8, strlen(utf8), cs_utf8);
+ ok(err == 0, "normalize err?");
+ ok((strcmp(utf8, result.str) == 0), "utf8 round trip");
+ dynstr_free(&result);
+
+ init_dynamic_string(&result, NULL, 0, 0);
+ err= json_normalize(&result, latin, strlen(latin), cs_latin);
+ ok(err == 0, "normalize err?");
+ ok((strcmp(utf8, result.str) == 0), "latin to utf8 round trip");
+ dynstr_free(&result);
+}
+
+
+void
+check_number_normalize(const char *in, const char *expected)
+{
+ int err;
+ DYNAMIC_STRING buf;
+
+ init_dynamic_string(&buf, NULL, 0, 0);
+
+ err= json_normalize_number(&buf, in, strlen(in));
+ ok(err == 0, "normalize number err?");
+
+ ok(strcmp(buf.str, expected) == 0,
+ "expected: %s\n"
+ " but was: %s\n"
+ " from: %s\n",
+ expected,
+ buf.str,
+ in);
+
+ dynstr_free(&buf);
+}
+
+
+int
+main(void)
+{
+ plan(88);
+ diag("Testing json_normalization.");
+
+ check_number_normalize("0", "0.0E0");
+ check_number_normalize("-0.0", "0.0E0");
+ check_number_normalize("0E100", "0.0E0");
+ check_number_normalize("0.000000E100", "0.0E0");
+ check_number_normalize("-0E100", "0.0E0");
+ check_number_normalize("-0.000E100", "0.0E0");
+ check_number_normalize("1", "1.0E0");
+ check_number_normalize("-1", "-1.0E0");
+ check_number_normalize("36", "3.6E1");
+ check_number_normalize("37.000", "3.7E1");
+ check_number_normalize("3.000", "3.0E0");
+ check_number_normalize("0.00012345", "1.2345E-4");
+ check_number_normalize("32.14e234", "3.214E235");
+ check_number_normalize("0.00357e-23", "3.57E-26");
+ check_number_normalize("0.00357e23", "3.57E20");
+ check_number_normalize("123.456e10", "1.23456E12");
+ check_number_normalize("123.456e-9", "1.23456E-7");
+ check_number_normalize("0000123.456000000e-9", "1.23456E-7");
+ check_number_normalize("0000123.456000000e+9", "1.23456E11");
+
+ test_json_normalize_invalid();
+ test_json_normalize_values();
+ test_json_normalize_single_kv();
+ test_json_normalize_multi_kv();
+ test_json_normalize_array();
+ test_json_normalize_nested_objects();
+ test_json_normalize_nested_arrays();
+ test_json_normalize_nested_deep();
+ test_json_normalize_non_utf8();
+
+ return exit_status();
+}
diff --git a/unittest/mysys/bitmap-t.c b/unittest/mysys/bitmap-t.c
index e8f41b32d2c..22466355191 100644
--- a/unittest/mysys/bitmap-t.c
+++ b/unittest/mysys/bitmap-t.c
@@ -129,8 +129,8 @@ my_bool test_compare_operators(MY_BITMAP *map, uint bitsize)
MY_BITMAP *map2= &map2_obj, *map3= &map3_obj;
my_bitmap_map map2buf[MAX_TESTED_BITMAP_SIZE];
my_bitmap_map map3buf[MAX_TESTED_BITMAP_SIZE];
- my_bitmap_init(&map2_obj, map2buf, bitsize, FALSE);
- my_bitmap_init(&map3_obj, map3buf, bitsize, FALSE);
+ my_bitmap_init(&map2_obj, map2buf, bitsize);
+ my_bitmap_init(&map3_obj, map3buf, bitsize);
bitmap_clear_all(map2);
bitmap_clear_all(map3);
for (i=0; i < no_loops; i++)
@@ -374,7 +374,7 @@ my_bool test_compare(MY_BITMAP *map, uint bitsize)
uint32 map2buf[MAX_TESTED_BITMAP_SIZE];
uint i, test_bit;
uint no_loops= bitsize > 128 ? 128 : bitsize;
- if (my_bitmap_init(&map2, map2buf, bitsize, FALSE))
+ if (my_bitmap_init(&map2, map2buf, bitsize))
{
diag("init error for bitsize %d", bitsize);
return TRUE;
@@ -433,7 +433,7 @@ my_bool test_intersect(MY_BITMAP *map, uint bitsize)
MY_BITMAP map2;
uint32 map2buf[MAX_TESTED_BITMAP_SIZE];
uint i, test_bit1, test_bit2, test_bit3;
- if (my_bitmap_init(&map2, map2buf, bitsize2, FALSE))
+ if (my_bitmap_init(&map2, map2buf, bitsize2))
{
diag("init error for bitsize %d", bitsize2);
return TRUE;
@@ -481,7 +481,7 @@ my_bool do_test(uint bitsize)
{
MY_BITMAP map;
my_bitmap_map buf[MAX_TESTED_BITMAP_SIZE];
- if (my_bitmap_init(&map, buf, bitsize, FALSE))
+ if (my_bitmap_init(&map, buf, bitsize))
{
diag("init error for bitsize %d", bitsize);
goto error;